SA-MP Forums Archive
Unused cars / rep +1 - 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: Unused cars / rep +1 (/showthread.php?tid=308140)



Unused cars / rep +1 - arcade2705 - 02.01.2012

How do I delete all of the unused vehicles on a RP server? I'll give a +1 reputation.


Re: Unused cars / rep +1 - Syntax - 02.01.2012

You go through the vehicles configuration file and take it from there...


Re: Unused cars / rep +1 - arcade2705 - 02.01.2012

Added +1 reputation.


Re: Unused cars / rep +1 - Leo_Johnson - 02.01.2012

You mean ro respawn all unused cars?

Code:
if(strcmp(cmd, "/respawncars", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        new vehcount = 0;
	        for(new i = 0; i < sizeof(Cars); i++)
			{
				if(CreatedCars[i] != INVALID_VEHICLE_ID)
				{
				    vehcount++;
				    gDestroyVehicles[Cars[i]] = 1;
					SetVehiclesToRespawn(Cars[i]);
					Cars[i] = INVALID_VEHICLE_ID;
				}
			}
	        return 1;
		}
		return 1;
	}



Re: Unused cars / rep +1 - Leo_Johnson - 02.01.2012

Code:
CMD:rac(playerid, params[])
{
	if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
	new bool:vehicleused[MAX_VEHICLES];
	for(new i=0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
		{
			vehicleused[GetPlayerVehicleID(i)] = true;
		}
	}
	for(new i=1; i < MAX_VEHICLES; i++)
	{
		if(!vehicleused[i])
		{
			SetVehicleToRespawn(i);
		}
	}
	new msg[128];
	format(msg, sizeof(msg), "Admin %s (%d) has respawned all unused vehicles", PlayerName(playerid), playerid);
	SendClientMessageToAll(COLOR_YELLOW, msg);
	return 1;
}