Login Help
#1

Hello!

I have a problem with my server's accounts.

Whenever a player connects to the server, even if his account is already registered, he gets the registration dialog.

If he attempts to use the registration dialog, the login dialog appears (after I edited it) as it sends him the message that the account is already registered.

I want to get rid of the registering dialog when you are already registered.

Here are the codes:

OnPlayerConnect:

PHP код:
    new pname[MAX_PLAYER_NAME], path[200];
    
GetPlayerName(playeridpnamesizeof(pname));
    
format(pathsizeof(path), "Users/%s.ini"pname);
    if(!
dini_Exists(path))
    {
        
gPlayerAccount[playerid] = 1;
        
DisplayDialogForPlayer(playerid1);
        
SendClientMessage(playerid, -1"This server may use explicit content. By playing here you agree with our COPPA Compliance.");
        return 
1;
    }
    else
    {
        
gPlayerAccount[playerid] = 0;
        
DisplayDialogForPlayer(playerid2);
        
SendClientMessage(playerid, -1"This server may use explicit content. By playing here you agree with our COPPA Compliance.");
        return 
1;
    } 
OnDialogResponse:

Logging in:

PHP код:
    if(dialogid == 1//LOGIN
    
{
        if(
gPlayerLogged[playerid] == 1)
        {
            
SendClientMessage(playeridCOLOR_WHITE"Error: You are already logged in.");
            return 
1;
        }
        if(
response)
        {
            if(!
strlen(inputtext))
            {
                
ClearChatbox(playerid100);
                
DisplayDialogForPlayer(playerid1); //login
                
SendClientMessage(playeridCOLOR_WHITE"Error: You must enter a password.");
                return 
1;
            }
            if(
strlen(inputtext) >= 50)
            {
                
ClearChatbox(playerid100);
                
DisplayDialogForPlayer(playerid1); //login
                
SendClientMessage(playeridCOLOR_WHITE"Error: Password is too long.");
                return 
0;
            }
            new 
tmppass[64];
            
//Store Player ID & TMP pass in echo to find string used to crash server
            
new playername[MAX_PLAYER_NAME];
            
strmid(tmppassinputtext0strlen(inputtext), 255);
            
GetPlayerName(playeridplayernamesizeof(playername));
            
//FadeColorForPlayer(playerid,0,0,0,0,0,0,0,255,15,0);
            
if(strlen(playername) == 3)
            {
                    
SendClientMessage(playeridCOLOR_LIGHTRED"Sorry, that name is too short, please change it.");
                    
SetTimerEx("GettingKicked"2000false"i"playerid);
                    return 
1;
            }
            
Encrypt(tmppass);
            
OnPlayerLogin(playerid,tmppass);
        }
        else
        {
            
DisplayDialogForPlayer(playerid1); //login
        
}
    } 
Registration:

PHP код:
    if(dialogid == 2//REGISTER
    
{
        if(
gPlayerLogged[playerid] == 1)
        {
            
ClearChatbox(playerid100);
            
SendClientMessage(playeridCOLOR_WHITE"SERVER: You are already logged in.");
            return 
1;
        }
        if(
response)
        {
            if(
strlen(inputtext) >= 50)
            {
                
DisplayDialogForPlayer(playerid2); //register
                
ClearChatbox(playerid100);
                
SendClientMessage(playeridCOLOR_WHITE"SERVER: Password is too long.");
                return 
0;
            }
            new 
sendername[MAX_PLAYER_NAME];
            
GetPlayerName(playeridsendernamesizeof(sendername));
            new 
namestring strfind(sendername"_"true);
            if(
namestring == -1)
            {
                
SendClientMessage(playeridCOLOR_YELLOW"Your name must be in the Firstname_Lastname format. Please relog with a name such as John_Doe.");
                
SetTimerEx("GettingKicked"2000false"i"playerid);
                return 
1;
            }
            if(
strlen(sendername) == 6)
            {
                    
SendClientMessage(playeridCOLOR_LIGHTRED"Sorry, that name is too short, please change it.");
                    
SetTimerEx("GettingKicked"2000false"i"playerid);
                    return 
1;
            }
            else
            {
                if(!
strlen(inputtext))
                {
                    
DisplayDialogForPlayer(playerid2); //register
                    
SendClientMessage(playeridCOLOR_WHITE"SERVER: You must enter a password.");
                    return 
1;
                }
                
format(stringsizeof(string), "Users/%s.ini"sendername);
                if(
dini_Exists(string))
                   
//if(fexist(string))
                
{
                    
DisplayDialogForPlayer(playerid1); //login
                       
SendClientMessage(playeridCOLOR_LIGHTRED"This name is already taken. Please proceed to login.");
                    return 
0;
                }
                new 
tmppass[64];
                
strmid(tmppassinputtext0strlen(inputtext), 255);
                
Encrypt(tmppass);
                
PlayAudioStreamForPlayer(playerid,"hidden");
                
ClearChatbox(playerid100);
                
//FadeColorForPlayer(playerid,0,0,0,255,0,0,0,0,15,0);
                
OnPlayerRegister(playerid,tmppass);
                
OnPlayerLogin(playerid,tmppass);
                
//SendClientMessage(playerid, COLOR_YELLOW, "Account registered, you have been logged in automatically.");
            
}
        }
        else
        {
            
DisplayDialogForPlayer(playerid2); //register
        
}
    } 
After reviewing the codes, I couldn't fix the problem. The registering dialog still appears before the login dialog.
Reply


Messages In This Thread
Login Help - by Michael B - 17.05.2015, 14:12
Re: Login Help - by Smileys - 17.05.2015, 14:37
Re: Login Help - by Michael B - 17.05.2015, 14:51
Re: Login Help - by Smileys - 17.05.2015, 15:03
Re: Login Help - by Jefff - 17.05.2015, 15:09
Re: Login Help - by Michael B - 17.05.2015, 15:36
Re: Login Help - by Konstantinos - 17.05.2015, 15:39
Re: Login Help - by FernandoLight - 17.05.2015, 15:42
Re: Login Help - by Michael B - 17.05.2015, 15:57
Re: Login Help - by FernandoLight - 17.05.2015, 16:50

Forum Jump:


Users browsing this thread: 3 Guest(s)