Here's my version.
pawn Код:
new LWarns[MAX_PLAYERS]; //Above all code, short for "LoginWarns"
/*blablablablablablablablblblbl OnDialogResponse blablblablblablbalbalabllb*/
case DIALOG_LOGIN:
{
if ( !response ) Kick ( playerid );
else
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
PlayerInfo[playerid][pLoggedIn] = 1;
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Success!","You have successfully logged in!","Ok","");
//stuff here
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FFFFFF}You have entered an {FF9933}incorrect {FFFFFF}password.\nType your password below to login.","Login","Quit");
LWarns{ playerid }++; //Increases
if(LWarns{ playerid } == 1) //If he has failed 1x, he gets vvvv message
{
SendClientMessage(playerid, COLOR_ORANGE, "* Two more invalid logins and you will be kicked!");
}
if(LWarns{ playerid } == 2) //If he has failed 2x, he gets vvvvv message
{
SendClientMessage(playerid, COLOR_RED, "* One more invalid login and you will be kicked!");
}
if(LWarns{ playerid } == 3) //If he has failed 3x, he gets kicked.
{
new string[74], pName[MAX_PLAYERS];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
SendClientMessage(playerid, COLOR_RED, "* You've been kicked for multiple failed logins!");
SetTimerEx("KickTimer", 150, false, "i", playerid);
}
}
}
}
/*blablablblablblablblbl Kicktimer bblalablablblbl*/
forward KickTimer(playerid);
public KickTimer(playerid)
{
Kick(playerid);
return 1;
}