SA-MP Forums Archive
Problem with this loop - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with this loop (/showthread.php?tid=176123)



Problem with this loop - PinkFloydLover - 12.09.2010

Hey, I just made a function to return a gang id from a name:

pawn Код:
stock GetGangID(name[])
{

    for(new i; i < MAX_GANGS; i++)
    {
        if( name != GangInfo[i][GangName]) continue;

    }
    return name;
}
except I get the error:
Код:
error 033: array must be indexed (variable "name")
and when i use the function I get:
Код:
error 033: array must be indexed (variable "GetGangID")
Can somebody help me out?


Re: Problem with this loop - cessil - 12.09.2010

stock GetGangID(name)
{

for(new i; i < MAX_GANGS; i++)
{
use strcmp here
}
return name;
}