Undefined symbol foreach
#1

I get this error on my command!?
Код:
C:\Users\Namn\Desktop\-NLG-\gamemodes\zcmd_test.pwn(5223) : error 017: undefined symbol "foreach"
C:\Users\Namn\Desktop\-NLG-\gamemodes\zcmd_test.pwn(5223) : error 029: invalid expression, assumed zero
C:\Users\Namn\Desktop\-NLG-\gamemodes\zcmd_test.pwn(5223) : error 017: undefined symbol "i"
C:\Users\Namn\Desktop\-NLG-\gamemodes\zcmd_test.pwn(5223) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
The error line is the one with foreach..
pawn Код:
CMD:friskhouse(playerid, params[])
{
    new string2[128], string3[128], string4[128], string5[128];
    if(IsPlayerConnected(playerid))
    {
        if (IsACop(playerid) || IsAnFbi(playerid) || IsAnNg(playerid))
        {
            foreach (new i : Player)
            {
                new house = HouseEntered[playerid];
                new gunname1[24];
                GetWeaponName(HouseInfo[house][hWeapon1],gunname1, sizeof(gunname1));
                new gunname2[24];
                GetWeaponName(HouseInfo[house][hWeapon2],gunname2, sizeof(gunname2));
                new gunname3[24];
                GetWeaponName(HouseInfo[house][hWeapon3],gunname3, sizeof(gunname3));
                new gunname4[24];
                GetWeaponName(HouseInfo[house][hWeapon4],gunname4, sizeof(gunname4));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    format(string, sizeof(string),"-HOUSE STORAGE- Suspected have %d Drugs and %d Materials.",HouseInfo[house][hDrugs],HouseInfo[house][hMaterials]);
                    SCM(playerid, COLOR_GREY,string);
                    format(string2, sizeof(string2),"-HOUSE STORAGE- Weapon 1 - %s Ammo: %d.",gunname1,HouseInfo[house][hAmmo1]);
                    SCM(playerid, COLOR_GREY,string2);
                    format(string3, sizeof(string3),"-HOUSE STORAGE- Weapon 2 - %s Ammo: %d.",gunname2,HouseInfo[house][hAmmo2]);
                    SCM(playerid, COLOR_GREY,string3);
                    format(string4, sizeof(string4),"-HOUSE STORAGE- Weapon 3 - %s Ammo: %d.",gunname3,HouseInfo[house][hAmmo3]);
                    SCM(playerid, COLOR_GREY,string4);
                    format(string5, sizeof(string5),"-HOUSE STORAGE- Weapon 4 - %s Ammo: %d.",gunname4,HouseInfo[house][hAmmo4]);
                    SCM(playerid, COLOR_GREY,string5);
                    new y, m, d;
                    new h,mi,s;
                    getdate(y,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /friskhouse",d,m,y,h,mi,s,sendername);
                    CommandLog(string);
                }
            }
        }
        else return SCM(playerid, COLOR_GREY, "You are not a Law member!");
    }
    else return SCM(playerid, COLOR_GREY,"You need to be connected to use this command");
}
And yes I do have it included on the top
Reply
#2

is foreach the loop??
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Reply
#3

umm not really sure but maybe its becuase of the space after foreach ()? Again, i might be wrong
Reply
#4

Quote:
Originally Posted by TheFlyer
Посмотреть сообщение
is foreach the loop??
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Yes
Quote:
Originally Posted by Domnic Toretto
Посмотреть сообщение
umm not really sure but maybe its becuase of the space after foreach ()? Again, i might be wrong
No, pawno dont read spaces etc. But I tried without the space anyway and same problem.
Reply
#5

Fixed it by doing
pawn Код:
foreach(Player,i)
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
That sounds like you have a really old version of the include then - I suggest you upgrade.
So it's supose to be
Код:
foreach(new i: Player)
?


EDIT: Updated and tried on first way. Worked, Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)