Help me please? i really need help
#1

I got this login and register system by Kush and when i register it logs in fine and stuff but when i relog i get the login screen and i type the correct password but it says invalid password please help me.. here is the code

pawn Код:
stock udb_hash(buf[])
{
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login on PBRP","Welcome back to PBRP! This account is registered.\nEnter your password below to login to your account.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register on PBRP","Welcome to PBRP! This account is not registered.\nEnter your password below to create the account account.","Register","Quit");
    }
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_REGISTER)
    {
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register on PBRP","Welcome to PBRP! This account is not registered.\nEnter your password below to create the account account.","Register","Quit");
            new INI:File = INI_Open(UserPath(playerid));
            INI_SetTag(File,"PBRP User Database");
            INI_WriteInt(File,"Password",udb_hash(inputtext));
            INI_WriteInt(File,"Admin",0);
            INI_WriteInt(File,"Money",0);
            INI_WriteInt(File,"Level",0);
            INI_WriteInt(File,"Skin",0);
            INI_Close(File);
            SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
            SpawnPlayer(playerid);
            SendClientMessage(playerid,-1,"Welcome to PBRP! You have successfully registered.");
        }
        else Kick(playerid);
    }
    else if(dialogid == DIALOG_LOGIN)
    {
        if( response )
        {
            if(udb_hash(inputtext) == PlayerInfo[playerid][pPassword])
            {
                INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
                GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
                SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
                SendClientMessage(playerid,-1,"Welcome back to PBRP! You have successfully logged in.");
            }
            else
            {
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login on PBRP","Welcome back to PBRP! This account is registered.\nEnter your password below to login to your account.","Login","Quit");
            }
            return 1;
        }
        else Kick(playerid);
    }
    return 1;
}
Reply


Messages In This Thread
Help me please? i really need help - by Wizz123 - 24.01.2014, 16:10
Re: Help me please? i really need help - by DaniceMcHarley - 24.01.2014, 17:56
Re: Help me please? i really need help - by Wizz123 - 24.01.2014, 18:02
Re: Help me please? i really need help - by CH | FuDo - 24.01.2014, 18:07
Re: Help me please? i really need help - by FailerZ - 24.01.2014, 19:21
Re: Help me please? i really need help - by Wizz123 - 24.01.2014, 19:44

Forum Jump:


Users browsing this thread: 1 Guest(s)