Help! -
Lajko1 - 21.03.2010
Hello i allmost complete my dialog registration and login system but here is 1 problem
CODE:
Код:
public OnPlayerConnect(playerid)
{
new file[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(!dini_Exists(file))
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Rp Registration","Hello %s!\nYou are not registered on this server.\nso please enter the password in the box\nto register a new account!","Register","Cancel");
}
else
{
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login","Welcome back %s!Please type in your password!\nEnjoy","Login","Cancel");
return 1;
}
return 1;
}
this is my OnPlayerConnect, i want when player connect and he is not registered it will show him the dialog 1,and than when he is registered and when he come back it should show him dialog 2, but i make 1 mistake and i dont know where... so when player register its all ok it make a file with his name etc etc, BUT when he dissconect and come back it show him the same dialog ''1'' and he must ''register again'' but i want he should login if he is allready registered wtf i did wrong in the script ?
i hope i give enough informations,if not just tell me and i will post.
EDIT: and 1 more question how i can do those strings or what ever they are in dialogs visible ? %s,%d etc etc, i try this
Код:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Rp Registration","Hello %s!\nYou are not registered on this server.\nso please enter the password in the box\nto register a new account!","Register","Cancel");
but it wont show his name , i know i make it wrong and someone some months ago told me how to do this and i forget ^^
Ty For Any Help!
Re: Help! -
MadeMan - 21.03.2010
pawn Код:
public OnPlayerConnect(playerid)
{
new file[64], text[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(!dini_Exists(file))
{
format(text, sizeof(text), "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",text,"Register","Cancel");
}
else
{
format(text, sizeof(text), "Welcome back %s!Please type in your password!\nEnjoy", name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login",text,"Login","Cancel");
}
return 1;
}
You also need to format file to your user accounts folder.
Re: Help! -
TheChaoz - 21.03.2010
try like this:
pawn Код:
public OnPlayerConnect(playerid)
{
new file[256];
mew str[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(file, sizeof(file), "/%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;
}
You might have to change the folder of your user's acounts here
pawn Код:
format(file, sizeof(file), "/%s", name);
hope it's help u
Re: Help! -
Lajko1 - 22.03.2010
it helped just for those strings but still wrong dialogs are showing ...
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;
}
and on dialog response
Код:
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;
}
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
Re: Help! -
MadeMan - 22.03.2010
pawn Код:
format(file, sizeof(file), "KA/Users/%s", name);
pawn Код:
format(file,sizeof(file),"/KA/Users/%s.ini",name);
pawn Код:
format(file,sizeof(file),"/KA/Users/%s.ini",name);
See the difference?
Re: Help! -
Lajko1 - 22.03.2010
i think so

difference is in ''spaces''
Re: Help! -
Lajko1 - 22.03.2010
it show the rigt dialog now ... but can u help me ? if i type wrong pw its still login ... how i can make if i enter a wrong pw it will show him the error message and how i can make the password must be long min 3 words max 15 words ? just this and my dialog register/login system is complete , i think so
ty for help guys
Re: Help! -
Zimon95 - 22.03.2010
Your code is wrong, that's why it connects with bad password:
pawn Код:
if(strcmp(inputtext,PlayerInfo[playerid][Password],true) == 0)
{
IsLogged[playerid] = 1;
}
It should be true, not false.
Re: Help! -
Lajko1 - 22.03.2010
i change but idk ... it was in german version and i translate to english

so there must be some mistakes that i did wrong ...
here is pastebin please try the mode its very small and try to fix,Please
http://pastebin.com/R5BL6ihp
Ty for help
Re: Help! -
Lajko1 - 22.03.2010
anyone please i am working on this dialog register/login system 2 weeks and i cant make it ... its so hard