SA-MP Forums Archive
[Help] Login Register dialog - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help] Login Register dialog (/showthread.php?tid=643348)



[Help] Login Register dialog - RedFall - 18.10.2017

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;
            
}
        }
    } 



Re: [Help] Login Register dialog - Kane - 18.10.2017

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


Re: [Help] Login Register dialog - RedFall - 21.10.2017

do you need whole code?


Re: [Help] Login Register dialog - TheRohlikar - 21.10.2017

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.


Re: [Help] Login Register dialog - whadez - 21.10.2017

Read this please.
Код:
https://sampwiki.blast.hk/wiki/Strcmp