Login/Register Problem.
#1

Hey!

My problem is that..
I got this server, and when I go on the server it tells me to register, then i log off then when i log back on, It tells me to register again instead of log on.
This is what I got under OnPlayerconnect:
Код:
public OnPlayerConnect(playerid)
{

	INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
 	ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{FFFFFF}Basic RolePlay - {FF9900}Login","\n\n{FF9900}___________________________________\n\n{FFFFFF}Welcome to {FF9900}Basic Roleplay\n\n{FFFFFF}You have {FF9900}Account\n\n{FFFFFF}Forum {FF9900}www.site.com\n\n{FFFFFF}Please type your password to {FF9900}Login\n\n{FFFFFF}Have a nice {FF9900}Day!\n\n{FF9900}___________________________________","Login","Quit");

	ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"{FFFFFF}Basic RolePlay - {FF9900}Register","\n\n{FF9900}___________________________________\n\n{FFFFFF}Welcome to {FF9900}Basic Roleplay\n\n{FFFFFF}You don't have {FF9900}Account\n\n{FFFFFF}Forum {FF9900}www.site.com\n\n{FFFFFF}Please type your password to {FF9900}Register.\n\n{FFFFFF}Have a nice {FF9900}Day!\n\n{FF9900}___________________________________","Register","Quit");
Hope you can help.
I'll reply if you've helped me (I'll brb 5 minutes)
Reply
#2

Umm that's because the code is executed sequentially from top to bottom.

Try something like:
pawn Код:
public OnPlayerConnect(playerid)
{
    new string[64];
    format(string,sizeof(string),"Player file name"); // Format it to match a players file like "UserData_Name.ini"
    if(fexist(string))  // This will check if that file exists. If it does we can assume that the player is already registered.
    {
         INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{FFFFFF}Basic RolePlay - {FF9900}Login","\n\n{FF9900}___________________________________\n\n{FFFFFF}Welcome to {FF9900}Basic Roleplay\n\n{FFFFFF}You have {FF9900}Account\n\n{FFFFFF}Forum {FF9900}www.site.com\n\n{FFFFFF}Please type your password to {FF9900}Login\n\n{FFFFFF}Have a nice {FF9900}Day!\n\n{FF9900}___________________________________","Login","Quit");
    }
    else // The file does NOT exist which means they connected for the first time.
    {
          ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"{FFFFFF}Basic RolePlay - {FF9900}Register","\n\n{FF9900}___________________________________\n\n{FFFFFF}Welcome to {FF9900}Basic Roleplay\n\n{FFFFFF}You don't have {FF9900}Account\n\n{FFFFFF}Forum {FF9900}www.site.com\n\n{FFFFFF}Please type your password to {FF9900}Register.\n\n{FFFFFF}Have a nice {FF9900}Day!\n\n{FF9900}___________________________________","Register","Quit");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)