[Help] Login Register dialog
#1

new here

a player spawn after click login without any password
but i want not to spawn when password login dialog is empty or didn't match the encrypted password
PHP код:
    if(dialogid == DIALOG_LOGIN)
    {
        if(!
response) return Kick(playerid);
        {
            new 
Hashed_Password[129];
            
WP_Hash(Hashed_Passwordsizeof(Hashed_Password), inputtext);
            
//if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
            //if(!strcmp(Hashed_Password, PlayerInfo[playerid][pPass]))
            
if(strcmp(Hashed_PasswordPlayerInfo[playerid][pPass]))
            {
                
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra true, .extra playerid);
                
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
                
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
                
SetPlayerHealth(playeridPlayerInfo[playerid][pHealth]);
                
SetPlayerArmour(playeridPlayerInfo[playerid][pArmour]);
                
SendClientMessage(playerid,sCOLOR_REDSYSTEM_MSG ""cCOLOR_WHITE" Welcome back! You have successfully logged in");
                
ShowPlayerDialog(playeridDIALOG_SUCCESS_LOGINDIALOG_STYLE_MSGBOX,""cCOLOR_WHITE"Success!",""cCOLOR_GREEN"You have successfully logged in!","Ok","");
                
TogglePlayerSpectating(playeridtrue);
            }
            else
            {
                
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
                
ShowPlayerDialog(playeridDIALOG_FAILED_LOGINDIALOG_STYLE_MSGBOX,""cCOLOR_WHITE"Failed!",""cCOLOR_RED"Incorrent password!","Ok","");
                return 
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
                
//return 1;
            
}
        }
    } 
Reply
#2

It'd be more helpful if you could include the code you have so far so we could integrate it.
Reply
#3

do you need whole code?
Reply
#4

https://sampwiki.blast.hk/wiki/Strcmp

Basically, when you wanna check his password, then this line

Код:
if(strcmp(Hashed_Password, PlayerInfo[playerid][pPass]))
should look like this

Код:
if(!strcmp(Hashed_Password, PlayerInfo[playerid][pPass]))
strcmp returns 0 when it matches, and 1 or -1 when it doesn't.

Hope helped u.
Reply
#5

Read this please.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)