08.01.2011, 11:37
hello, i need help with admin password
i tried to get it from the pocket admin made by zezombia, but i want to make it in dialog because i hate /login etc
after a normal player logs in they only need to type their password and they enter, but when an admin enter they need to write their own password and the admin password, in dialog.....
i tried to make one here is my ondialogrespone but is very very hard
also do i need to make the dialogs onplayerconnect??
i tried to get it from the pocket admin made by zezombia, but i want to make it in dialog because i hate /login etc
after a normal player logs in they only need to type their password and they enter, but when an admin enter they need to write their own password and the admin password, in dialog.....
i tried to make one here is my ondialogrespone but is very very hard
also do i need to make the dialogs onplayerconnect??
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)
new tmp;
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login to your account", "Enter your password", "Login", "Quit");
if(strval(tmp) == AdminPassword)
{
SendClientMessage(playerid, Green, "Welcome Admin");
return PLVL[playerid] = 1;
}
else
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login to your account", "Wrong password ! \nEnter your password", "Login", "Quit");
}
}
return 1;
}