How to check if a car is driven? - 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: How to check if a car is driven? (
/showthread.php?tid=139706)
How to check if a car is driven? -
Nameless303 - 06.04.2010
Is there something like IsDriven? Or do I have to make something myself? Ty!
Re: How to check if a car is driven? -
huyguy - 06.04.2010
If there is no function listed
here, you will have to script your own function.
Just enumerate all players and check whether they are in the vehicle.
Код:
//This function checks whether a vehicle has a driver or not.
forward IsVehicleDriven(vehicleid);
public IsVehicleDriven(vehicleid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i, vehicleid) && !GetPlayerVehicleSeat(i))
{
return 1;
}
}
return 0;
}