07.06.2010, 10:29
Hello,
How can i detect if a certain vehicle is occupied or not?
How can i detect if a certain vehicle is occupied or not?
stock IsVehicleInUse(vehicleid)
{
new IsTrue=0;
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerVehicleID(i) == vehicleid) IsTrue=1;
}
}
}
return IsTrue;
}
Originally Posted by Joe Torran C
Hello,
How can i detect if a certain vehicle is occupied or not? |
stock IsVehicleInUse(vehicleid)
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerVehicleID(i) == vehicleid)
return true;
}
}
return false;
}