SA-MP Forums Archive
Why is the error message to working? - 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: Why is the error message to working? (/showthread.php?tid=365497)



Why is the error message to working? - Sniper Kitty - 03.08.2012

pawn Код:
case DIALOG_Password: {
            if(! Response) {
                Kick(PlayerID);
                return true;
            }
           
            if(3 > strlen(Input) > 100) {
                if(3 > strlen(Input)) {
                    SendMessageToPlayer(PlayerID, ""Embed_White"Invalid password, passwords must contain more than 3 characters.");
                    DialogShowForPlayer(PlayerID, "Password", "Invalid password, passwords must contain more than 3 characters.");
                } else {
                    SendMessageToPlayer(PlayerID, ""Embed_White"Invalid password, passwords must contain less than 100 characters.");
                    DialogShowForPlayer(PlayerID, "Password", "Invalid password, passwords must contain less than 100 characters.");
                }
            } else {
                SetPlayerPassword(PlayerID, Input);
                SendMessageToPlayer(PlayerID, ""Embed_White"You've successfully registered!");
                SetPlayerRegistration(PlayerID, (GetPlayerRegistration(PlayerID) + 1));
                PutPlayerInRegistration(PlayerID);
            }
            return true;
        }
Custom Callback:
PlayerRespondedToDialog(PlayerID, DialogID, Response = false, Input = "");

Custom Functions:
SendMessageToPlayer(PlayerID, Message[], {Float,_}:...);
DialogShowForPlayer(PlayerID, Name[], Error[] = "");
SetPlayerPassword(PlayerID, Password[]);
SetPlayerRegistration(PlayerID, RegistrationID);
GetPlayerRegistration(PlayerID);
PutPlayerInRegistration(PlayerID);

Okay so you don't say I have my function names and/or variables wrong, I've provided a list of the functions you see in the code above.

The problem:
Quote:

if(3 > strlen(Input) > 100) {

Doesn't seem to be working. When I go in-game and leave the field blank, it says I successfully registered... Which is bad.
Can anyone tell what I'm doing wrong?


Re: Why is the error message to working? - [MM]RoXoR[FS] - 03.08.2012

I tried
Код:
if(3 > strlen(Input) > 100)
It didnt work.

Use
pawn Код:
if(3 > strlen(Input) ||  strlen(Input) > 100)



Re: Why is the error message to working? - Sniper Kitty - 03.08.2012

Hm

3 < strlen(Input) < 100

Usually works, I wonder why it didn't this time.
Thanks, you helped me solve it.


Re: Why is the error message to working? - BrandyPenguin - 03.08.2012

Quote:
Originally Posted by Sniper Kitty
Посмотреть сообщение
Hm

3 < strlen(Input) < 100

Usually works, I wonder why it didn't this time.
Thanks, you helped me solve it.
In your first post you had:
"if(3 > strlen(Input) > 100) { "
what means that if you enter over 100 character it only work.
What you want even to achieve with this?