Open-GTO / foreach

foreach standalone include (non y_iterate version)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Iter_Remove is failing/not working on custom array of iterators

hiwyn opened this issue · comments

Iter_Remove is failing/not working on custom array of iterators

public OnPlayerDisconnect(playerid, reason) {
       new facid = fmember[playerid];
        if(facid > 0) {
            Iter_Remove(FactionMembers_List[facid], playerid);
        }
}

but the player id stills on the facid list

Show output with this:

public OnPlayerDisconnect(playerid, reason) {
    new facid = fmember[playerid];
    if (facid > 0) {
        foreach (new id : FactionMembers_List[facid]) {
            printf("BEFORE playerid = %d", id);
        }

        Iter_Remove(FactionMembers_List[facid], playerid);

        foreach (new id : FactionMembers_List[facid]) {
            printf("AFTER playerid = %d", id);
        }
    }
}