SA-MP Forums Archive
Register error: - 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: Register error: (/showthread.php?tid=259023)



Register error: - Face9000 - 02.06.2011

pawn Код:
if(!(3 <= strlen(inputtext) <= 20))
                        return SendClientMessage(playerid, RED, "The password you supplied is either too short or too long.");
                        {
                            ShowPlayerDialog(playerid,30,DIALOG_STYLE_MSGBOX,"Error!","Please Enter A Password!","Ok","Quit");
                            return 1;
                        }
warning 225: unreachable code

What's wrong?


Re: Register error: - shitbird - 02.06.2011

You're returning values straight after the (if) statement.
Doing this:
pawn Код:
if(!(3 <= strlen(inputtext) <= 20)) return SendClientMessage(playerid, RED, "The password you supplied is either too short or too long.");
Will return the Client Message, and nothing else. You're stopping the function at that point. That means anything that's written later on will be ignored.

The correct method:
pawn Код:
if(!(3 <= strlen(inputtext) <= 20))
{
     // code...
     return whatever;

}



Re: Register error: - Face9000 - 02.06.2011

Ops,my fault ..fixed,thanks.