Jump to content

Recommended Posts

Posted (edited)

Am vrut sa fac ca la comanda /fly cand scrii o data sa te pui in flymode si cand dai iar /fly sa te opresti din zburat dar imi da niste erori si nu stiu sa le fac. Aici poza http://imgur.com/GRMNDIB

Mergi sus in GM si pui ceva gen: 

new CheckFly[MAX_PLAYERS];

Mergi la OnPlayerConnect si pui:

CheckFly[play erid] = 0; ( Am lasat spatiu pentru ca aparea userbar )

Mergi la OnPlayerDisconnect si pui:

CheckFly[play erid] = 0;

 

si la comanda ta, unde ai StartFly(playerid), stergi asta si mai pui un if care ar trebui sa arate ceva de genu:

if(CheckFly[playerid] == 0) { StartFly(playerid); CheckFly[playerid] = 1; }
else { StopFly(playerid); CheckFly[playerid] = 0; }

// Edit :

Am uitat, si stergi ce ai adaugat tu in + ( acel else cu stopfly )

Edited by Stuber
  • Upvote 1
Posted (edited)

de ce naiba ai pus de 2 ori return? =))

te folosesti de switch e mai simplu

uite un exemplu:

 

// var. globala
new flystatus[MAX_PLAYERS];
in comanda
switch(flystatus[playerid])
{
    case 0: { startfly(playerid); flystatus[playerid] = 1; }
    case 1: { stopfly[playerid); flystatus[playerid] = 0; }
 
}
Edited by L0K3D.
  • Upvote 1
Posted

Mergi sus in GM si pui ceva gen: 

new CheckFly[MAX_PLAYERS];

Mergi la OnPlayerConnect si pui:

CheckFly[play erid] = 0; ( Am lasat spatiu pentru ca aparea userbar )

Mergi la OnPlayerDisconnect si pui:

CheckFly[play erid] = 0;

 

si la comanda ta, unde ai StartFly(playerid), stergi asta si mai pui un if care ar trebui sa arate ceva de genu:

if(CheckFly[playerid] == 0) { StartFly(playerid); CheckFly[playerid] = 1; }
else { StopFly(playerid); CheckFly[playerid] = 0; }

// Edit :

Am uitat, si stergi ce ai adaugat tu in + ( acel else cu stopfly )

 Mersi.

 

 

de ce naiba ai pus de 2 ori return? =))

te folosesti de switch e mai simplu

uite un exemplu:

// var. globala
new flystatus[MAX_PLAYERS];
in comanda
switch(flystatus[playerid])
{
    case 0: { startfly(playerid); flystatus[playerid] = 1; }
    case 1: { stopfly[playerid); flystatus[playerid] = 0; }
 
}

Ma luasem dupa o comanda si nu prea stiam cum sa fac. :)

Mersi.

 

 

t/c

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

moduri samp