Поиск братья форумчане подмогите не могу найти хороший пинг кикер

Статус
В этой теме нельзя размещать новые ответы.

Xaxol

Только чтение
Заблокированные
Пользователь
Регистрация
7 Июл 2017
Сообщения
25
Симпатии
0
Предупреждения
200
Пол
Мужской
цветной
[doublepost=1502444383][/doublepost]зарание спасибо
 

Izmayl7

Пользователь
Регистрация
9 Июн 2017
Сообщения
527
Симпатии
103
Пол
Мужской
цветной
[doublepost=1502444383][/doublepost]зарание спасибо
Код:
// *************************************************************************************//
// Плагин загружен с  www.neugomon.ru                                                   //
// Автор: Neygomon  [ https://neugomon.ru/members/1/ ]                                  //
// Официальная тема поддержки: https://neugomon.ru/threads/5/                           //
// При копировании материала ссылка на сайт www.neugomon.ru ОБЯЗАТЕЛЬНА!                //
// *************************************************************************************//

#include <amxmodx>

#define ACCESS_LEVEL_IMMUNITY     (ADMIN_MENU|ADMIN_LEVEL_H)     // Уровень доступа позволяющий пропускать проверку на пинг.
#define MAX_ALLOWED_PING     100                 // Максимально допустимый пинг, превышение этого значения выкидывает игрока с сервера.
#define MAX_FLUX        30            // Максимальные скачки пинга, если привышение то выкидывает с сервера
#define MAX_ALLOWED_LOSS     20             // Максимально допустимая потеря пакетов loss, превышение этого значения выкидывает игрока с сервера.
#define MAX_WARNING_CHECK     5            // Количество предупреждений после которых последует наказание.
#define INTERVAL_CHECK         10.0             // Интервал между проверками, чем меньше значение, тем больше нагрузка на сервер.
#define CHECK_COUNT         MAX_WARNING_CHECK + 3     // Количество проверок определенного игрока ( снижаем и без того маленькую нагрузку xD )

#define is_immunity(%0) ((get_user_flags(%0) & ACCESS_LEVEL_IMMUNITY) || is_user_bot(%0) || is_user_hltv(%0))

#define    get_bit(%1,%2)    (%1 & (1 << (%2 & 31)))
#define    set_bit(%1,%2)    %1 |= (1 << (%2 & 31))
#define    clr_bit(%1,%2)    %1 &= ~(1 << (%2 & 31))

new g_iWarning[33], g_iCountCheck[33], g_iLastPing[33], g_iBitValid;

public plugin_init()
{
    register_plugin("Ping Control", "1.31", "neygomon");
    set_task(INTERVAL_CHECK, "PingCheck", .flags = "b");
}

public client_putinserver(id)
{
    if(is_immunity(id)) return;
    set_bit(g_iBitValid, id);
    g_iWarning[id] = g_iCountCheck[id] = 0;
}

public client_disconnect(id)
    clr_bit(g_iBitValid, id);

public PingCheck()
{
    static i, iPing, iLoss, players[32], pcount;
    get_players(players, pcount, "ch")
  
    for(i=0; i < pcount; i++)
    {
        if(!get_bit(g_iBitValid, players[i])) continue;
        if(++g_iCountCheck[players[i]] < CHECK_COUNT)
        {
            get_user_ping(players[i], iPing, iLoss)
          
            if(iPing >= MAX_ALLOWED_PING || iLoss > MAX_ALLOWED_LOSS || abs(iPing - g_iLastPing[players[i]]) > MAX_FLUX)
            {
                if(++g_iWarning[players[i]] >= MAX_WARNING_CHECK)
                {                 
                    static name[32]; get_user_name(players[i], name, charsmax(name));
                    ChatColor("^1[^4PingControl^1] ^3%s ^1был удален с сервера за плохое соединение!", name);
                    server_cmd("kick #%d ^"Вы были кикнуты из-за плохого соединения^"", get_user_userid(players[i]));
                }
            }
            else if(g_iWarning[players[i]]) g_iWarning[players[i]]--;
            g_iLastPing[players[i]] = iPing; 
        }
    }
}

