Getting pissed off with login dialog.
#1

pawn Код:
new pass[128];

Login:

pawn Код:
else if(dialogid == 2)
    {
        new name[MAX_PLAYERS], file[128], buf[129], string[70];
        GetPlayerName(playerid,name,sizeof(name));
        format(file,sizeof file,SERVER_USER_FILE,name);
        if(!response) return Kick(playerid);
        WP_Hash(buf, sizeof(buf), inputtext);
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Type your password below", "Login", "Quit");
        INI_ParseFile(file, "LoginAcc", false, true, playerid, true, false);
        GetPVarString(playerid, "pass", pass, sizeof(pass));
        if(strcmp(buf,pass,false))
        {
            SendClientMessage( playerid, RED, "Incorrect Password!" );
            ShowPlayerDialog( playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Type your password below", "Login", "Quit" );
        }
        else
        {
            PInfo[playerid][Logged] = 1;
            PInfo[playerid][Regged] = 1;
            GivePlayerMoney(playerid,PInfo[playerid][Cash]);
            SetPlayerScore(playerid,PInfo[playerid][Score]);
            new INI:Acc = INI_Open(file);
            INI_WriteInt(Acc,"Logged",1);
            INI_Close(Acc);
            if(PInfo[playerid][Level] == 0) SendClientMessage(playerid,limegreen,"You have logged in as a Normal Player");
            if(PInfo[playerid][Level] == 1) SendClientMessage(playerid,limegreen,"You have logged in as a Level 1 Admin");
            if(PInfo[playerid][Level] == 2) SendClientMessage(playerid,limegreen,"You have logged in as a Level 2 Admin");
            if(PInfo[playerid][Level] == 3) SendClientMessage(playerid,limegreen,"You have logged in as a Level 3 Admin");
            if(PInfo[playerid][Level] == 4) SendClientMessage(playerid,limegreen,"You have logged in as a Level 4 Admin");
            if(PInfo[playerid][Level] == 5) SendClientMessage(playerid,limegreen,"You have logged in as a Level 5 Admin");
            if(PInfo[playerid][Level] == 6) SendClientMessage(playerid,limegreen,"You have logged in as a Level 6 Admin (Scripter)");
            if(PInfo[playerid][Level] == 7) SendClientMessage(playerid,limegreen,"You have logged in as a Level 7 Admin (Owner)");
            format(string,sizeof(string),"[Donor Level %d]",PInfo[playerid][VIP]);
            SendClientMessage(playerid,limegreen,string);
        }
    }
LoginAccount:

pawn Код:
forward LoginAcc(playerid, name[ ], value[ ]);
public LoginAcc(playerid, name[ ], value[ ])
{
    if(strcmp(name,"Password")) {
        SetPVarString(playerid,"pass",value);
    }
    if(!strcmp(name, "Level", false) ) {
        PInfo[playerid][Level] = strval(value);
    }
    if(!strcmp(name, "VIP", false) ) {
        PInfo[playerid][VIP] = strval(value);
    }
    if(!strcmp(name, "Cash", false) ) {
        PInfo[playerid][Cash] = strval(value);
    }
    if(!strcmp(name, "Score", false) ) {
        PInfo[playerid][Score] = strval(value);
    }
    if(!strcmp(name, "Kills", false) ) {
        PInfo[playerid][Kills] = strval(value);
    }
    if(!strcmp(name, "Deaths", false) ) {
        PInfo[playerid][Deaths] = strval(value);
    }
    if(!strcmp(name, "Horn", false) ) {
        PInfo[playerid][Horn] = strval(value);
    }
    return 1;
}

It keeps saying Incorrect Password.
Reply
#2

pawn Код:
if(strcmp(name,"Password")) {
There should be '!' in front

pawn Код:
if(!strcmp(name,"Password")) {
Reply
#3

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
pawn Код:
if(strcmp(name,"Password")) {
There should be '!' in front

pawn Код:
if(!strcmp(name,"Password")) {
It was that easy?! xD
Thanks, let me try it out.

EDIT: Nope, doesnt work. Still says Incorrect Password.
Reply
#4

Bump
Reply
#5

pawn Код:
public LoginAcc(playerid, name[ ], value[ ])
{
    if(strcmp(name,"Password"))
    {
        SetPVarString(playerid,"pass",value);
        PInfo[playerid][Level] = strval(value);
        PInfo[playerid][VIP] = strval(value);
        PInfo[playerid][Cash] = strval(value);
        PInfo[playerid][Score] = strval(value);
        PInfo[playerid][Kills] = strval(value);
        PInfo[playerid][Deaths] = strval(value);
        PInfo[playerid][Horn] = strval(value);
    }
    return 1;
}
or:
pawn Код:
public LoginAcc(playerid, name[ ], value[ ])
{
    if(!strcmp(name,"Password"))
    {
        SetPVarString(playerid,"pass",value);
        PInfo[playerid][Level] = strval(value);
        PInfo[playerid][VIP] = strval(value);
        PInfo[playerid][Cash] = strval(value);
        PInfo[playerid][Score] = strval(value);
        PInfo[playerid][Kills] = strval(value);
        PInfo[playerid][Deaths] = strval(value);
        PInfo[playerid][Horn] = strval(value);
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by Pablo Borsellino
Посмотреть сообщение
pawn Код:
public LoginAcc(playerid, name[ ], value[ ])
{
    if(strcmp(name,"Password"))
    {
        SetPVarString(playerid,"pass",value);
        PInfo[playerid][Level] = strval(value);
        PInfo[playerid][VIP] = strval(value);
        PInfo[playerid][Cash] = strval(value);
        PInfo[playerid][Score] = strval(value);
        PInfo[playerid][Kills] = strval(value);
        PInfo[playerid][Deaths] = strval(value);
        PInfo[playerid][Horn] = strval(value);
    }
    return 1;
}
or:
pawn Код:
public LoginAcc(playerid, name[ ], value[ ])
{
    if(!strcmp(name,"Password"))
    {
        SetPVarString(playerid,"pass",value);
        PInfo[playerid][Level] = strval(value);
        PInfo[playerid][VIP] = strval(value);
        PInfo[playerid][Cash] = strval(value);
        PInfo[playerid][Score] = strval(value);
        PInfo[playerid][Kills] = strval(value);
        PInfo[playerid][Deaths] = strval(value);
        PInfo[playerid][Horn] = strval(value);
    }
    return 1;
}
Only the login is bugged, not anything else. And that would be waay wrong. It would set all the variables to the password value.
Reply
#7

Bump again?!
Reply
#8

Bump.. again.


What's the best way to "read" with Y_INI?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)