SA-MP Forums Archive
Get Vehicle Players? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Get Vehicle Players? (/showthread.php?tid=250020)



Get Vehicle Players? - ajwar - 21.04.2011

Hi, i have some cars made with: new cars[3];

And before destroying the car i wan't to know if someone is sitting in that car. Is it possible to check? How?


Re: Get Vehicle Players? - itachi4x4 - 21.04.2011

IsPlayerInAnyVehicle


Re: Get Vehicle Players? - Cameltoe - 21.04.2011

Quote:
Originally Posted by ajwar
Посмотреть сообщение
Hi, i have some cars made with: new cars[3];

And before destroying the car i wan't to know if someone is sitting in that car. Is it possible to check? How?
pawn Код:
for(new vehicleid; vehicleid < MAX_VEHICLES; vehicleid++)
{
     if(!IsAnyPlayerInVehicle(vehicleid)) DestroyVehicle(vehicleid);
}

stock IsAnyPlayerInVehicle(vehicleid)
{
     new bool:Is = false;
     for(new i; i < MAX_PLAYERS; i++) if(IsPlayerInVehicle(i, vehicleid)) Is = true; break;
     return Is;
}