Faction vehicles respawning
#1

Hi-
I'm looking for some way to block out faction vehicles from my /destroyall command. That command will destroy EVERY unused vehicle from my server, But I can't figure out any way to 'mark' or avoid faction cars from being destroyed with them..

This is the function I use for the command. /destroyall
Код:
forward DestroyAll();

public DestroyAll()
{
	for( new i; i < MAX_VEHICLES; i++ )
	{
	    if( !bVehicleOccupied[ i ] )
		DestroyVehicle( i );
 			
	}
	SendClientMessageToAll(ADMIN, "[SERVER] {FFFFFF}ALL unused vehicles removed.");
	return 1;
}
The vehicles, (faction vehicles) are defined as variables. like so:
Код:
new SDCars[ 13 ];
Any suggestions?
Reply
#2

pawn Код:
bool:IsFactionVehicle(vehicleid)
{

    for(new d=0; d != sizeof(SDCars); d++)
        if(vehicleid == SDCars[d])
            return true;

    return false;
}
and

pawn Код:
if( !bVehicleOccupied[ i ] && !IsFactionVehicle( i ) )
Reply
#3

Worked like a charm.

+1

Thank you sooo much.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)