Question about /changepass command (using whirpool)
#2

Код:
CMD:setpassword(playerid, params[])
{
	if (!IsPlayerAdmin(playerid))
	    return SendClientMessage(playerid, 0xFF0000FF, "You cannot use this command.");

	new pname[34], pass[33];
	// pName size depends on your saving folder name
	// As an example, I'll be using
	// Users/.ini
	// Pass size depends on your max pass length
	if (sscanf(params, "s[24]s[33]", pname, pass))
	    return SendClientMessage(playerid, 0x00FFFFFF, "Usage: /setpassword [player name] [new password]");
	if (strlen(pass) > 32)
	    return SendClientMessage(playerid, 0xFF0000FF, "Max length of the password is 32 characters.");
	format(pname, sizeof (pname), "Users/%s.ini", pname);
	if (fexist(pname))
	{
	    new buf[129];
	    WP_Hash(buf, sizeof (buf), pass);
	    new INI: File = INI_Open(pname);
	    INI_WriteString(File, "Password", buf);
	    INI_Close(File);
	    SendClientMessage(playerid, 0x00FF00FF, "Password has been changed.");
	}
	else SendClientMessage(playerid, 0xFF0000FF, "Name doesn't exist.");
	return 1;
}
This uses Y_INI. Change what you have to change depending on what you use.
Reply


Messages In This Thread
Question about /changepass command (using whirpool) - by Saddin - 24.05.2016, 20:42
Re: Question about /changepass command (using whirpool) - by Stinged - 24.05.2016, 21:09

Forum Jump:


Users browsing this thread: 1 Guest(s)