dialog bugs
#1

I'm making a AdminProtection system, they need to enter a code first before they can use admin commands.
But when I enter my code, it goes to the "Wrong Code" not the Accept Code.
My code is 12345 and all codes have to be numbers so.

pawn Код:
case DIALOG_ADMINCODE:
            {
                if(isnull(inputtext))
                    return SPD(playerid, DIALOG_ADMINCODE2);
               
                new count = 0;
                if(count == 2)
                {
                    new query[500], string[128];
                    format(query, sizeof(query), "INSERT INTO `bans` (`Username`, `AdminName`, `Reason`, `Ipaddress`, `BannedTS`, `UnbannedTS`) VALUES('%s', '%s', '%s', '%s', %d, %d)", GetName(playerid), "Server", "2 times Wrong Admin Code.", PlayerIP[playerid], gettime()+7200, -1);
                    mysql_function_query(connectionHandle, query, false, "DefaultCallback", "");

                    format(string, sizeof(string), "{FFCC00}.:: {FFFFFF}Banned [%s] {FFCC00}::.", date(gettime()+7200, 1));
                    SendClientMessage(playerid, WHITE, string);
                    format(string, sizeof(string), "| Reason for ban: 2 times Wrong Admin Code.");
                    SendClientMessage(playerid, SERVERCOLOR, string);
                    format(string, sizeof(string), "| Banned by: Server");
                    SendClientMessage(playerid, SERVERCOLOR, string);
                    format(string, sizeof(string), "| Type of Ban: Permanent");
                    SendClientMessage(playerid, SERVERCOLOR, string);
                    format(string, sizeof(string), "| If you want to contradict your ban, please make a screenshot (F8) of this screen");
                    SendClientMessage(playerid, SERVERCOLOR, string);
                    format(string, sizeof(string), "| And post a Unban-Appeal on our forums with this screenshot.");
                    SendClientMessage(playerid, SERVERCOLOR, string);
                    KickWithMessage(playerid, SPECIALORANGE, "**************************************************");
                    TextDrawShowForPlayer(playerid, Text:AdminCodeFailed);
                   
                }
                else if(!strcmp(inputtext, Player[playerid][AdminCode], false))
                {
                    AdminLoggedIn[playerid] = 1;
                    TextDrawShowForPlayer(playerid, Text:AdminCodeSuccess);
                    SetTimerEx("RemoveAdminCodeSuccess", 3500, false, "d", playerid);
                }
                else
                {
                    count++;
                    SPD(playerid, DIALOG_ADMINCODE3);
                }
            }
pawn Код:
command(enteradmincode, playerid, params[])
{
    if(Player[playerid][Adminlevel] >= 1)
    {
        SPD(playerid, DIALOG_ADMINCODE);
    }
    else
    {
        TextDrawShowForPlayer(playerid, Text:CantCommand);
        SetTimerEx("RemoveCantCommand", 3500, false, "d", playerid);
    }
    return 1;
}
pawn Код:
stock SPD(playerid, dialogid) // a shortened custom function for ShowPlayerDialog; you don't have to handle all of the ShowPlayerDialog lines, just know the playerid and the dialogid you want to show
{
    new string[600];
    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            format(string, sizeof(string), "{FFFFFF}Welcome to {0086EF}<changeme>\n\n{FFFFFF}Username:  {0086EF}%s\n\n{FFFFFF}Please enter your password below", RPName(playerid));
            ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""#COL_EMB_WHITE"Account Registration", string, "Register", "Cancel");
        }
        case DIALOG_AUTHENTICATION:
        {
            format(string, sizeof(string), "{FFFFFF}Welcome back to {0086EF}<changeme>\n\n{FFFFFF}Username:  {0086EF}%s\n\n{FFFFFF}Please enter your password below", RPName(playerid));
            ShowPlayerDialog(playerid, DIALOG_AUTHENTICATION, DIALOG_STYLE_PASSWORD, ""#COL_EMB_WHITE"Account Authentication", string, "Login", "Cancel");
        }
        case DIALOG_ADMINCODE:
        {
            format(string, sizeof(string), "{FFFFFF}Please enter your admin code below.");
            ShowPlayerDialog(playerid, DIALOG_ADMINCODE, DIALOG_STYLE_PASSWORD, ""#COL_EMB_WHITE"Admin Identification", string, "Login", "Cancel");
        }
        case DIALOG_ADMINCODE2:
        {
            format(string, sizeof(string), "{FFFFFF}Please enter your admin code below.\n\n{FF0000}You need to enter a code.");
            ShowPlayerDialog(playerid, DIALOG_ADMINCODE, DIALOG_STYLE_PASSWORD, ""#COL_EMB_WHITE"Admin Identification", string, "Login", "Cancel");
        }
        case DIALOG_ADMINCODE3:
        {
            format(string, sizeof(string), "{FFFFFF}Please enter your admin code below.\n\n{FF0000}Wrong Code.");
            ShowPlayerDialog(playerid, DIALOG_ADMINCODE, DIALOG_STYLE_PASSWORD, ""#COL_EMB_WHITE"Admin Identification", string, "Login", "Cancel");
        }
    }
    return -1;
}
Reply


Messages In This Thread
dialog bugs - by Stefand - 08.05.2013, 19:03
Re: dialog bugs - by Scenario - 08.05.2013, 20:03
Re: dialog bugs - by Stefand - 08.05.2013, 20:45
Re: dialog bugs - by IceCube! - 08.05.2013, 20:48
Re: dialog bugs - by Stefand - 08.05.2013, 21:25
Re: dialog bugs - by IceCube! - 08.05.2013, 21:28
Re: dialog bugs - by Stefand - 09.05.2013, 06:40
Re: dialog bugs - by IceCube! - 09.05.2013, 07:11
Re: dialog bugs - by Stefand - 09.05.2013, 08:14

Forum Jump:


Users browsing this thread: 1 Guest(s)