10.10.2012, 12:20
Is there any way to see if a car is in use or not. I want to use it to periodically delete all cars from my server except the ones in use.
stock IsCarInUse(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (!IsPlayerConnected(i)) continue;
if (IsPlayerInVehicle(i, vehicleid)) return true;
}
return false;
}
stock RemoveAllEmptyVehicles()
{
for (new i = 0; i < MAX_VEHICLES; i++)
if (!IsCarInUse(i)) DestroyVehicle(i);
return true;
}