Command
#3

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
Loop from 0 to 23 (because if you loop to 22 the last car wont be deleted)
then use (IsVehicleOccuiped) function if no one is in the car then DestroyVehicle()

I'll post an example later since I'm on phone right now.
Here's an example:
pawn Код:
// Somewhere in your code (A command for example)
for (new i = 0; i < 23; i++)
{
    if (!IsVehicleOccupied(car[i])) DestroyVehicle(car[i]); // Use SetVehicleToRespawn(car[i]); if you want them to respawn instead of getting destroyed.
}
Here's the IsVehicleOccupied function.
pawn Код:
stock IsVehicleOccupied(vehid)
{
    for( new all = 0; all < MAX_PLAYERS; all++)
    {
        if (IsPlayerInVehicle(all, vehid))
        {
            return 1;
        }
    }
    return 0;
}
Should work.
Reply


Messages In This Thread
Command - by AdelS - 01.09.2014, 09:48
Re: Command - by DaniceMcHarley - 01.09.2014, 09:51
Re: Command - by Stinged - 01.09.2014, 10:14
Re: Command - by AdelS - 01.09.2014, 10:23

Forum Jump:


Users browsing this thread: 4 Guest(s)