SA-MP Forums Archive
Loop death end. - 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: Loop death end. (/showthread.php?tid=387437)



Loop death end. - Roel - 24.10.2012

Hello.

And again I get stuck at something wierds...


Here is my code:
str = the player name.
pawn Код:
new bool:valid,tempchar[2];
    for(new n = 0; n < strlen(str); n++)
    {
        valid = false;
        for(new c = 0; c < sizeof(ARY_VALID_MAIN_CHARACTERS); c++)
        {
            strmid(tempchar, str, n, n+1);
            if(strcmp(tempchar,ARY_VALID_MAIN_CHARACTERS[c], true ) == 0)
            {
                valid = true;
            }
        }
        if(valid == false)
        {
            return true;
        }
    }
Problem,

When the player name is like RoelRoel it works fine.
But if it is, RoelRoelRoelRoel, it just keep looping and won't give me a return...
I can't find the reason, maybe somebody can?


Re: Loop death end. - ViniBorn - 24.10.2012

ARY_VALID_MAIN_CHARACTERS contains valid or invalid caracters ?


Re: Loop death end. - Roel - 24.10.2012

Thanks for you reply, but nothing was wrong with this, my fault it was a query after it that didn't had the correct string size.


Re: Loop death end. - ViniBorn - 24.10.2012

pawn Код:
if(!valid) return true;
else return false;