Dialog (Login / Register)
#1

Well, I need help on closing this dialog due to it's conflicting with the others...
pawn Код:
switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"VIP",0);
                INI_WriteInt(File,"Operator",0);
                INI_WriteInt(File,"Banned",0);
                INI_Close(File);
                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! You've registered! [STATS SAVED]","Ok","");
                pLogged[playerid] = 1;
                SetTimer("Spawn",1000,false);
                SetPlayerHealth(playerid, 0);
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success! Welcome Back!",""COL_LIGHTBLUE"You have successfully logged in!","Ok","");
                    pLogged[playerid] = 1;
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
I've also try'd putting return 1; at the end, Pawno.exe doesn't respond.
I will Rep whoever helps me.
Reply
#2

Bump
Reply
#3

Try this:
pawn Код:
switch( dialogid )
{
    case DIALOG_REGISTER:
    {
        if (!response) return Kick(playerid);
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
       
        new INI:File = INI_Open(UserPath(playerid));
        INI_SetTag(File,"data");
        INI_WriteInt(File,"Password",udb_hash(inputtext));
        INI_WriteInt(File,"Cash",0);
        INI_WriteInt(File,"Admin",0);
        INI_WriteInt(File,"Kills",0);
        INI_WriteInt(File,"Deaths",0);
        INI_WriteInt(File,"VIP",0);
        INI_WriteInt(File,"Operator",0);
        INI_WriteInt(File,"Banned",0);
        INI_Close(File);
        SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
        SpawnPlayer(playerid);
        ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! You've registered! [STATS SAVED]","Ok","");
        pLogged[playerid] = 1;
        SetTimer("Spawn",1000,false);
        SetPlayerHealth(playerid, 0);
       
        return 1;
    }

    case DIALOG_LOGIN:
    {
        if ( !response ) return Kick ( playerid );
        if(udb_hash(inputtext) != PlayerInfo[playerid][pPass]) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");

        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
        ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success! Welcome Back!",""COL_LIGHTBLUE"You have successfully logged in!","Ok","");
        pLogged[playerid] = 1;
       
        return 1;
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)