WP_Hash (I'm new to this)
#1

Hi guys, How Can I replace udb_hash with WP_Hash

Please help I'm new to this hash..
I replaced them but It gives me 4 warnings!

Reply Anyone?
Reply
#2

PHP код:
// To the top of your script below the #include's
native WP_Hash(buffer[], len, const str[]);
buffer The string where your hashed password will be stored in.
len Length of the buffer (string)
str The string which will be hashed and stored to buffer 
// Example of Usage - OnDialogResponse - Registration
new hashpass[129];
WP_Hash(hashpasssizeof(hashpass), inputtext); 
And now inputtext is hashed stored @ hashpass. You may save the hashpass on your saving system or what so ever.
As far as I know, buffer's cell size should be always 129.
Reply
#3

WP_Hash(buffer, len, string);

Example:

new buf[129];
WP_Hash(buf, sizeof (buf), "Text to be hashed");
Reply
#4

I didnt do it as a global string , I did it as local ..
I get these errors:
Код:
C:\Users\gouth_000\Desktop\Server SAMP\filterscripts\GoAdmin1.0.pwn(407) : error 035: argument type mismatch (argument 3)
C:\Users\gouth_000\Desktop\Server SAMP\filterscripts\GoAdmin1.0.pwn(428) : error 033: array must be indexed (variable "hashpass")
Code
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new 
IP[22];
                new 
hashpass[129];
                
WP_Hash(hashpass,sizeof(hashpass),inputtext);
                
GetPlayerIp(playeridIPsizeof(IP));
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",hashpass);
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"VIP",0);
                
INI_WriteString(File"Ip"IP);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_Close(File);
                
SpawnPlayer(playerid);
                
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! You have registered here!","Ok","");
                        }
        }
        case 
DIALOG_LOGIN:
        {
            if ( !
response ) return Kick playerid );
            if( 
response )
            {
                new 
hashpass[129];
                
WP_Hash(hashpass,sizeof(hashpass),inputtext);
                if(
hashpass == PlayerInfo[playerid][pPass])
                {
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 
1;
            }
        }
    }
    return 
1;

EDIT:Only DIALOG_LOGIN HAS THE ERROR NOW
Reply
#5

Wrong:

Код:
if(hashpass == PlayerInfo[playerid][pPass])
Correct:

Код:
if( !strcmp(hashpass, PlayerInfo[playerid][pPass], true) )
This is wrong too:

Quote:

INI_WriteInt(File,"Password",hashpass);

Password is string, use INI_WriteString.
Reply
#6

I have made it strcmp now it works fine thanks!
Reply
#7

Gotham, use a plugin Whirlpool. https://mega.nz/#!CRpmRCYI!1FZzSJH_e...sifdfJJxWPMMDw ^^
Reply
#8

I have it bro, If you are checking my GoAdmin release, I haven't made it to v1.1 yet!

Now the problem is that when I login i can do with any pass
Reply
#9

Quote:
Originally Posted by Gotham
Посмотреть сообщение
Now the problem is that when I login i can do with any pass
you might find some problems with saving the password,
sometimes you could login with any inputted password
so I suggest that you change the LoadUser_%s to LoadUser_data
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)