22.03.2010, 14:05
it helped just for those strings but still wrong dialogs are showing ...
OnPlayerConect
and on dialog response
what is wrong ?
let me explain again what is problem:
when i connect and register all works OK it save admin level cash etc etc ... it show the right dialogs ... BUT when i dissconect and connect again and i am allready registered it show me the dialog for register again ... but i want a dialog that should login me ...
i hope u understand
ty for any help
and ty guys for help
OnPlayerConect
Код:
public OnPlayerConnect(playerid)
{
new file[256];
new str[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(file, sizeof(file), "KA/Users/%s", name);
if(!dini_Exists(file))
{
format(str, sizeof(str), "Hello %s!\nYou are not registered on this server.\nso please enter the password in the box\nto register a new account!", name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Rp Registration",str,"Register","Cancel");
}
else
{
format(str, sizeof(str), "Welcome back %s!Please type in your password!\nEnjoy", name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login",str,"Login","Cancel");
}
return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2) // Login dialog
{
if(response == 1)
{
new str[256];
new file[256];
new name[MAX_PLAYER_NAME];
if(!strlen(inputtext))return format(str, sizeof(str), "Hello %s!\nYou are not registered on this server.\nso please enter the password in the box\nto register a new account!", name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login",str,"Login","Cancel");
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"/KA/Users/%s.ini",name);
PlayerInfo[playerid][Password] = strval(dini_Get(file,"Password"));
if(strcmp(inputtext,PlayerInfo[playerid][Password],false) == 0)
{
IsLogged[playerid] = 1;
}
else
{
PlayerInfo[playerid][WrongPassword] += 1;
}
}
}
if(dialogid == 1) // Register dialog
{
if(response == 1)
{
new str[256];
new file[256];
new name[MAX_PLAYER_NAME];
PlayerInfo[playerid][AdminLevel] = 0;
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"/KA/Users/%s.ini",name);
dini_Create(file);
if(!strlen(inputtext))return format(str, sizeof(str), "Hello %s!\nYou are not registered on this server.\nso please enter the password in the box\nto register a new account!", name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Rp Registration",str,"Register","Cancel");
dini_Set(file,"Password",inputtext);
dini_IntSet(file,"Cash", 500);
dini_IntSet(file,"AdminLevel", 0);
dini_IntSet(file,"Registered", 1);
dini_IntSet(file,"WrongPassword", 0);
//new string[256];
format(str, sizeof(str), "You register your account sussessfuly\n\nAccount Informations:\nName: %s\nPassword: %s\n\nEnjoy Playing!", name,inputtext);
ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Susscessful",str,"Confirm","");
//Kick(playerid);
}
}
return 1;
}
let me explain again what is problem:
when i connect and register all works OK it save admin level cash etc etc ... it show the right dialogs ... BUT when i dissconect and connect again and i am allready registered it show me the dialog for register again ... but i want a dialog that should login me ...
i hope u understand

ty for any help
and ty guys for help

