SA-MP Forums Archive
Faction vehicles respawning - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Faction vehicles respawning (/showthread.php?tid=461367)



Faction vehicles respawning - Gecko75 - 01.09.2013

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?


Re: Faction vehicles respawning - Jefff - 01.09.2013

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 ) )



Re: Faction vehicles respawning - Gecko75 - 01.09.2013

Worked like a charm.

+1

Thank you sooo much.