COMMAND:register(playerid,params[])
{
new file[256],PlayerName[MAX_PLAYER_NAME],buf[129];
WP_Hash(buf, sizeof(buf), params);
GetPlayerName(playerid,PlayerName,MAX_PLAYER_NAME);
format(file,sizeof(file),"users/%s.txt",PlayerName);
if(dini_Exists(file)) return SendClientMessage(playerid,Red,"You are already registered.");
if(Account[playerid][Registered] == 1) return SendClientMessage(playerid,Red,"You are already registered.");
if (sscanf(params, "s[32]", params)) return SendClientMessage(playerid, Yellow, "Usage: /register password");
if(Account[playerid][Logged] == 1) return SendClientMessage(playerid,Red,"You are already registered, and logged in.");
if(strlen(params))
{
if(!dini_Exists(file))
{
dini_Create(file);
dini_Set(file,"Password",buf);
dini_IntSet(file,"Registered",1);
dini_IntSet(file,"Logged",1);
dini_IntSet(file,"Kills",0);
dini_IntSet(file,"Deaths",0);
dini_IntSet(file,"Level",0);
dini_IntSet(file,"Score",Account[playerid][Score] = 0);
dini_IntSet(file,"Cash",Account[playerid][Cash] = 0);
Account[playerid][Registered] = 1;
Account[playerid][Logged] = 1;
Account[playerid][Muted] = 0;
SendClientMessage(playerid,Green,"You are now registered and automatically logged in!");
return 1;
}
}
return 1;
}
COMMAND:changepass(playerid, params[])
{
new file[256], PlayerName[MAX_PLAYER_NAME], buf[150];
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
if(Account[playerid][Logged] != 1) return SendClientMessage(playerid,Red,"You are not logged in, so you can't use this command!");
if(strlen(params) >= 3)
{
format(file, sizeof(file), "users/%s.txt", PlayerName);
WP_Hash(buf, sizeof(buf), params);
dini_Set(file, "Password", buf);
SendClientMessage(playerid,Green, "Your password has been succesfull changed!");
}
else
{
SendClientMessage(playerid, Red, "Your password need to be atleast 3 characters long!");
}
return 1;
}
pawn Код:
|