pawn Код:
Dialog_Login(playerid, response, inputtext[])
{
switch (response)
{
case 1:
{
if (strlen(inputtext) > 0)
{
if (!strcmp(APlayerData[playerid][PlayerPassword], inputtext))
{
APlayerData[playerid][LoggedIn] = true;
new string[128];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "{00FF00}%s {FFFF00}(id %d) has joined GranTrucking", pname,playerid);
SendClientMessageToAll(0xAFAFAFAA, string);
if (APlayerData[playerid][LoggedIn] == false)
{
SendClientMessage(playerid, 0xFFFFFFFF, TXT_FailedLoginProperly);
Kick(playerid);
}
if (GetPVarInt(playerid, "PVarMoney") != 0)
{
APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] + GetPVarInt(playerid, "PVarMoney");
SetPVarInt(playerid, "PVarMoney", 0);
}
if (GetPVarInt(playerid, "PVarScore") != 0)
{
APlayerData[playerid][PlayerScore] = APlayerData[playerid][PlayerScore] + GetPVarInt(playerid, "PVarScore");
SetPVarInt(playerid, "PVarScore", 0);
}
if (APlayerData[playerid][PlayerLevel] >= 1)
{
new Msg[128], Name[24];
format(Msg, 128, "{FFFF00}Logged in as {00FF00}Admin", Name);
SendClientMessage(playerid, 0xFFFFFFAA, Msg);
}
}
else
{
new string[128];
FailLogin[playerid]++;
format(string, sizeof(string), "{FF0000}Wrong password! %i/3", FailLogin[playerid]);
ShowPlayerDialog(playerid,DialogLogin, DIALOG_STYLE_PASSWORD, "Login",string,"Login","Cancel");
}
}
else
{
FailLogin[playerid]++;
}
if(FailLogin[playerid] == MAX_FAIL_LOGINS)
{
new pname[MAX_PLAYER_NAME];
SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
GetPlayerName(playerid, pname, sizeof(pname));
new string[128];
format(string, sizeof(string), "SERVER KICK: %s has been kicked from the server - Reason: Failed to login", pname);
SendClientMessageToAll(-1, string);
printf("SERVER KICK: %s has been kicked from the server - Reason: Failed to login", pname);
SetTimerEx("KickPlayer", 500, false, "i", playerid);
}
}
case 0:
{
SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustLogin);
Kick(playerid);
}
}
return 1;
}