SA-MP Forums Archive
Help with car deletion - 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: Help with car deletion (/showthread.php?tid=382011)



Help with car deletion - nickbouwhuis - 01.10.2012

Hello guys!

I have recently opened a server for A big *******r here in the Netherlands and we made a SAMP server for him. We allow vehicle spawning, but it's getting out of control, how can the vehicles be automatically deleted?

Any help would be appreciated!

-Nick


Re: Help with car deletion - Red_Dragon. - 01.10.2012

You mean DELETED or DE spawned ?!?!?


Re: Help with car deletion - nickbouwhuis - 01.10.2012

Quote:
Originally Posted by Red_Dragon.
Посмотреть сообщение
You mean DELETED or DE spawned ?!?!?
Yeah, I mean de spawn

Quote:
Originally Posted by SaYrOn
Посмотреть сообщение
Post a code, please.
What kind of code? You mean, from the Spawn Car filterscript?


Re: Help with car deletion - Red_Dragon. - 01.10.2012

Hmmm, You may put a command to re-spawn all unoccupied vehicles for example


Re: Help with car deletion - Dizzle - 01.10.2012

Код:
CMD:respawnallveh(playerid, params[])
{
	#pragma unused params
	if(IsPlayerAdmin(playerid))
	{
		SendClientMessage(playerid, -1, "All unoccupied vehicles were respawned!");
		}
		for(new cars=0; cars<MAX_VEHICLES; cars++)
		{
			if(!VehicleOccupied(cars))
			{
				SetVehicleToRespawn(cars);
			}
		}
		return 1;
	}
And at the bottom of your script -

Код:
stock IsVehicleOccupied(vehicleid)
{
    for (new i = 0; i < GetMaxPlayers(); i ++)
    {
        if (GetPlayerVehicleID(playerid) == vehicleid) return true;
    }
    return false;
}
Untested.


Re: Help with car deletion - nickbouwhuis - 02.10.2012

Quote:
Originally Posted by Dizzle
Посмотреть сообщение
Код:
CMD:respawnallveh(playerid, params[])
{
	#pragma unused params
	if(IsPlayerAdmin(playerid))
	{
		SendClientMessage(playerid, -1, "All unoccupied vehicles were respawned!");
		
		for(new cars=0; cars<MAX_VEHICLES; cars++)
		{
			if(!VehicleOccupied(cars))
			{
				SetVehicleToRespawn(cars);
			}
		}
		return 1;
	}
And at the bottom of your script -

Код:
stock IsVehicleOccupied(vehicleid)
{
    for (new i = 0; i < GetMaxPlayers(); i ++)
    {
        if (GetPlayerVehicleID(playerid) == vehicleid) return true;
    }
    return false;
}
Untested.
Thanks! I'll test it later today and i'll let you know if it worked!

__EDIT__
Nope does not work