Login Problem
#1

Hey guys,

So I been working on my script for a bit now and some strange reason my script is messing up on login, before I could login perfectly but now it just says wrong password, heres the code below:

pawn Код:
if(dialogid == DIALOG_LOGIN)
    {
        if(!response)
        {
                Kick(playerid);
        }
        if(response)
        {
            if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
            {
                INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ], PlayerInfo[playerid][Angle], 0, 0, 0, 0, 0, 0);
                GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon1], PlayerInfo[playerid][Weapon1a]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon2], PlayerInfo[playerid][Weapon2a]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon3], PlayerInfo[playerid][Weapon3a]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon4], PlayerInfo[playerid][Weapon4a]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon5], PlayerInfo[playerid][Weapon5a]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon6], PlayerInfo[playerid][Weapon6a]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon7], PlayerInfo[playerid][Weapon7a]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon8], PlayerInfo[playerid][Weapon8a]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon9], PlayerInfo[playerid][Weapon9a]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon10], PlayerInfo[playerid][Weapon10a]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon11], PlayerInfo[playerid][Weapon11a]);
                GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon12], PlayerInfo[playerid][Weapon12a]);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"{00FF22}Success!","{FFFFFF}You have successfully logged in!","Ok","");
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{FFFFFF}Login","{F81414}You have entered an incorrect password.\n{FFFFFF}Type your password below to login.","Login","Quit");
            }
            return 1;
        }
    }
Its odd because it works fine but when I swap it, it works but when I restart the server the player info fucks up, am using the y_ini plugin
Reply
#2

Change :
Код:
 if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
To
Код:
  new hashpass[129]; 
            WP_Hash(hashpass,sizeof(hashpass),inputtext); 
            if(!strcmp(hashpass, PlayerInfo[playerid][pPass], false))
And It'll work just fine.

Edit : The reason why it says password is wrong , is because : inputtext is [128] array, and pPass is [129].
Get the whirlpool plugin if you don't have it aswell.
Reply
#3

Код:
C:\Users\SoulLedger\Desktop\Server files\gamemodes\Main.pwn(1589) : error 017: undefined symbol "WP_Hash"
C:\Users\SoulLedger\Desktop\Server files\gamemodes\Main.pwn(1589) : warning 202: number of arguments does not match definition
C:\Users\SoulLedger\Desktop\Server files\gamemodes\Main.pwn(1589) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I get this after compiling it
Reply
#4

I told you to get Whirlpool ( + native )
Put this on top of your game-mode script ( after includes )
Код:
native WP_Hash(buffer[],len,const str[]);
Download : https://sampforum.blast.hk/showthread.php?tid=65290
And thank ****** later

Edit : you wanna change a little bit the register dialog aswell to :
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
INI_WriteString(file,"Password",hashpass);
Reply
#5

Ops didn't read that properly but I fixed it after realizing it so thanks man haha
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)