02.02.2013, 17:17
(
Последний раз редактировалось Roach_; 02.02.2013 в 18:10.
)
pawn Код:
CMD:createaccount(playerid, params[])
{
new sP[MAX_PLAYER_NAME + 1], sV[34 + 1];
if(sscanf(params, "s[MAX_PLAYER_NAME]s[35]", 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;
}