Dialog help
#1

Hey guys i need help with dialog if i like make another thing in dialog as i have Reg/Login ysstem in dialog but after i make another thing in dialog its like i close it then gives me that i insterted incorrect Password... if you reenter pw you can keep playin but if you dont you get kicked pls help..

also im not sure but the score isnt saving as i made everything for the score thingy Thanks for your time and i wish i get it fixed

Код:
switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
            	if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_LIGHTBLUE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_LIGHTBLUE"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,"Score",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_LIGHTBLUE"Registartion Completed",""COL_GREEN"Great! You Have Registerd, after you quit your stats will be saved\nGood Luck and Have fun staying in here\nif you dont relog your stats will not be saved!","Ok","");
                        }
        }

        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_LIGHTBLUE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_LIGHTBLUE"Login to your Account",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
	return 1;
}
Reply
#2

Actually... It is going to save the score OnPlayerDisconnect (as long as I know), but You need a function which is going to set/load player's latest score, just like the money:

pawn Код:
// Cash
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);

pawn Код:
// Score
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
// This is going to set/load player's latest score, add this under the "GivePlayerMoney" function.

The reason why it's kicking players when they refuse to register/login is; Kick(playerid); function. (When player refuses to register/login).

pawn Код:
if ( !response ) return Kick ( playerid );
// You can remove it and also You can change it.
Also the reason why it's telling You " You have entered an invalid password " is obvious, You've entered an invalid one or maybe while You were editing the script You've changed dialog ids and now it's wrong. Compare Your edited version and the original one, and You'll see.

Tell me if is something else wrong, I'll give my best to help You.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)