01.01.2012, 22:49
(
Last edited by kurta999; 08/01/2012 at 11:25 AM.
)
When you kick the player in OnPlayerConnect() then player will reconnect to your server after 4-5 seconds.
Please do something with this.
Thanks!
This is very big problem for those servers, that use own ban system.
Edit: Not in OnPlayerConnect(), after OnPlayerConnect().
( SetTimerEx("KickPlayer", 1000, false, "d", playerid); // in OnPlayerConnect() )
Here the code:
Please do something with this.
Thanks!
This is very big problem for those servers, that use own ban system.
Edit: Not in OnPlayerConnect(), after OnPlayerConnect().
( SetTimerEx("KickPlayer", 1000, false, "d", playerid); // in OnPlayerConnect() )
Here the code:
pawn Code:
OnPlayerConnect:
// Autologin
format(query, sizeof(query), "SELECT * FROM `players` WHERE `name` = '%s' AND `ip` = '%s'", pName(playerid), ip);
mysql_query_ex(query);
mysql_store_result();
//printf("Autologin2");
if(mysql_num_rows() != 0)
{
// print("Try To Login OnPlayerConnect");
new
CurrLine[1024];
mysql_fetch_row(CurrLine);
mysql_free_result();
sscanf(CurrLine, "p<|>d{s[24]s[128]s[20]s[20]s[128]s[24]s[24]dddddddddddddddfffddffffddddffdddddd}", PlayerInfo[playerid][pRegID]);
format(query, sizeof(query), "SELECT * FROM `bans` WHERE `reg_id` = %d OR `ip` = '%s'", PlayerInfo[playerid][pRegID], ip);
mysql_query_ex(query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
new
ban_time,
ban_id,
bool:Elfogadva = true;
mysql_fetch_row(line);
mysql_free_result();
sscanf(line, "p<|>ds[24]ds[24]d{s[16]s[128]}s[128]s[24]d", ban_id, name, vID, country, player1, query, tmp, ban_time);
if(ban_time != 0)
{
getdate(year, month, day);
gettime(hour, minute, second);
datez = mktime(hour, minute, second, day, month, year);
if(ban_time < datez)
{
SendClientMessage(playerid, COLOR_WHITE, "Ban ideje letelt! Unbannolva vagy!");
Elfogadva = false;
format(query, sizeof(query), "DELETE FROM `bans` WHERE `id` = %d", ban_id);
mysql_query_ex(query);
}
}
if(Elfogadva)
{
date(ban_time, day, month, year, hour, minute, second);
for(i = 0; i < 10; i++) SendClientMessage(playerid, COLOR_YELLOW, " ");
// print("Nem fut le more");
SendClientMessage(playerid, COLOR_WHITE, ":: {" #XCOLOR_RED "}BAN {" #XCOLOR_WHITE "}:: Bannolt: {" #XCOLOR_ORANGE "}%s. RegID: %d", country, player1);
SendClientMessage(playerid, COLOR_WHITE, ":: {" #XCOLOR_RED "}BAN {" #XCOLOR_WHITE "}:: Indok: %s", query);
SendClientMessage(playerid, COLOR_WHITE, ":: {" #XCOLOR_RED "}BAN {" #XCOLOR_WHITE "}:: Időpont: %s", tmp);
if(!ban_time)
{
SendClientMessage(playerid, COLOR_WHITE, ":: {" #XCOLOR_RED "}BAN {" #XCOLOR_WHITE "}:: Ban feloldбsa: SOHA ( Kivйve ha nemkйrsz UnBan-t )");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, ":: {" #XCOLOR_RED "}BAN {" #XCOLOR_WHITE "}:: Ban feloldбsa: %02d.%02d.%02d %02d:%02d:%02d", year, month, day, hour, minute, second);
}
printf("Banned 1");
SendClientMessage(playerid, COLOR_WHITE, ":: {" #XCOLOR_RED "}BAN :: UnBan kйrelem: http://www.nm-ss.tarhely.biz -> Unban Kйrelem -> Ide nyitsz egy tйmбt!");
SendClientMessageToAll(COLOR_WHITE, ":: {" #XCOLOR_DEFAULT "}BAN :: {" #XCOLOR_YELLOW "}%s(%d) {" #XCOLOR_WHITE "}kickelve lett, mivel bannolva van a szerverről! (BanID: %d)", pName(playerid), playerid, ban_id);
SetTimerEx("KickPlayer", 1000, false, "d", playerid);
return 1;
}
}
else
{
mysql_free_result();
}
LoginPlayer(playerid, CurrLine);
//print("Lefutott, Very nice :)");
switch(GetPVarInt(playerid, "Level"))
{
case 0: country = "~w~Jбtйkos";
case 1: country = "~b~Moderбtor";
case 2: country = "~g~Adminisztrбtor";
case 3: country = "~y~Főadmin";
case 4: country = "~r~Tulajdonos";
}
// print("After InfoTD");
}
else
{
// print("Else free_result");
mysql_free_result();
}
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
return Kick(playerid);
}