Dialog Bug #weird stuff
#1

I've been trying to make my own admin system on my test server and i got no problems with compiling but since im new to dialogs it might be that i don't understand the syntax.
But anyway heres the issue:

The issue starts after i've picked a option in /cpanel, when i pick a option it tells me to that i've input wrong password and it wants me to re-try logging in.
Now I admit I did not do the register login / system, i followed a tutorial, but i don't see a connection between the two dialogs.


pawn Код:
if(dialogid == DIALOG_REGISTER)
    {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COLOR_WHITE"Registering...",""COLOR_RED"You have entered an invalid password.\n"COLOR_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_Close(File);

            }
    }
pawn Код:
if(dialogid == 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,""COLOR_WHITE"Success!",""COLOR_GREEN"You have successfully logged in!","Ok","");
                }
                else if(udb_hash(inputtext) != PlayerInfo[playerid][pPass])
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COLOR_WHITE"Login",""COLOR_RED"You have entered an incorrect password.\n"COLOR_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
    }

And here is the Dialog stuff:

pawn Код:
if (strcmp("/cpanel", cmdtext, true, 10) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] > 1)
        {
            ShowPlayerDialog(playerid, DIALOG_CPANEL, DIALOG_STYLE_LIST, "<Admin - Commands>", "Weapons Menu\nVehicle Menu\nTeleport Menu\nKick Menu\nBan Menu", "Choose", "Exit");
        }
        return 1;
    }
pawn Код:
if(dialogid == DIALOG_CPANEL)
    {
        if(response)
        {
            switch(listitem)
            {
               case 0:  ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "<Admin Weapons Menu>", "Desert Eagle\nAK-47\nMINI-GUN", "Choose", "Exit");
               case 1:  ShowPlayerDialog(playerid, DIALOG_VEHICLE, DIALOG_STYLE_LIST, "<Admin Vehicle Menu>", "Car\nBike\nHeli\nPlane", "Choose", "Exit");
               case 2:  ShowPlayerDialog(playerid, DIALOG_TELEPORT, DIALOG_STYLE_LIST, "<Admin Teleport Menu>", "TELEPORT", "Choose", "Exit");
               case 3:  ShowPlayerDialog(playerid, DIALOG_KICK, DIALOG_STYLE_LIST, "<Admin Kick Menu>", "KICK", "Choose", "Exit");
               case 4:  ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_LIST, "<Admin Ban Menu>", "BAN", "Choose", "Exit");
            }
        }
        return 1;
    }

no pawno errors nor bugs, only in-game does it f**k up :/ halp pl0x?
Reply
#2

Do you have a different dialogid for each? For example, if both DIALOG_LOGIN and DIALOG_CPANEL are defined as 40 (it's just an example), then they will conflict each other.

PS: It's recommended not to use udb_hash but another way to hash the players' passwords such as Whirlpool which is very secure.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Do you have a different dialogid for each? For example, if both DIALOG_LOGIN and DIALOG_CPANEL are defined as 40 (it's just an example), then they will conflict each other.

PS: It's recommended not to use udb_hash but another way to hash the players' passwords such as Whirlpool which is very secure.
You sir solved my problem! + Rep for you! <3!


"For example, if both DIALOG_LOGIN and DIALOG_CPANEL are defined as 40"
I forgot to add dialog ids for them.

Thanks again!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)