04.10.2017, 19:03
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(playerid, response, inputtext[])
{
new file[100], Name[MAX_PLAYER_NAME]; // Setup local variables
GetPlayerName(playerid, Name, sizeof(Name)); // Get the playername
format(file, sizeof(file), PlayerFile, Name); // 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(playerid, 0xFFFFFFFF, TXT_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(playerid, 0xFFFFFFFF, TXT_WrongPassword);
Kick(playerid);
}
}
case 0: // Player clicked "Cancel"
{
// Show a message that the player must be registered to play on this server
SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustRegister);
// Kick the player
Kick(playerid);
}
}
return 1;
}