#1

I can login with any pass, but if I /login again with the wrong pass, it says error, but if its right, I can login

pawn Код:
CMD:login(playerid,params[])
{
    if(!fexist(Path(playerid))) return SendClientMessage(playerid,-1,"You are not registered.");
    if(isnull(params)) return ShowUsageMessage(playerid,"/login [Pass]");
    new hashpass[129];
    WP_Hash(hashpass,sizeof(hashpass),params);
    if(strcmp(params,pInfo[playerid][Pass]))
    {
        SendClientMessage(playerid,-1,"ERROR: Wrong Pass");
    }
    else
    {
        pLogged[playerid] = 1;
        INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
        SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
    }
    return 1;
}
Any help?

Thanks, tyler
Reply
#2

What about trying this
pawn Код:
CMD:login(playerid,params[])
{
    if(!fexist(Path(playerid))) return SendClientMessage(playerid,-1,"You are not registered.");
    if(isnull(params)) return ShowUsageMessage(playerid,"/login [Pass]");
    new hashpass[129];
    WP_Hash(hashpass,sizeof(hashpass),params);
    if(!strcmp(params,pInfo[playerid][Pass]))
    {
        pLogged[playerid] = 1;
        INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
        SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
    }
    else
    {
        SendClientMessage(playerid,-1,"ERROR: Wrong Pass");
    }
    return 1;
}
Reply
#3

strcmp returns 0 if the string matches, therefore it wouldnt work.

EDIT:I checked it anyway, dosent work.


Quote:
Originally Posted by Lexi'
Посмотреть сообщение
What about trying this
pawn Код:
CMD:login(playerid,params[])
{
    if(!fexist(Path(playerid))) return SendClientMessage(playerid,-1,"You are not registered.");
    if(isnull(params)) return ShowUsageMessage(playerid,"/login [Pass]");
    new hashpass[129];
    WP_Hash(hashpass,sizeof(hashpass),params);
    if(!strcmp(params,pInfo[playerid][Pass]))
    {
        pLogged[playerid] = 1;
        INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
        SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
    }
    else
    {
        SendClientMessage(playerid,-1,"ERROR: Wrong Pass");
    }
    return 1;
}
still nothing
Reply
#4

Well it would, because if(!strcmp is the same as if(strcmp... == 0).
Make sure you're using INI_ParseFile for loadaccount BEFORE they are able to login.
Reply
#5

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
Well it would, because if(!strcmp is the same as if(strcmp... == 0).
Make sure you're using INI_ParseFile for loadaccount BEFORE they are able to login.
holy facedesk and a half.

Im a noob. Thanks alot

repped both for helping!

EDIT:Just so you know, I was using plain text for testing purposes. Whirlpool added again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)