SA-MP Forums Archive
Duble command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Duble command (/showthread.php?tid=573444)



Duble command - kalanerik99 - 07.05.2015

Hi
I wonder why I have to type command twice to tp to derby ??
Please Help! =)

Код:
CMD:derby(playerid,params[])
{
for(new x; x < 6; x++)
{
SetPlayerVirtualWorld(playerid,23);
if(DerbyVehicle[x][occupied]) continue;
PutPlayerInVehicle(playerid, DerbyVehicle[x][id], 0);
DerbyVehicle[x][occupied] = true;
break;
}
return 1;
}



Re: Duble command - ThatThoseTheThy - 07.05.2015

PHP код:
CMD:derby(playerid,params[])
{
for(new 
06x++)
{
SetPlayerVirtualWorld(playerid,23);
if(
DerbyVehicle[x][occupied]) continue;
PutPlayerInVehicle(playeridDerbyVehicle[x][id], 0);
DerbyVehicle[x][occupied] = true;
break;
}
return 
1;

try this, you neeeded to define x before you use it. That's why you have to type twice.


Re: Duble command - Threshold - 07.05.2015

Quote:
Originally Posted by ThatThoseTheThy
Посмотреть сообщение
PHP код:
CMD:derby(playerid,params[])
{
for(new 
06x++)
{
SetPlayerVirtualWorld(playerid,23);
if(
DerbyVehicle[x][occupied]) continue;
PutPlayerInVehicle(playeridDerbyVehicle[x][id], 0);
DerbyVehicle[x][occupied] = true;
break;
}
return 
1;

try this, you neeeded to define x before you use it. That's why you have to type twice.
You literally changed nothing.......

The problem here is, the vehicle 'DerbyVehicle[x][id]' doesn't exist, so when you do the command again, it goes to the next derby vehicle and that one might exist. That's why it seems like you need to do it twice.