[Help] - Login problem
#1

Hello guys, it's me .
This time I got a problem with password on login. Whatever I type, server just accept it. Here's an login code, if you can find a problem ? Thanks

Код:
    case DIALOG_LOGIN:
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hashpass[50];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            if(!strcmp(hashpass, PlayerData[playerid][pPass], false))
            {
                INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true, .extra = playerid);
                SetPlayerScore(playerid,PlayerData[playerid][pLevel]);
                GivePlayerMoney(playerid,PlayerData[playerid][pNovac]);
            }
            else
            {
                Kick(playerid);
       	    }
    	}
    }
Reply
#2

!strcmp means 0, however strings can also compare into negative values. You'll need to check it against it being 0.

EDIT:

(source: SA-MP wiki)

-1 if string1 comes before string2
1 if string1 comes after string2
0 if the strings are the same (for the matched length).

Important Note: This function also returns 0 if either string is empty.
Reply
#3

Quote:
Originally Posted by Sithis
Посмотреть сообщение
!strcmp means 0, however strings can also compare into negative values. You'll need to check it against it being 0.

EDIT:

(source: SA-MP wiki)

-1 if string1 comes before string2
1 if string1 comes after string2
0 if the strings are the same (for the matched length).

Important Note: This function also returns 0 if either string is empty.
Can you explain that better ? Please, I didn't understand you.
Reply
#4

Quote:
Originally Posted by SpaMaster
Посмотреть сообщение
Can you explain that better ? Please, I didn't understand you.
Read what i pasted from the wiki. Strcmp ONLY returns 0 if the strings are COMPLETELY identical, or if one of the strings you input is empty.

You probably have one of the strings empty, make sure you input two values into strcmp.
Reply
#5

Quote:
Originally Posted by Sithis
Посмотреть сообщение
Read what i pasted from the wiki. Strcmp ONLY returns 0 if the strings are COMPLETELY identical, or if one of the strings you input is empty.

You probably have one of the strings empty, make sure you input two values into strcmp.
My English is retarded, still, I can't understand you haha. Nevermind, I'll find out how.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)