23.01.2011, 17:10
pawn Code:
CMD:register(playerid, params[])
{
new file[256],n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"mAdmin/Users/%s.txt",n);
if(fexist(file))
return SendClientMessage(playerid,YELLOW,"You are already registered!");
if(PInfo[playerid][Regged] == 1)
return SendClientMessage(playerid,LIGHTBLUE,"You are already registered!");
if(PInfo[playerid][Logged] == 1)
return SendClientMessage(playerid,ORANGE,"You are already registered, and logged in!");
new INI:PlayerAcc = INI_Open(file);
if(!isnull(params))
{
if(!fexist(file))
{
INI_WriteString(PlayerAcc,"Password",params);
INI_WriteInt(PlayerAcc,"Regged",1);
INI_WriteInt(PlayerAcc,"Logged",0);
INI_WriteInt(PlayerAcc,"Level",0);
INI_WriteInt(PlayerAcc,"Score",GetPlayerScore(playerid));
INI_WriteInt(PlayerAcc,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(PlayerAcc,"Deaths",0);
INI_WriteInt(PlayerAcc,"Kills",0);
SendClientMessage(playerid,ORANGE,"You have just registered, Please use /login [password] to login!");
PInfo[playerid][Regged] = 1;
return 1;
}
}
else
{
SendClientMessage(playerid,GREY,"USAGE: /register <Password>");
return 1;
}
return 1;
}