why it's not working ? - 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: why it's not working ? (
/showthread.php?tid=518617)
why it's not working ? -
AnonScripter - 10.06.2014
why this cmd respan all vehicles even if players in the vehicles!!!
pawn Код:
stock IsVehicleUnOccupied(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!IsPlayerInVehicle(i, vehicleid)) return 1;
return 0;
}
}
return 0;
}
pawn Код:
CMD:respawnv(playerid, params[])
{
for(new v = 0; v < MAX_VEHICLES; v++)
{
if(IsVehicleUnOccupied(v))
{
SetVehicleToRespawn(v);
}
}
Re: why it's not working ? -
jessejanssen - 10.06.2014
Quote:
Originally Posted by AnonScripter
why this cmd respan all vehicles even if players in the vehicles!!!
pawn Код:
stock IsVehicleUnOccupied(vehicleid) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(!IsPlayerInVehicle(i, vehicleid)) return 1; return 0; } } return 0; }
pawn Код:
CMD:respawnv(playerid, params[]) { for(new v = 0; v < MAX_VEHICLES; v++) { if(IsVehicleUnOccupied(v)) { SetVehicleToRespawn(v); } }
|
pawn Код:
stock IsVehicleUnOccupied(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInVehicle(i, vehicleid)) return 0;
}
}
return 1;
}
That should fix it for you, it was checking/returning wrong.
Best regards,
Jesse
Re: why it's not working ? -
AnonScripter - 10.06.2014
yea it is, thanks very much