Respawn all unoccupied vehicles
#1

Hey guys, i've been trying to create a few admin commands to learn understanding pawn better,
but i keep running into issues, now i have another one hehehe i wanted to create 2 commands,
One that reloads all the vehicles in the game, and one that reloads all the unoccupied vehicles in the game, however how will i do this, can i create a loop that searches all the vehicle id's and respawns them, and a loop that checks if there occupied or not?

I came up with the following code to respawn all unoccupied vehicles however its giving me an error
Код:
CMD:respawnalluv(playerid,params[])
{
    if(pData[playerid][Admin] < 5) return SendClientMessage(playerid, COLOR_RED, "[Error]:{ffffff} You are not authorized to use this command."); else
    {
		for(new i = 1; i < MAX_VEHICLES; i++) if(!IsVehicleOccupied(i)) SetVehicleToRespawn(i);
	}
	return 1;
}
the stock
Код:
stock IsVehicleOccupied(iVehicleID, iSeatID = 0) {
	foreach(Player, i) if(GetPlayerVehicleID(i) == iVehicleID && GetPlayerVehicleSeat(i)== iSeatID) return 1;
	return 0;
}
local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
At the line ;
foreach(Player, i) if(GetPlayerVehicleID(i) == iVehicleID && GetPlayerVehicleSeat(i)== iSeatID) return 1;
Reply


Messages In This Thread
Respawn all unoccupied vehicles - by yvoms - 25.07.2016, 22:09
Re: Respawn all unoccupied vehicles - by VVWVV - 25.07.2016, 23:15
Re: Respawn all unoccupied vehicles - by Abagail - 26.07.2016, 00:55
Re: Respawn all unoccupied vehicles - by Gammix - 26.07.2016, 03:11
Re: Respawn all unoccupied vehicles - by Threshold - 26.07.2016, 03:54

Forum Jump:


Users browsing this thread: 1 Guest(s)