Register dialog problem
#1

The problem is that the two messages TXT_WrongPassword and TXT_PlayerMustRegister aren't showed when needed, does anyone know how to solve this? And if I just press enter while registering he will save a blank space for the password.


PHP код:
Dialog_Register(playeridresponseinputtext[])
{
    new 
file[100], Name[MAX_PLAYER_NAME]; // Setup local variables
    
GetPlayerName(playeridNamesizeof(Name)); // Get the playername
    
format(filesizeof(file), PlayerFileName); // Construct the complete filename for this player's account
    
switch (response// Check which button was clicked
    
{
        case 
1// Player clicked "Register"
        
{
            
// Check if the player entered a password
            
if(strlen(inputtext)>0)
            {
                
// Store the password
                
format(APlayerData[playerid][PlayerPassword], 50"%s"inputtext);
                
// Create the file and save default data to it, then reload it (so all data is put into the correct place)
                
PlayerFile_Create(playerid);
                
PlayerFile_Load(playerid);
                
// Send a message to the client to inform him that his account has been registered
                
SendClientMessage(playerid0xFFFFFFFFTXT_AccountRegistered);
                
APlayerData[playerid][LoggedIn] = true// The player has logged in properly
                /*
                new Msg[2000];
                format(Msg, 2000, "%s{FFFF80}Cestovni Radnik\n", Msg);
                format(Msg, 2000, "%s{695500}Diler\n", Msg);
                format(Msg, 2000, "%s{FF9966}Farmer\n", Msg);
                format(Msg, 2000, "%s{FF8000}Kamiondzija\n", Msg);
                format(Msg, 2000, "%s{FF0080}Kurir\n", Msg);
                format(Msg, 2000, "%s{00FF99}Bolnicar\n", Msg);
                format(Msg, 2000, "%s{8000FF}Mafijas\n", Msg);
                format(Msg, 2000, "%s{80FF00}Mehanicar\n", Msg);
                format(Msg, 2000, "%s{008080}Pilot\n", Msg);
                format(Msg, 2000, "%s{0000FF}Policajac\n", Msg);
                format(Msg, 2000, "%s{AAFFFF}Ribar\n", Msg);
                format(Msg, 2000, "%s{9999FF}Slasticar\n", Msg);
                format(Msg, 2000, "%s{66FF66}Smetlar\n", Msg);
                format(Msg, 2000, "%s{707090}Taxista\n", Msg);
                format(Msg, 2000, "%s{156B18}Vojnik\n", Msg);
                format(Msg, 2000, "%s{80FFFF}Vozac Autobusa\n", Msg);
                format(Msg, 2000, "%s{80FFFF}Sumar\n", Msg);
                format(Msg, 2000, "%s{80FFFF}Kosac trave\n\r", Msg);
                // Show a dialog that shows the rules
                ShowPlayerDialog(playerid, DialogKlasa, DIALOG_STYLE_LIST, "Odaberi klasu", Msg, "Uzmi", "Izlaz");*/
                
                
        
            
}
            else
            {
                
SendClientMessage(playerid0xFFFFFFFFTXT_WrongPassword);
                
Kick(playerid);
            }
        }
        case 
0// Player clicked "Cancel"
        
{
            
// Show a message that the player must be registered to play on this server
            
SendClientMessage(playerid0xFFFFFFFFTXT_PlayerMustRegister);
            
// Kick the player
            
Kick(playerid);
        }
    }
    return 
1;

Reply
#2

Quote:

As of SA-MP 0.3x, any action taken directly before Kick() (such as sending a message with SendClientMessage) will not reach the player. A timer must be used to delay the kick.

Kick(playerid); will get called first no matter what, so you need to add a delay (timer) to kicking the player so that the message shows before it kicks the player.
Reply
#3

How do I do that?
Reply
#4

Код:
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
    Kick(playerid);
    return 1;
}
Then you replace any instance of Kick(playerid); with
Код:
SetTimerEx("KickPlayer", 500, false, "i", playerid);
 //500 can be replaced with any interval (uses milliseconds, so 1 second would be 1000)
Reply
#5

Much thanks my friend!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)