Problem With Registration
#1

Hi Everybody.

I Made Little And Easy Registration/Login System For My Server.

But Now I Get A Problem.

Register And Login Working Fine, But When You Go To The Server For You Shows Gui Dialog With Login Or Registration..

When Shows Dialog With Login Or Register If Player Don't Login Or Register He Just Out Of Server Pressing ESC

All Of His Money , Score , And Else Disappears...

THIS IS MY REGISTRATION CODE:

Код:
//////REG

public OnPlayerConnect(playerid)
{
new name [MAX_PLAYERS];
new w[128];
new file[128];
GetPlayerName(playerid,name,sizeof(name));  
format(file,sizeof(file),"saves/user/%s.zig",name); 
if(fexist(file)) // Jei failas egzistuoja
{
format(w,sizeof(w),"{FFFFFF}Hi {6EF83C}%s\n{00FFEE}Input Register Code:",name); 
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"{B9B4BA}Login",w,"Login","Exit"); 
}
GetPlayerName(playerid,name,sizeof(name)); 
format(file,sizeof(file),"saves/user/%s.zig",name); 
if(!fexist(file)) 
{
format(w,sizeof(w),"{FFFFFF}Hi{6EF83C}%s\n{F81414}If You Want Register\n{6EF83C}Input The Code:",name); 
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{B9B4BA}Registracija",w,"Register","Exit"); 
if(InvalidNickKick(playerid)) return 0;
Clear(playerid);
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new name[MAX_PLAYER_NAME],file[128];
new w[128], gw[128];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"saves/user/%s.zig",name);

if(dialogid == 1)
{
if(response == 1)
{
if(strlen(inputtext))
{
if(fexist(file))
{
}
else
{
dini_Create(file);
dini_IntSet(file,"Password",tohash(inputtext));
format(w,sizeof(w),"{00FFEE}Your Registration Is Done! {6EF83C}Your Password: %s",inputtext,name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"{B9B4BA}Login",w,"Login","Exit");
playerDB[playerid][naujokas]=true;
GivePlayerMoneyA(playerid,15000);//MONEY
SetPlayerScore(playerid,2000);//SCORE
}
}
else
{
format(gw,sizeof(gw),"{F81414}Input The Code!\n{6EF83C}Please Register:",name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{B9B4BA}Register",gw,"Register","Exit");
}
}
if(response == 0)
{
SavePlayerData(playerid,false);
}
}
else if(dialogid == 2)
{
if(response == 1)
{
if(strlen(inputtext))
{
if(!fexist(file))
{
}
else
{
if(CheckPass(file,inputtext))
{
new exp = dini_Int(file,"Xp");
if(dini_Int(file,"Admin") == 1) playerDB[playerid][admin]=true;
if(dini_Int(file,"Vip") == 1) playerDB[playerid][vip]=true;
if(playerDB[playerid][admin] || playerDB[playerid][vip])
{
SendClientMessage(playerid,0x00FF7FAA,"Hi Admin-Vip");
}else{
SendClientMessage(playerid,0x00FF7FAA,"Hi Player");
}
if(exp == -1) playerDB[playerid][authstate]=1; else
playerDB[playerid][authstate]=2;
return 1;
}
format(w,sizeof(w),"{F81414}Code Incorrect!\n{6EF83C}Please Valid Code:",name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"Login",w,"Login","Exit");
}
}
else
{
format(w,sizeof(w),"{F81414}You Don't Input The Code!\n{6EF83C}Please Enter The Code:",name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"Login",w,"Login","Exit");
}
}
if(response == 0)
{
SavePlayerData(playerid,false);
}
}
return 0;
}
If Someone Can Help With This Please Help I Don't Know What Is Wrong With This Registration/Login System...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)