admin password
#1

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??

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;
}
Reply
#2

help please, still trying to fix
Reply
#3

You don't tell us what is wrong with it, what does NOT happen that SHOULD happen?
Reply
#4

i get alot of errors

pawn Code:
E:\GTA San Andreas\Server\gamemodes\AdminPass.pwn(122) : warning 217: loose indentation
E:\GTA San Andreas\Server\gamemodes\AdminPass.pwn(125) : error 003: declaration of a local variable must appear in a compound block
E:\GTA San Andreas\Server\gamemodes\AdminPass.pwn(125) : warning 215: expression has no effect
E:\GTA San Andreas\Server\gamemodes\AdminPass.pwn(127) : error 035: argument type mismatch (argument 1)
E:\GTA San Andreas\Server\gamemodes\AdminPass.pwn(140) : error 030: compound statement not closed at the end of file (started at line 91)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
but i think the code is wrong
Reply
#5

someone please help
Reply
#6

i attempted to do it again ,but i cant figure it out pls help me
Reply
#7

Show the lines you have errors.
Reply
#8

We can easily help you if you show us each line with each error you got there
Reply
#9

i put the admin pass in a fs and make it before i put in the gamemode, so here is pastebin and i think sometihng is missing

http://pastebin.com/PfsR2G5Z

pawn Code:
E:\GTA San Andreas\Server\gamemodes\AdminPass.pwn(122) : warning 217: loose indentation
E:\GTA San Andreas\Server\gamemodes\AdminPass.pwn(125) : error 003: declaration of a local variable must appear in a compound block
E:\GTA San Andreas\Server\gamemodes\AdminPass.pwn(125) : warning 215: expression has no effect
E:\GTA San Andreas\Server\gamemodes\AdminPass.pwn(127) : error 035: argument type mismatch (argument 1)
E:\GTA San Andreas\Server\gamemodes\AdminPass.pwn(140) : error 030: compound statement not closed at the end of file (started at line 91)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
i think i can fix the indention problem , but i tried so hard to do the other errors i hope you guys can help
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)