admin password
#10

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1)
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Register your account", "Enter a password", "Register", "Quit");
        dini_Create(file);
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        gPlayerLogged[playerid] = 1;
    }
    if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login to your account", "Enter your password", "Login", "Quit");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp)
        {
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login to your account", "Wrong password ! \nEnter your password", "Login", "Quit");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            SendClientMessage(playerid,Green, "Successfully logged in");
        }
    }
    if (dialogid == 3)
    {
        if(PlayerInfo[playerid][pAdminLevel] >=1) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login to your account", "Enter your password", "Login", "Quit");
        if(strval(inputtext) == AdminPassword)
        {
            SendClientMessage(playerid, Green, "Welcome Admin");
            PLVL[playerid] = 1;
        }
        else
        {
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login to your account", "Wrong password ! \nEnter your password", "Login", "Quit");
        }
    }
    return 1;
}
Reply


Messages In This Thread
admin password - by xir - 08.01.2011, 11:37
Re: admin password - by xir - 08.01.2011, 13:15
Re: admin password - by Mike Garber - 08.01.2011, 13:25
Re: admin password - by xir - 08.01.2011, 13:39
Re: admin password - by xir - 08.01.2011, 20:50
Re: admin password - by xir - 09.01.2011, 08:29
Re: admin password - by MadeMan - 09.01.2011, 08:47
Re: admin password - by GiS - 09.01.2011, 08:48
Re: admin password - by xir - 09.01.2011, 08:56
Re: admin password - by MadeMan - 09.01.2011, 09:20

Forum Jump:


Users browsing this thread: 4 Guest(s)