Empty vehicle ? - 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: Empty vehicle ? (
/showthread.php?tid=280096)
Empty vehicle ? -
Urefeu - 30.08.2011
Hello.
I just want to know if there is a predefined function that lets you know if a vehicle is empty.
This is a function to respawn vehicles empty on a shelf, and it would be heavy to loop for each player in a loop for each vehicle ...
Thank you!
Re: Empty vehicle ? -
JaTochNietDan - 30.08.2011
https://sampwiki.blast.hk/wiki/Category:...tions#Vehicles
You can see a list of standard vehicle functions here, the particular one you are looking for is not included in the SA-MP API.
Re: Empty vehicle ? -
Kayaque - 30.08.2011
I believe this is exactly what you're looking for.
pawn Код:
stock IsVehicleEmpty( vehicleid )
{
for ( new playerid = 0; playerid < MAX_PLAYERS; playerid++ )
{
if ( !IsPlayerConnected( playerid ) )
continue;
if ( GetPlayerVehicleID( playerid ) == vehicleid )
return false;
}
return true;
}
A rep+ would be appriciated.
Re : Empty vehicle ? -
Urefeu - 30.08.2011
I've watched the official page.
The function does not interest me because it is precisely the overhead I mentioned ... There will be more than 30,000 entries in the loop, but ...
Thank !