24.08.2017, 16:46
Well.. I was following a tutorial about creating a registration system, but seems like there's a bug or something in my code and I have no idea what is causing it. If somebody chooses the 2nd option which is named "Quit" or presses the esc button on their keyboard, they skip the login menu and get directly to the class selection. I've tried every single thing which I came up with, but there's no effect. Any kind of help is appreciated.
PHP код:
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if (response)
{
if(!strlen(inputtext)) {
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""WHITE"Registering...",""RED"You have entered an invalid password.\n"WHITE"Type your password below to register a new account.","Register","Quit");
}
if(INI_Open(getINI(playerid))) {
INI_WriteString("Password",inputtext);
INI_WriteInt("Score",1);
INI_WriteInt("Cash",5000);
INI_WriteInt("Admin",0);
INI_WriteInt("Muted",0);
INI_Save();
INI_Close();
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
}
}
}
case DIALOG_LOGIN:
{
if (!response) return Kick(playerid);
if( response )
{
if(!strlen(inputtext)) {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an invalid password.\n"WHITE"Type your password below to login.","Login","Quit");
}
if(INI_Open(getINI(playerid))) {
INI_ReadString(PlayerInfo[playerid][pPass],"Password",20);
if(strcmp(inputtext,PlayerInfo[playerid][pPass],false)) {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an incorrect password.\n"WHITE"Type your password below to login.","Login","Quit");
}
SetPlayerScore( playerid, INI_ReadInt("Score" ) );
ResetPlayerMoney( playerid );
GivePlayerMoney( playerid, INI_ReadInt( "Cash" ) );
PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
PlayerInfo[playerid][pHitman] = INI_ReadInt("Hitman");
PlayerInfo[playerid][pPhone] = INI_ReadInt("Phone");
PlayerInfo[playerid][pHealme] = INI_ReadInt("Healme");
PlayerInfo[playerid][pMuted] = INI_ReadInt("Muted");
PlayerInfo[playerid][pRestricted] = INI_ReadInt("Restricted");
INI_Close();
}
}
}
}