Whats the wrong in this?!?!
#1

Hello!
I was trying to make respawn all vehicles command!
But fail!
Whats wrong?

CMD:rav(playerid, params[])
{
if(pInfo[playerid][Admin] >= 3)
{
for(new i = 1; i < MAX_VEHICLES; i++)
if(!IsVehicleOccupied(i))
{
GameTextForAll("An Adminstrator had respawned all unused vehicles!", 5000, 0);
SetVehicleToRespawn(i);
}
}
else
SendClientMessage(playerid, COLOR_RED, "You must be admin to access this command!");
}

stock IsVehicleOccupied(iVehicleID, iSeatID = 0)
{
[6968]foreach(Player, i);
[6969]if(GetPlayerVehicleID(i) == iVehicleID && GetPlayerVehicleSeat(i)== iSeatID) return 1;
return 0;
}




Errors:
C:\Users\----\Desktop\Sa-Mp Server\filterscripts\ssss.pwn(696 : error 017: undefined symbol "foreach"
C:\Users\----\Desktop\Sa-Mp Server\filterscripts\ssss.pwn(6969) : error 017: undefined symbol "i"
Reply
#2

You must #include foreach here's the DL link: https://sampforum.blast.hk/showthread.php?tid=570868

Also, use this for maximum optimization:

pawn Код:
new HighestVehicleID = GetVehiclePoolSize();
for(new i=0; i <= HighestVehicleID; i++)
{
    if(IsValidVehicle(i) && !IsVehicleOccupied(i))
    {
         SetVehicleToRespawn(i);
    }
}
Reply
#3

Thanks a lot !
Can i PM you?
Reply
#4

Quote:
Originally Posted by ironmen
Посмотреть сообщение
Thanks a lot !
Can i PM you?
You don't specifically need to PM me, you can still request help here, so others who see your post can also help, if I am not available for it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)