Need help stcrmp
#1

pawn Код:
if(!strcmp(pData[playerid][pPass],h_password,true))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        SCM(playerid,C_GREEN,"Loggedin");
        logged[playerid] = 1;
    }
Guys i always got correct password even if i use the error password
what is wrong with this one i even load it
Reply
#2

Make sure that both of the variables in the strcmp actually have a value, if they don't it will return a match anyway. Use print and debug them like this:
pawn Код:
print(pData[playerid][pPass]);
print(h_password);
If one of them creates a blank line in the console, then the strcmp isn't the issue.
Reply
#3

Just /changepass and try to type the error password
the same as mine i just /changepass and its fixed
Reply
#4

Quote:
Originally Posted by RicaNiel
Посмотреть сообщение
pawn Код:
if(!strcmp(pData[playerid][pPass],h_password,true))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        SCM(playerid,C_GREEN,"Loggedin");
        logged[playerid] = 1;
    }
Guys i always got correct password even if i use the error password
what is wrong with this one i even load it
Comparing string lenths will add an extra check.

pawn Код:
if(!strcmp(pData[playerid][pPass],h_password,true) && strlen(Data[playerid][pPass]) == strlen(h_password))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        SCM(playerid,C_GREEN,"Loggedin");
        logged[playerid] = 1;
    }
Reply
#5

so what do i need to do?
i have debugegd its same but still correct password when i try to do a incorrect password
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)