How do I check if vehicle has no driver? - 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 do I check if vehicle has no driver? (
/showthread.php?tid=413039)
How do I check if vehicle has no driver? -
hydravink - 03.02.2013
Ok so I made this system but something is missing so I don't bug it... How do I check if vehicle has no driver? It's very important and I don't know how...
Thanks.
Re: How do I check if vehicle has no driver? - T0pAz - 03.02.2013
Use this function.
pawn Код:
stock IsVehicleOccupied(vehicleid)
{
foreach(Player,i)
{
if(IsPlayerInAnyVehicle(i))
{
return (GetPlayerVehicleID(i)==vehicleid);
}
}
return 0;
}
Re: How do I check if vehicle has no driver? -
hydravink - 03.02.2013
I asked for no driver not the whole car unoccupied
Re: How do I check if vehicle has no driver? -
CrazyChoco - 03.02.2013
GetPassengerSeat?
Re: How do I check if vehicle has no driver? -
hydravink - 03.02.2013
Does that even exist?
Please tell a valid function or at least tell me how to make that .
Re: How do I check if vehicle has no driver? -
[rG]Cold - 03.02.2013
https://sampwiki.blast.hk/wiki/GetPlayerVehicleSeat
Re: How do I check if vehicle has no driver? -
hydravink - 03.02.2013
I've made something but I need to test it with someone so PM me if you want to help me test it
Thanks Cold
Re: How do I check if vehicle has no driver? -
hydravink - 03.02.2013
Made this and it works. Hope you enjoy it whoever needs it but please give credits:
pawn Код:
stock IsntDriver(playerid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid) && GetPlayerVehicleSeat(i) != 0) return true;
}
return false;
}