Login trouble.
#1

I am having a pretty high priority bug in my gamemode.

pawn Код:
case DIALOG_REGISTER:
            {
                if(!response) Kick(playerid); // Should kick here
                if(response)
                {
                   if(!strlen(inputtext))
                    {
                        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{00FFFF}Register", "{00FFFF}Please enter your password to register.\n{FF0000}You can't leave this empty.", "OK", "Cancel");
                        return 1;
                    }
                    new INI:file = INI_Open(Path(playerid));
                    INI_WriteString(file,"Password",inputtext);
                    INI_SetTag(file, "[Player Stats]");
                    INI_WriteInt(file,"Score",0);
                    INI_WriteInt(file,"Deaths",0);
                    INI_WriteInt(file,"Admin",0);
                    INI_WriteInt(file,"Gmute", 0);
                    INI_WriteInt(file,"Vip", 0);
                    INI_WriteInt(file,"Hunger", 100);
                    INI_WriteInt(file,"Thirst", 100);
                    INI_WriteInt(file,"Health", 100);
                    INI_WriteInt(file,"Backpack", 8);
                    INI_Close(file);
                    TextDrawHideForPlayer(playerid, Loading);
                    return 1;
                }
            }
pawn Код:
case DIALOG_LOGIN:
            {
                if(!response) Kick(playerid);
                if(response)
                {
                    if(!strcmp(inputtext, pStats[playerid][password], false))
                    {
                        INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
                        SendClientMessage(playerid,COLOR_WHITE,"You have successfully logged in.");
                        TextDrawHideForPlayer(playerid, Loading);
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "{00FFFF}Please enter your password to login.\n{FF0000}Incorrect password.", "OK", "Cancel");
                        TextDrawHideForPlayer(playerid, Loading);
                        return 1;
                    }
I already tried if(!response) return Kick(playerid); but that won't work too.

Video:
http://www.youtube.com/watch?v=OqhBH...ature=********* (POSSIBLE THAT IT'S STILL UPLOADING)
Reply
#2

What exactly is the problem?
Reply
#3

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
What exactly is the problem?
Video is there, should explain it. When pressing cancel/esc you still continue to the class selection.
Reply
#4

This should work
pawn Код:
case DIALOG_REGISTER:
            {
                if(response)
                {
                   if(!strlen(inputtext))
                    {
                        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{00FFFF}Register", "{00FFFF}Please enter your password to register.\n{FF0000}You can't leave this empty.", "OK", "Cancel");
                        return 1;
                    }
                    new INI:file = INI_Open(Path(playerid));
                    INI_WriteString(file,"Password",inputtext);
                    INI_SetTag(file, "[Player Stats]");
                    INI_WriteInt(file,"Score",0);
                    INI_WriteInt(file,"Deaths",0);
                    INI_WriteInt(file,"Admin",0);
                    INI_WriteInt(file,"Gmute", 0);
                    INI_WriteInt(file,"Vip", 0);
                    INI_WriteInt(file,"Hunger", 100);
                    INI_WriteInt(file,"Thirst", 100);
                    INI_WriteInt(file,"Health", 100);
                    INI_WriteInt(file,"Backpack", 8);
                    INI_Close(file);
                    TextDrawHideForPlayer(playerid, Loading);
                    return 1;
                }
                else Kick(playerid);
            }
            case DIALOG_LOGIN:
            {
                if(response)
                {
                    if(!strcmp(inputtext, pStats[playerid][password], false))
                    {
                        INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
                        SendClientMessage(playerid,COLOR_WHITE,"You have successfully logged in.");
                        TextDrawHideForPlayer(playerid, Loading);
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "{00FFFF}Please enter your password to login.\n{FF0000}Incorrect password.", "OK", "Cancel");
                        TextDrawHideForPlayer(playerid, Loading);
                        return 1;
                    }
                }
                else Kick(playerid);
Reply
#5

Quote:
Originally Posted by Wizza
Посмотреть сообщение
This should work
pawn Код:
case DIALOG_REGISTER:
            {
                if(response)
                {
                   if(!strlen(inputtext))
                    {
                        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{00FFFF}Register", "{00FFFF}Please enter your password to register.\n{FF0000}You can't leave this empty.", "OK", "Cancel");
                        return 1;
                    }
                    new INI:file = INI_Open(Path(playerid));
                    INI_WriteString(file,"Password",inputtext);
                    INI_SetTag(file, "[Player Stats]");
                    INI_WriteInt(file,"Score",0);
                    INI_WriteInt(file,"Deaths",0);
                    INI_WriteInt(file,"Admin",0);
                    INI_WriteInt(file,"Gmute", 0);
                    INI_WriteInt(file,"Vip", 0);
                    INI_WriteInt(file,"Hunger", 100);
                    INI_WriteInt(file,"Thirst", 100);
                    INI_WriteInt(file,"Health", 100);
                    INI_WriteInt(file,"Backpack", 8);
                    INI_Close(file);
                    TextDrawHideForPlayer(playerid, Loading);
                    return 1;
                }
                else Kick(playerid);
            }
            case DIALOG_LOGIN:
            {
                if(response)
                {
                    if(!strcmp(inputtext, pStats[playerid][password], false))
                    {
                        INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
                        SendClientMessage(playerid,COLOR_WHITE,"You have successfully logged in.");
                        TextDrawHideForPlayer(playerid, Loading);
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "{00FFFF}Please enter your password to login.\n{FF0000}Incorrect password.", "OK", "Cancel");
                        TextDrawHideForPlayer(playerid, Loading);
                        return 1;
                    }
                }
                else Kick(playerid);
Thank you. c:
Reply
#6

Your first code would've worked, I believe. You missed one word actually that would help your code work.
Instead of
pawn Код:
if(!response) Kick(playerid);
You should've had
pawn Код:
if(!response) return Kick(playerid);
Reply
#7

Quote:
Originally Posted by EliteApple
Посмотреть сообщение
Your first code would've worked, I believe. You missed one word actually that would help your code work.
Instead of
pawn Код:
if(!response) Kick(playerid);
You should've had
pawn Код:
if(!response) return Kick(playerid);
I think you're absolutely correct.
Reply
#8

Quote:
Originally Posted by PrivatioBoni
Посмотреть сообщение
I think you're absolutely correct.
He isn't as I tried it with Return too. the else statement didn't work too.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)