/changepassword doubt ++Rep
#1

Hello
I am working to make a /changepassword command in game
so this is the format /changepassword (new password)

So i am having doubt to hash password

Here is the code while registering and how can i make that command

PHP код:
case DIALOG_REGISTER:
        {
            if(!
response)
                return 
KickDelay(playerid);
            
            if(
strlen(inputtext) <= 5)            
            {
                new 
pesan[300];
                
//ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registration", "Your password must be longer than 5 characters!\nPlease enter your password in the field below.", "Register", "Leave");
                
format(pesansizeof(pesan), "{ffffff}Welcome to Los Santos {0066ff}Cops {ffffff}and {ff0000}Robbers.\n\n{ffffff}User Name: {ff7a00}%s.\n{ffffff}Ip Address: {ff7a00}%s\n\n{ff0000}Your password must be longer than 5 characters.\n{ffffff}Enter your password.."GetName(playerid),getIP(playerid));
                return 
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT"LSCNR - REGISTER"pesan"Register""Quit");
            }
            
            
format(message256"{0066ff}* %s(%d) has connected to the server."GetName(playerid),playerid);
            
SendClientMessageToAll(COLOR_WHITE,message);
            new 
query[512];
            
initTextdraw(playerid);
            
Player[playerid][sqlCheck]++;
            
WP_Hash(Player[playerid][playerPassword], 129inputtext);
            
mysql_format(koneksiquerysizeof(query), "INSERT INTO `player` (`name`, `password`, `ip`, `registered`, `lastlogged`) VALUES ('%s', '%s', '%s', now(), now())"safeString(GetName(playerid)), Player[playerid][playerPassword], getIP(playerid));
            
registerSMF(GetName(playerid), inputtext);
            
mysql_tquery(koneksiquery"OnPlayerRegister""dd"playeridPlayer[playerid][sqlCheck]);
        } 
Reply
#2

Код:
CMD:changepassword(playerid, params[])
{
	// 28 is the value of the password string
	if(sscanf(params, "s[28]", params)) return SendClientMessage(playerid, -1, "[PARAMETERS] /changepassword [NEW PASSWORD]");
	format(string, 140, "[NEW PASSWORD] You've changed your passsword to %s", params);
	SendClientMessage(playerid, -1, string);
	WP_Hash(Player[playerid][playerPassword], 28, params);
	// now save it
	return 1;
}
Not tested, but hope it works
Reply
#3

can i make it with sscanf and zcmd ??
can u guys give an example ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)