stock ChatColor(const szMessage[], any:...)
{
    static pnum, players[32], szMsg[190], IdMsg;
    vformat(szMsg, charsmax(szMsg), szMessage, 2);
  
    if(!IdMsg) IdMsg = get_user_msgid("SayText");
  
    get_players(players, pnum, "ch");
  
    for(new i; i < pnum; i++)
    {
        message_begin(MSG_ONE, IdMsg, .player = players[i]);
        write_byte(players[i]);
        write_string(szMsg);
        message_end();
    }
}
Код:
/*    AMX Mod script

    Better High Ping Kicker
    This file is provided as is (no warranties).

    This is mainly a modification of HPK by DynAstY.
    Thanks to all other HPK authors (OLO, DynAstY, shadow, EKS) - your plugins provided the base.

    Features:
        Players with immunity and slot reservations won't be checked.
        At night max ping defined by different CVAR (so usually it will be higher).
        By default keeps min 3 players (bots and hltv are not included) at server if they are not exceed night max ping twice.
        Player is banned for 1 minute, not just simply kicked.

    CVARs (Supplied values are defaults):
        hpk_ping_max 175 ; maximim ping to check for at day time
        hpk_ping_max_night 300 ; maximim ping to check for at night time
        hpk_ping_time 10 ; interval at which ping will be checked
        hpk_ping_tests 5 ; number of violations of maximum ping at which to kick
        hpk_min_players 3 ; don't kick player if there is this count or less players (bots and hltv are not included) at server and player's ping doesn't exceed night ping twice.
        hpk_night_start_hour 3 ; night period start hour (hour included)
        hpk_night_end_hour 9 ; night period end hour (hour excluded)

    How it is different from other HPK plugins:
        using pointers to CVARs;
        code flow is optimized;
        there is night period when ping defined by different CVAR, period also defined by CVARs;
        changes to max pings applies immediately;
        immunity for admins and slot reservations players;
        keeps min players at server (count defined by CVAR) if their ping is not too high (double night max ping);

    ChangeLog:
        v2.4 [2009.03.01]
            Initial release.
        v2.5 [2009.10.02]
            ! Change: bots and hltv are now excluded from players count for comparision with hpk_min_players.
        v2.6 [2009.10.10]
            ! Change: changed from ban ID to ban IP.
*/

#pragma semicolon 1
#pragma ctrlchar '\'

#include <amxmodx>
#include <amxmisc>

#define AUTHOR "Lev"
#define PLUGIN "Better High Ping Kicker"
#define VERSION "2.6"
#define VERSION_CVAR "bhpk_version"

#define ALWAYS_KICK_MULTIPLIER 2        // Player will be kicked even there is less then or equal min_players if player's ping exceed night max ping by this factor.
#define DELAY_BEFORE_START_TESTING 20.0    // Delay before showing warning and start ping checking. Real testing starts after hpk_ping_time also passed.

const TASK_ID_BASE = 52635;    // random number

const min_hpk_ping_max = 10;
const min_hpk_ping_time = 10;
const min_hpk_ping_tests = 4;

new pcvar_hpk_ping_max;
new pcvar_hpk_ping_max_night;
new pcvar_hpk_ping_time;
new pcvar_hpk_ping_tests;
new pcvar_hpk_min_players;
new pcvar_hpk_night_start_hour;
new pcvar_hpk_night_end_hour;

new ping_violations[33];

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_cvar(VERSION_CVAR, VERSION, FCVAR_SERVER);

    pcvar_hpk_ping_max = register_cvar("hpk_ping_max", "175");
    pcvar_hpk_ping_max_night = register_cvar("hpk_ping_max_night", "250");
    pcvar_hpk_ping_time = register_cvar("hpk_ping_time", "7");
    pcvar_hpk_ping_tests = register_cvar("hpk_ping_tests", "3");
    pcvar_hpk_min_players = register_cvar("hpk_min_players", "3");
    pcvar_hpk_night_start_hour = register_cvar("hpk_night_start_hour", "3");
    pcvar_hpk_night_end_hour = register_cvar("hpk_night_end_hour", "9");
}
   
public client_putinserver(plrid)
{
    ping_violations[plrid] = 0;
    if (!is_user_bot(plrid) && !is_user_hltv(plrid))
        set_task(DELAY_BEFORE_START_TESTING, "showInfo", TASK_ID_BASE + plrid);
    return PLUGIN_CONTINUE;
}

