#include <amxmodx>
#include <reapi>
#if AMXX_VERSION_NUM < 183
#define client_disconnected client_disconnect
#endif
#define KILL_LIMIT 3 // количество убийств тиммейтов, которые надо совершить для бана!
#define TIME_BAN 1440 // время бана
#define LOGS // если включено, то будут записи в логах о банах :)
#define BOTS // поддержка ботов (их можно будет убивать, при надобности)
new const REASON[] = "TEAM_KILLER";
new tk_count[33];
public plugin_init()
{
register_plugin("Banned for TeamKilling", "1.0", "ThePhoenix");
RegisterHookChain(RG_CBasePlayer_Killed, "@CBasePlayer__Killed_Post", true);
}
public client_putinserver(id)
tk_count[id] = 0;
public client_disconnected(id)
tk_count[id] = 0;
@CBasePlayer__Killed_Post(iVictim, iAttacker, iGib)
{
if (iVictim == iAttacker)
return;
#if defined BOTS
if(is_user_connected(iAttacker) && is_user_connected(iVictim) && !is_user_bot(iVictim) && !is_user_bot(iAttacker) && get_member(iVictim, m_iTeam) == get_member(iAttacker, m_iTeam))
{
tk_count[iAttacker]++;
client_print_color(iAttacker, print_team_default, "^1[^4ALERT^1] Don't kill your mates or you will banned!");
}
#else
if(is_user_connected(iAttacker) && is_user_connected(iVictim) && get_member(iVictim, m_iTeam) == get_member(iAttacker, m_iTeam))
{
tk_count[iAttacker]++;
client_print_color(iAttacker, print_team_default, "^1[^4ALERT^1] Don't kill your mates or you will banned!");
}
#endif
if(tk_count[iAttacker] >= KILL_LIMIT)
server_cmd("amx_ban %d #%d %s", TIME_BAN, get_user_userid(iAttacker), REASON);
#if defined LOGS
new szAddress[17], szName[32], szSteam[33];
get_user_name(iAttacker, szName, charsmax(szName));
get_user_ip(iAttacker, szAddress, charsmax(szAddress), 1);
get_user_authid(iAttacker, szSteam, charsmax(szSteam));
log_amx("Игрок %s [%d] [%d] забанен на %d за %s", szName, szAddress, szSteam, TIME_BAN, REASON);
#endif
return;
}