case DIALOG_LOGIN:
{
if (!response)
return Kick(playerid);
else // Pressed ENTER or clicked 'Login' button
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
if(PlayerInfo[playerid][pTutorialDone] == 0) return SetTimerEx("AgeSetup", 1000, false, "i", playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetSpawnInfo(playerid, 0, 26, -2210.7092,-2450.5549,30.4495, 52.1403, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
LoadFightingStyle(playerid);
FadeColorForPlayer(playerid,0,0,0,255,0,0,0,0,15,0);
SCM(playerid, COLOR_WHITE, "You have successfully logged in.");
TogglePlayerSpectating(playerid, false);
PlayerLogged[playerid] = true;
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
new playername[24];
GetPlayerName(playerid, playername, sizeof(playername));
for(new i=1; i < MAX_DVEHICLES; i++)
{
if(VehicleCreated[i] == VEHICLE_PLAYER && strcmp(VehicleOwner[i], playername) == 0)
{
UpdateVehicle(i, 0);
}
}
if(PlayerInfo[playerid][pBanned] == 1)
{
SCM(playerid, COLOR_LIGHTRED, "AdmCmd: You have been banned for logging into a banned account.");
SetTimerEx("UnsetBan", 500, 0, "i", playerid);
}
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\n""Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
#define DIALOG_LOGIN /*the number here*/
if (response)
{
//...
}else Kick(playerid);
So, I need my player to get kicked if he clicks the cancel button while on the login screen. Nothing happens.
My code: pawn Код:
|
case DIALOG_LOGIN:
{
if (!response) { Kick(playerid); } //Kicked!!!!!
else // Pressed ENTER or clicked 'Login' button
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","Welcome back to New Jersey Roleplay, please type in your password to log in.\nYou have 60 seconds to log in before you kicked.","Login","Quit");
forward login_dialog(playerid);
public login_dialog(playerid)
{
SetTimerEx("LoginTimer", 60000, false, "i", playerid);
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
SetPlayerCameraPos(playerid, -2193.8313,-2481.8018,56.6954);
SetPlayerCameraLookAt(playerid, -2148.7173,-2415.4434,55.6071);
for( new i = 0; i <= 100; i ++ ) SCM(playerid, -1, "" );
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","Welcome back to New Jersey Roleplay, please type in your password to log in.\nYou have 60 seconds to log in before you kicked.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Register","Welcome to New Jersey Roleplay.\nTo register an account please type in your desired password below.","Register","Quit");
}
return 1;
}
case DIALOG_LOGIN:
{
if (!response)
{
Kick(playerid);
return 1;
}
if(response) // Pressed ENTER or clicked 'Login' button
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
printf("Loading player stats..");
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
if(PlayerInfo[playerid][pTutorialDone] == 0) return SetTimerEx("AgeSetup", 1000, false, "i", playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetSpawnInfo(playerid, 0, 26, -2210.7092,-2450.5549,30.4495, 52.1403, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
LoadFightingStyle(playerid);
FadeColorForPlayer(playerid,0,0,0,255,0,0,0,0,15,0);
SCM(playerid, COLOR_WHITE, "You have successfully logged in.");
TogglePlayerSpectating(playerid, false);
PlayerLogged[playerid] = true;
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
new playername[24];
GetPlayerName(playerid, playername, sizeof(playername));
for(new i=1; i < MAX_DVEHICLES; i++)
{
if(VehicleCreated[i] == VEHICLE_PLAYER && strcmp(VehicleOwner[i], playername) == 0)
{
UpdateVehicle(i, 0);
}
}
if(PlayerInfo[playerid][pBanned] == 1)
{
SCM(playerid, COLOR_LIGHTRED, "AdmCmd: You have been banned for logging into a banned account.");
SetTimerEx("UnsetBan", 500, 0, "i", playerid);
}
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\n""Type your password below to login.","Login","Quit");
}
return 1;
}
}
}