A few errors while compiling.
#1

Код:
   		if(!strlen(inputtext)) return ShowPlayerDialog(playerid,27,DIALOG_STYLE_PASSWORD,"Password Selection (3/7)","The password length minimum is 6 alpha-numeric characters.\nEnter a password to register:","Register","Quit");
				new string1[128], string2[128];
				string1[128] = udb_hash(inputtext);
				string2[128] = udb_hash(PlayerInfo[playerid][pPass];
				if(!strcmp(string1, string2)) return ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Password Selection (3/7)","Invalid Password, confirm your password:","Register","Quit");
Errors:

Код:
C:\Users\fabio\Desktop\Biohazard Roleplay\gamemodes\bhrp.pwn(1037) : error 032: array index out of bounds (variable "string1")
C:\Users\fabio\Desktop\Biohazard Roleplay\gamemodes\bhrp.pwn(1038) : error 032: array index out of bounds (variable "string2")
C:\Users\fabio\Desktop\Biohazard Roleplay\gamemodes\bhrp.pwn(1038) : error 001: expected token: ",", but found ";"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
I don't know what I'm doing whrong.

I want to check if a previous password that has been inputted (PlayerInfo....) is the same as the current inputtext. (String2, Udb_Hash(inputtext)).
Reply
#2

You have to do it like this:

PHP код:
format(string1,sizeof(string1),udb_hash(inputtext));
format(string2,sizeof(string2),udb_hash(PlayerInfo[playerid][pPass])); 
Or write it just like:

PHP код:
if(!strcmp(udb_hash(inputtext), udb_hash(PlayerInfo[playerid][pPass]))) 
Reply
#3

you should do it like this:
PHP код:
    if(!strlen(inputtext)) return ShowPlayerDialog(playerid,27,DIALOG_STYLE_PASSWORD,"Password Selection (3/7)","The password length minimum is 6 alpha-numeric characters.\nEnter a password to register:","Register","Quit");
                new 
string1[128], string2[128];
                
format(string1sizeof(string1), "%s",udb_hash(inputtext))
                
format(string2sizeof(string2), "%s",udb_hash(PlayerInfo[playerid][pPass])
                if(!
strcmp(string1string2)) return ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Password Selection (3/7)","Invalid Password, confirm your password:","Register","Quit"); 
Reply
#4

Thanks.
Reply
#5

Getting these wxarnings now:
Код:
C:\Users\fabio\Desktop\Biohazard Roleplay\gamemodes\bhrp.pwn(1037) : error 001: expected token: ";", but found ")"
C:\Users\fabio\Desktop\Biohazard Roleplay\gamemodes\bhrp.pwn(1037) : error 029: invalid expression, assumed zero
C:\Users\fabio\Desktop\Biohazard Roleplay\gamemodes\bhrp.pwn(1037) : warning 215: expression has no effect
C:\Users\fabio\Desktop\Biohazard Roleplay\gamemodes\bhrp.pwn(1038) : error 001: expected token: ";", but found ")"
C:\Users\fabio\Desktop\Biohazard Roleplay\gamemodes\bhrp.pwn(1038) : error 029: invalid expression, assumed zero
C:\Users\fabio\Desktop\Biohazard Roleplay\gamemodes\bhrp.pwn(1038) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Code:
PHP код:
                new string1[128], string2[128];
                
format(string1sizeof(string1), "%s",udb_hash(inputtext)));
                
format(string2sizeof(string2), "%s",udb_hash(PlayerInfo[playerid][pPass])));
                if(!
strcmp(string1string2)) return .............. 
Reply
#6

Dude..just listen to me

Just write:

PHP код:
if(!strcmp(udb_hash(inputtext), udb_hash(PlayerInfo[playerid][pPass])))  return ... 
Reply
#7

my bad, try it like this:
PHP код:
       new string1[128], string2[128];
                
format(string1sizeof(string1), "%s",udb_hash(inputtext));
                
format(string2sizeof(string2), "%s",udb_hash(PlayerInfo[playerid][pPass]));
                if(!
strcmp(string1string2)) return .............. 
Reply
#8

Quote:
Originally Posted by Dusan01
Посмотреть сообщение
my bad, try it like this:
PHP код:
       new string1[128], string2[128];
                
format(string1sizeof(string1), "%s",udb_hash(inputtext));
                
format(string2sizeof(string2), "%s",udb_hash(PlayerInfo[playerid][pPass]));
                if(!
strcmp(string1string2)) return .............. 
Why are you formatting, you can just use strcmp like Kaliber has said. Waste of strings.
Reply
#9

Use a proper hashing algorithm. udb_hash (also known as Adler32) is not a hashing algorithm and it is NOT SECURE. At All. I can't stress this enough. It can be cracked in seconds. Use this: https://sampwiki.blast.hk/wiki/SHA256_PassHash
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)