pawn Код:
dcmd_register(playerid,params[])
{
#pragma unused params
new file[128],n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"MyAdmin/Users/%s.ini",n);
if(dini_Exists(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,red,"You are already registered, and logged in!");
ShowPlayerDialog(playerid,10,DIALOG_STYLE_INPUT,"Register","Welcome \n We see you want to register\nPlease enter a password below","Register","Cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new file[128],n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"MyAdmin/Users/%s.ini",n); //Make sure you have those folders
if(dialogid == 10) //It must be 10, like they told you.
{
if(response) //You forgot this.
{
dini_Create(file);
dini_Set(file,"Password",inputtext);
dini_IntSet(file,"Regged",1);
dini_IntSet(file,"Logged",0);
dini_IntSet(file,"Level",0);
dini_IntSet(file,"Muted",0);
dini_IntSet(file,"Jailed",0);
dini_IntSet(file,"Frozen",0);
dini_IntSet(file,"Skin",0);
dini_IntSet(file,"Dueling",0);
dini_IntSet(file,"Score",GetPlayerScore(playerid));
SendClientMessage(playerid,LIGHTBLUE,"Congratulations, you have just registered, please /login");
PInfo[playerid][Regged] = 1;
}
else
{
SendClientMessage(playerid,LIGHTBLUE,"You canceled the register!");
}
}
return 1;
}