24.05.2016, 21:09
Код:
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; }