11.03.2015, 16:31
PHP код:
CMD:changepass(playerid, params[])
{
if(!fexist(UserPath(playerid))) //We checked if you are registered, if it is not would create a file with the password but would have no statistics:
return SendClientMessage(playerid, -1,"You need to be registred in first.");
if(isnull(params)) // We note that the text you entered is not null.
return SendClientMessage(playerid, -1,"USAGE: /changepass [new pass]");
if(strlen(params) < 3 || strlen(params) > 15) // We note that the text entered is 3 to 15 characters.
return SendClientMessage(playerid, -1, "Leght the new password incorrect, min 3 characters, max 15.");
SendClientMessage(playerid, -1, "You hace successfully changed your password."); // message password changed successfully.
new INI:File = INI_Open(UserPath(playerid)); // Open file the player.
INI_SetTag(File,"data"); // set tag data if exist write tag.
INI_WriteInt(File,"Password", udb_hash(params)); // write new password.
INI_Close(File); // close file.
return true; // end command.
}