SA-MP Forums Archive
Issue with foreach. - 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: Issue with foreach. (/showthread.php?tid=342119)



Issue with foreach. - ReneG - 12.05.2012

I'm working on a dynamic door script, and I want to use foreach for looping.

I add this as a global var.
pawn Код:
new Iterator:Door<MAX_DOORS>;
Later on in my code I have.
pawn Код:
foreach(Door, i)
{
    format(string, sizeof(string), DOOR_PATH, i);
    if(fexist(string))
    {
        INI_ParseFile(DoorPath(i), "LoadDoor_%s", .bExtra = true, .extra = i);
        DoorCount++;
    }
    else
    {
        print("------------------------------");
        printf("SERVER: Loaded %d Dynamic Doors",DoorCount);
        print("------------------------------");
        return 1;
    }
}
The compiler is saying that "Door@YSI_Cg" is never used when I'm clearly using the loop. Also, none of the code inside the loop is being called at all. What am I doing wrong? Help would be greatly appreciated.