Command to destroy all vehicles in the server
#2

Might be more efficient doing this, i'm not sure it works but i think it should. Should be more efficient than using nested loops.
pawn Код:
new bool:bVehicleOccupied[ MAX_VEHICLES ];

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if( newstate == PLAYER_STATE_DRIVER )
    {
        new
            vehicleid = GetPlayerVehicleID( playerid );
        bVehicleOccupied[ vehicleid ] = true;
        SetPVarInt( playerid, "currentvehicle", vehicleid );
    }
    else if( oldstate == PLAYER_STATE_DRIVER )
    {
        bVehicleOccupied[ GetPVarInt( playerid, "currentvehicle") ] = false;
        DeletePVar( playerid, "currentvehicle");
    }
    return 1;
}
In your command
pawn Код:
for( new i; i < MAX_VEHICLES; i++ )
{
    if( !bVehicleOccupied[ i ] )
        SetVehicleToRespawn( i );
}
Reply


Messages In This Thread
(Solved)Command to destroy all vehicles in the server - by linuxthefish - 02.04.2011, 08:45
Re: Command to destroy all vehicles in the server - by iggy1 - 02.04.2011, 09:08
Re: Command to destroy all vehicles in the server - by s0nic - 02.04.2011, 09:15
Re: Command to destroy all vehicles in the server - by linuxthefish - 02.04.2011, 09:26

Forum Jump:


Users browsing this thread: 1 Guest(s)