SA-MP Forums Archive
How to check if a vehicle is being used? - 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: How to check if a vehicle is being used? (/showthread.php?tid=367054)



How to check if a vehicle is being used? - ricardo178 - 08.08.2012

THe title says all. How can i check if a vehicle is being used? Thanks.


Re: How to check if a vehicle is being used? - Roko_foko - 08.08.2012

DELETED.


Re: How to check if a vehicle is being used? - Vince - 08.08.2012

If you're going to need this frequently, then I would suggest creating a global MAX_VEHICLES array and setting the index to the playerid when he enters the vehicle. e.g.

pawn Код:
VehicleOccupied[vehicleid] = playerid;
Otherwise, just do a loop.
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
    if(IsPlayerInVehicle(i, vehicleid)) return i;



Re : How to check if a vehicle is being used? - ricardo178 - 08.08.2012

It's only for my First Person Driver script, so when i /rec(RespawnCar) it will automaticly set camera behind if there is someone inside.

It works i think.
Thanks.