SA-MP Forums Archive
Respawn all vehicles command - 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: Respawn all vehicles command (/showthread.php?tid=594273)



Respawn all vehicles command - xxxSpeedxxx - 15.11.2015

This cmd respawns all cars,but it also respawns atached trailers when truckers are doing a job.How can i set it to Check if trailer is atached then respawn it if its conected?

Code:
COMMAND:opetvozila(playerid,params[])
{
	if (APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PlayerLevel] > 6)
	{
		for (new j = 1; j <= MAX_VEHICLES; j++)
		{
			if (GetVehicleModel(j) == 0) continue;
			new moneys1 = 0;
			for (new i = 0; i < MAX_PLAYERS; i++)
			{
				if (!IsPlayerInVehicle(i, j)) continue;
				moneys1 ++;
				break;
			}
			if (moneys1 == 0)
			{
				SetVehicleToRespawn(j);
			}
		}
		SendClientMessageToAll(0xFFFFFF, "Vozila su opet ucitana. Mozete ih naci na mjestu gdje su parkirani.");
	}
	else return 0;
	return 1;
}



Re: Respawn all vehicles command - Jefff - 15.11.2015

http://forum.sa-mp.com/showpost.php?...55&postcount=6

Just change CAR_AMOUNT to MAX_VEHICLES or GetVehiclePoolSize()