public client_infochanged(plrid)
{
    remove_task(TASK_ID_BASE + plrid);
    if (!is_user_bot(plrid) && !is_user_hltv(plrid))
        set_task(DELAY_BEFORE_START_TESTING, "showInfo", TASK_ID_BASE + plrid);
    return PLUGIN_CONTINUE;
}

public client_disconnect(plrid)
{
    remove_task(TASK_ID_BASE + plrid);
    return PLUGIN_CONTINUE;
}

public showInfo(taskid)
{
    new plrid = taskid - TASK_ID_BASE;
    if (access(plrid, ADMIN_IMMUNITY) || access(plrid, ADMIN_RESERVATION))
        client_print(plrid, print_chat, "[Сервер] Проверка пинга отключена благодаря иммунитету...");
    else
    {
        client_print(plrid, print_chat, "[Сервер] Игроки с пингом выше чем %dед. будут кикнутыы!", get_hpk_ping_max());
        set_task(float(get_hpk_ping_time()), "checkPing", TASK_ID_BASE + plrid, _, _, "b");
    }
    return PLUGIN_CONTINUE;
}

public checkPing(taskid)
{
    new plrid = taskid - TASK_ID_BASE;
    new ping, loss;

    get_user_ping(plrid, ping, loss);

    if (ping > get_hpk_ping_max()) ping_violations[plrid]++;
    else if (ping_violations[plrid] > 0) ping_violations[plrid]--;

    new hpk_ping_tests = get_hpk_ping_tests();
    if (ping_violations[plrid] >= hpk_ping_tests)
    {
        static players[32];
        new playerCount;
        get_players(players, playerCount, "ch");
        // Allow player to stay if there is less or equal than 'min_players' players and player ping is not too high.
        if (playerCount <= get_pcvar_num(pcvar_hpk_min_players) &&
            ping < get_pcvar_num(pcvar_hpk_ping_max_night) * ALWAYS_KICK_MULTIPLIER)
        {
            ping_violations[plrid] = hpk_ping_tests;
            return PLUGIN_CONTINUE;
        }
        kickPlayer(plrid);
    }

    return PLUGIN_CONTINUE;
}

kickPlayer(plrid)
{
    new name[33], ip[15];
    get_user_name(plrid, name, sizeof(name) - 1);
    get_user_ip(plrid, ip, charsmax(ip), 1);

    client_cmd(plrid, "echo \"[Сервер] Извините но у вас слишком большой пинг, попробуйте зайти позже...\"; disconnect");
    server_cmd("addip 1 %s", ip);
    client_print(0, print_chat, "[Сервер] %s был отсоединен из за большого пинга!", name);
    return PLUGIN_CONTINUE;
}

get_hpk_ping_max()
{
    new ping_max;
    new hour, minute, second;

    time(hour, minute, second);

    // At night we use different CVAR
    if (hour >= get_pcvar_num(pcvar_hpk_night_start_hour) &&
        hour < get_pcvar_num(pcvar_hpk_night_end_hour))
        ping_max = get_pcvar_num(pcvar_hpk_ping_max_night);
    else
        ping_max = get_pcvar_num(pcvar_hpk_ping_max);
    // Check to be no less then minimum value
    if (ping_max < min_hpk_ping_max) return min_hpk_ping_max;
    return ping_max;
}
get_hpk_ping_time()
{
    new time = get_pcvar_num(pcvar_hpk_ping_time);
    // Check to be no less then minimum value
    if (time < min_hpk_ping_time) return min_hpk_ping_time;
    return time;
}
get_hpk_ping_tests()
{
    new tests = get_pcvar_num(pcvar_hpk_ping_tests);
    // Check to be no less then minimum value
    if (tests < min_hpk_ping_tests) return min_hpk_ping_tests;
    return tests;
}
 
Последнее редактирование:
  • Мне нравится
Симпатии: Xaxol

Xaxol

Только чтение
Заблокированные
Пользователь
Регистрация
7 Июл 2017
Сообщения
25
Симпатии
0
Предупреждения
200
Пол
Мужской
Izmayl7, спасибл бро
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу