04.02.2013, 12:06
Quote:
CMD:createaccount(playerid, params[]) { new sP[MAX_PLAYER_NAME + 1], sV[34 + 1]; if(sscanf(params, "ss", uP, sV)) return SendClientMessage(playerid, -1, "USAGE: /createaccount [Name] [Password]"); if(strlen(sP) < 3 || strlen(sV) > MAX_PLAYER_NAME) return SendClientMessage(playerid, -1, "ERROR: Invalid name lenghth"); if(strlen(sV) < 5 || strlen(sV) > 34) return SendClientMessage(playerid, -1, "ERROR: Invalid password lenghth"); SetPlayerName(playerid, sP); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File, "data"); INI_WriteInt(File, "Password", udb_hash(sV)); INI_WriteInt(File, "Cash", 0); INI_WriteInt(File, "Admin", 0); INI_WriteInt(File, "Kills", 0); INI_WriteInt(File, "Deaths", 0); INI_Close(File); SendClientMessage(playerid, -1, "Account created!"); return 1; } |