Unused cars / rep +1
#1

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

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

Added +1 reputation.
Reply
#4

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;
	}
Reply
#5

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)