SA-MP Forums Archive
Cars Auto Reload - 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: Cars Auto Reload (/showthread.php?tid=660713)



Cars Auto Reload - PoniStar - 11.11.2018

hi guys , i just created a auto respawn system for the server cars , the question is , how should i do something to this system have no effect on Attached Trailers ? i mean if a player attached a trailer to his car the trailer not respawn


here is the code
Код:
	for(new i = 0; i <= MAX_VEHICLES; i++)
    {
        if(!IsValidVehicle(i))continue;
        if(!IsVehicleOccupied(i)) SetVehicleToRespawn(i);
    }



Re: Cars Auto Reload - v1k1nG - 11.11.2018

https://sampwiki.blast.hk/wiki/GetVehicleTrailer
https://sampwiki.blast.hk/wiki/IsTrailerAttachedToVehicle

Please search before posting help request!


Re: Cars Auto Reload - sampkinq - 11.11.2018

Код:
CarRespawn()
{
	new bool:UsedVehicle[MAX_VEHICLES];
	foreach(new i: Player)
	{
		if(IsPlayerInAnyVehicle(i))
		{
			UsedVehicle[GetPlayerVehicleID(i)] = true;
   	        if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(i)))
	        {
	            new dorseid = GetVehicleTrailer(GetPlayerVehicleID(i));
				UsedVehicle[dorseid] = true;
			}
		}
	}
	for(new i = 1, j = GetVehiclePoolSize(); i <= j; i++)
	{
		if(!UsedVehicle[i])
		{
			SetVehicleToRespawn(i);
		}
	}
	return 1;
}



Re: Cars Auto Reload - PoniStar - 11.11.2018

thanks worked