SA-MP Forums Archive
2 IF's and only 1 else.. - 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: 2 IF's and only 1 else.. (/showthread.php?tid=336135)



2 IF's and only 1 else.. - Dan. - 21.04.2012

I currently have this login dialog, as an example:

if1(password not correct)
{
...
}
if2(box empty)
{
...
}
else
{
login
}

This wont work, I want to assign two "IF's" to one "ELSE". Currently the else wont work on IF2, when it wont match the criterias it still logs me in.


Re: 2 IF's and only 1 else.. - Dan. - 21.04.2012

Yes I tried else if, but it wont work. Whatever I enter when using "else if", it spawns me but wont load my user info. (wont send me the clientmessage in this case)


pawn Код:
if(strcmp(inputtext, parool, false) != 0)
                {
                    SendClientMessage(playerid, C_BLUE, "SERVER: Wrong password!");
                    ShowPlayerDialog(playerid, 3, DIALOG_STYLE_PASSWORD, "..:::Logging in:::..","{FF0000}Wrong password!", "Login", "Leave");
                }
                else if(!strlen(inputtext))
                {
                    SendClientMessage(playerid, C_BRED, "You entered an empty password!");
                    ShowPlayerDialog(playerid, 3, DIALOG_STYLE_PASSWORD, "..:::Logging in:::..","{FF0000}You entered an empty password!", "Login", "Leave");
                }
                else
                {
                    SendClientMessage(playerid, C_BLUE, "SERVER: You are logged in!");
                }



Re: 2 IF's and only 1 else.. - Jonny5 - 21.04.2012

........ nvm


Re: 2 IF's and only 1 else.. - Cypress - 21.04.2012

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
its elseif not else if
What?

Quote:
Originally Posted by Dan.
Посмотреть сообщение
pawn Код:
if(strcmp(inputtext, parool, false) != 0)
                {
                    SendClientMessage(playerid, C_BLUE, "SERVER: Wrong password!");
                    ShowPlayerDialog(playerid, 3, DIALOG_STYLE_PASSWORD, "..:::Logging in:::..","{FF0000}Wrong password!", "Login", "Leave");
                }
                else if(!strlen(inputtext))
                {
                    SendClientMessage(playerid, C_BRED, "You entered an empty password!");
                    ShowPlayerDialog(playerid, 3, DIALOG_STYLE_PASSWORD, "..:::Logging in:::..","{FF0000}You entered an empty password!", "Login", "Leave");
                }
                else
                {
                    SendClientMessage(playerid, C_BLUE, "SERVER: You are logged in!");
                }
I don't see any function that loads player data in here.