01.09.2015, 04:54
pawn Код:
//Here is your tutorial
CMD:setpass(playerid, params[])
{
new op[20], np[20], np1[20], playername[25];
if (sscanf(params, "sss", op, np, np1)) return SendClientMessage2(playerid, COLOR_ORANGE, "Usage: /setpass [old pass] [new pass] [confirm new pass]");// You can use s[128] if you are using sscanf2
GetPlayerName(playerid, playername, MAX_PLAYER_NAME); //Getting playername
if (num_hash(op) != "Define your user's password from users file") return SendClientMessage2(playerid, COLOR_RED, "Error: You must type your current password correctly!");
if (strlen(np) < 6 || strlen(np) > 18) return SendClientMessage2(playerid, COLOR_RED, "Error: Your new password must be between 6-18 characters!");
if (strcmp(np, np1, false) != 0) return SendClientMessage2(playerid, COLOR_RED, "Error: You must confirm your new password correctly!");
//Here you must update your password in userfile
/*example */ dini_IntSet(playerfile(playerid), "Password", num_hash(op1));
SendClientMessage2(playerid, COLOR_YELLOW, "You have successfully changed your password.");
return 1;
}