SA-MP Forums Archive
Help - respawn all cars. - 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 - respawn all cars. (/showthread.php?tid=543098)



Help - respawn all cars. - Fjclip99 - 24.10.2014

Can anyone make me a command /rac to respawn all unused vehicles...
This is the system i have now:

Код:
YCMD:rac(playerid, params[],help)
{
	    	        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);
				}
			}
}
This system respawn all vehicles that are not used, but now i want something else.
I want if the vehicleid == pInfo[MAX_PLAYERS][AdminCar] - to destroy that vehicle and respawn all the others...
Now i hope that someone understands me...


Re: Help - respawn all cars. - zaibaslr2 - 24.10.2014

Quote:
Originally Posted by Fjclip99
Посмотреть сообщение
Can anyone make me a command /rac to respawn all unused vehicles...
This is the system i have now:

Код:
YCMD:rac(playerid, params[],help)
{
	    	        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);
				}
			}
}
This system respawn all vehicles that are not used, but now i want something else.
I want if the vehicleid == pInfo[MAX_PLAYERS][AdminCar] - to destroy that vehicle and respawn all the others...
Now i hope that someone understands me...
Do you mean this?

Код:
YCMD:rac(playerid, params[],help)
{
	    	        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++)
			{
                                for(new a=0; a<MAX_PLAYERS; a++)
                                {
                                     if(pInfo[a][AdminCar] == i) DestroyVehicle(i);
                                }
				if(!vehicleused[i])
				{
					SetVehicleToRespawn(i);
				}
			}
}