Ultimate Leader

reapi Ultimate Leader 2.1

Нет прав для скачивания
Версия Дата выхода Скачиваний Оценка
2.1 160 0.00 звёзд 0 оценок
2.0(stable) 13 0.00 звёзд 0 оценок
2.0(stable) 5 0.00 звёзд 0 оценок
2.0(stable) 10 0.00 звёзд 0 оценок
2.0 12 0.00 звёзд 0 оценок
2.0 8 0.00 звёзд 0 оценок
  • Оптимизация
  • Косметические изменения
Код:
/*

|----[Связь с автором]----|
|VK:         vk.com/nunfy  |
|TELEGRAM:    t.me/Nunfy    |
|-------------------------|

*/
#include <amxmodx>
#include <reapi>

+#define is_client(%0) (1 <= %0 <= MaxClients)

-new const VERSION[] =             "2.0(stable)";
+new const VERSION[] =             "2.1";

const MAX_MODELS =                 1;                                         // Максимальное количество моделей

new const model_path[8][MAX_MODELS][] =
{
    {    // terror
        "models/player/terror_leader/terror_leader.mdl",
    },
    {     // leet
        "models/player/leet_leader/leet_leader.mdl",
    },
    {     // arctic
        "models/player/arctic_leader/arctic_leader.mdl",
    },
    {     // guerilla
        "models/player/guerilla_leader/guerilla_leader.mdl",
    },
    {    // urban
        "models/player/urban_leader/urban_leader.mdl",
    },
    {    // gsg9
        "models/player/gsg9_leader/gsg9_leader.mdl",
    },
    {    // sas
        "models/player/sas_leader/sas_leader.mdl",
    },
    {    // gign
        "models/player/gign_leader/gign_leader.mdl"
    }
};

new const default_model[8][MAX_MODELS][] =
{
    {    // terror
        "terror",
    },
    {
        // leet
        "leet",
    },
    {
        // arctic
        "arctic",
    },
    {
        // guerilla
        "guerilla",
    },
    {
        // urban
        "urban",
    },
    {
        // gsg9
        "gsg9",
    },
    {
        // sas
        "sas",
    },
    {
        // gign
        "gign"
    }
};

new const custom_model[8][MAX_MODELS][] =
{
    {    // terror
        "terror_leader",
    },
    {
        // leet
        "leet_leader",
    },
    {
        // arctic
        "arctic_leader",
    },
    {
        // guerilla
        "guerilla_leader",
    },
    {
        // urban
        "urban_leader",
    },
    {
        // gsg9
        "gsg9_leader",
    },
    {
        // sas
        "sas_leader",
    },
    {
        // gign
        "gign_leader"
    }
};

enum cvar_data
{
    cvar_mode
}

enum
{
    dId,
    dKills,
    dDamage
}

enum user_data
{
    udModel,
    udKills,
    udDamage
};

enum leader_data
{
    ldId,
    ldKills,
    ldDamage,
    ldPast_id
};

new cd[cvar_data],
    ud[MAX_CLIENTS + 1][user_data],
    ld[leader_data];

-new max_users;

public plugin_init()
{
    register_plugin("Ultimate Leader", VERSION, "Nunf");
    register_dictionary("ultimate_leader.txt");
-    bind_pcvar_num(create_cvar("ul_mode", "0", FCVAR_NONE, fmt("%l", "CVAR_MODE_DISCRIPTION"), true, 0.0, true, 1.0), cd[cvar_mode]);
+    bind_pcvar_num(create_cvar("ul_mode", "0", FCVAR_NONE, fmt("%l", "UL_CVAR_MODE_DESCRIPTION"), true, 0.0, true, 1.0), cd[cvar_mode]);
    AutoExecConfig(true, "ultimate_leader");
-    max_users = get_maxplayers();
    RegisterHookChain(RG_HandleMenu_ChooseAppearance,             "user_choose_appearance",     true);
    RegisterHookChain(RG_CBasePlayer_Killed,                     "user_killed",                 true);
    RegisterHookChain(RG_CBasePlayer_TakeDamage,                 "user_take_damage",         true);
    RegisterHookChain(RG_RoundEnd,                                 "round_end",                 true);
    RegisterHookChain(RG_CBasePlayer_Spawn,                     "user_spawn",                 true);
    RegisterHookChain(RG_CBasePlayer_SetClientUserInfoModel,     "set_user_model",             false);
}

public plugin_cfg()
{
    cd[cvar_mode] = get_cvar_num("ul_mode");
}

public plugin_precache()
{
    for(new i; i < sizeof model_path; i++)
    {
        for(new n; n < MAX_MODELS; n++)
        {
            if(file_exists(model_path[i][n]))
            {
                precache_model(model_path[i][n]);
            }
            else
            {
                set_fail_state("^n\
                [ERROR]: FILE NOT EXISTS(array ^"model_path^")^n\
                [FILE PATH]: %s",
                model_path[i][n]);
            }
        }
    }
}

public client_disconnected(id, bool:drop, message[], maxlen)
{
    ud[id][udModel] = 0;
    ud[id][udKills] = 0;
    ud[id][udDamage] = 0;
    if(id == ld[ldId])
    {
        ld[ldId] = 0;
        ld[ldKills] = 0;
        ld[ldDamage] = 0;
    }
    else if(id == ld[ldPast_id])
    {
        ld[ldPast_id] = 0;
    }
}

public user_choose_appearance(const id, slot)
{
    switch(get_member(id, m_iModelName))
    {
        case MODEL_T_TERROR:
        {
            ud[id][udModel] = 0;
        }
        case MODEL_T_LEET:
        {
            ud[id][udModel] = 1;
        }
        case MODEL_T_ARCTIC:
        {
            ud[id][udModel] = 2;
        }
        case MODEL_T_GUERILLA:
        {
            ud[id][udModel] = 3;
        }
        case MODEL_CT_URBAN:
        {
            ud[id][udModel] = 4;
        }
        case MODEL_CT_GSG9:
        {
            ud[id][udModel] = 5;
        }
        case MODEL_CT_SAS:
        {
            ud[id][udModel] = 6;
        }
        case MODEL_CT_GIGN:
        {
            ud[id][udModel] = 7;
        }
    }
}

public user_killed(const id, attacker_id, iGib)
{
-    if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
+    if(is_client(attacker_id) && id != attacker_id)
    {
        ud[attacker_id][udKills]++;
    }
}

public user_take_damage(const id, pevInflictor, attacker_id, Float: damage, bitsDamageType)
{
-    if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
+    if(is_client(attacker_id) && id != attacker_id)
    {
        if(GetHookChainReturn(ATYPE_INTEGER) == 1)
        {
            ud[attacker_id][udDamage] += floatround(damage);
        }
        else if(get_member(attacker_id, m_iTeam) != get_member(attacker_id, m_iTeam))
        {
            ud[attacker_id][udDamage] += floatround(damage) + get_user_health(id);
        } 
    }
}

public round_end(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
{
    set_task(0.1, "task_round_end");
}

public user_spawn(id)
{
    if(id == ld[ldId])
    {
        rg_set_user_model(ld[ldId], custom_model[ud[id][udModel]][random(sizeof custom_model[])]);
    }
    else if(id == ld[ldPast_id])
    {
        rg_set_user_model(ld[ldId], default_model[ud[id][udModel]][random(sizeof default_model[])]);
    }
}

public set_user_model(id, infobuffer[], new_model[])
{
    if(id == ld[ldId])
    {
        SetHookChainArg(3, ATYPE_STRING, custom_model[ud[id][udModel]][random(sizeof custom_model[])]);
    }
    else if(id == ld[ldPast_id])
    {
        SetHookChainArg(3, ATYPE_STRING, default_model[ud[id][udModel]][random(sizeof default_model[])]);
    }
}

public task_round_end()
{
    new u_i[MAX_CLIENTS],
        u_n;
    get_players(u_i, u_n, "h");
    new data[3];
    data[dId] = u_i[0];
    data[dKills] = ud[u_i[0]][udKills];
    data[dDamage] = ud[u_i[0]][udDamage];
    ud[u_i[0]][udKills] = 0;
    ud[u_i[0]][udDamage] = 0;
    if(cd[cvar_mode] == 0)
    {
        for(new i = 1; i < u_n; i++)
        {
            if(ud[u_i[i]][udKills] > data[dKills] || ud[u_i[i]][udKills] == data[dKills] && ud[u_i[i]][udDamage] > data[dDamage])
            {
                data[dId] = u_i[i];
                data[dKills] = u_i[i];
                data[dDamage] = u_i[i];
            }
            ud[u_i[i]][udKills] = 0;
            ud[u_i[i]][udDamage] = 0;
        }
        if(data[dKills] > ld[ldKills] || data[dKills] == ld[ldKills] && data[dDamage] > ld[ldDamage])
        {
            if(data[dId] == ld[ldId])
            {
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                client_print_color(0, print_team_default, "%l", "LEADER_OUTDONE_HIMSELF", data[dId], data[dKills], data[dDamage]);
+                client_print_color(0, print_team_default, "%l", "UL_LEADER_OUTDONE_HIMSELF", data[dId], data[dKills], data[dDamage]);
            }
            else
            {
                ld[ldPast_id] = ld[ldId];
                ld[ldId] = data[dId];
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                client_print_color(0, print_team_default, "%l", "NEW_LEADER", data[dId], data[dKills], data[dDamage]);
+                client_print_color(0, print_team_default, "%l", "UL_NEW_LEADER", data[dId], data[dKills], data[dDamage]);
            }
        }
        else
        {
-            if(ld[ldId] < 1 || ld[ldId] > max_users)
-            {
-                client_print_color(0, print_team_default, "%l", "NO_LEADER");
-            }
-            else
-            {
-                client_print_color(0, print_team_default, "%l", "NOBODY_SUPPARSED_LEADER", ld[ldId]);
-            }
+            if(!is_client(ld[ldId]))
+            {
+                client_print_color(0, print_team_default, "%l", "UL_NO_LEADER");
+            }
+            else
+            {
+                client_print_color(0, print_team_default, "%l", "UL_NOBODY_SUPPARSED_LEADER", ld[ldId]);
+            }
        }
    }
    else
    {
        for(new i = 1; i < u_n; i++)
        {
            if(ud[u_i[i]][udDamage] > data[dDamage] || ud[u_i[i]][udDamage] == data[dDamage] && ud[u_i[i]][udKills] > data[dKills])
            {
                data[dId] = u_i[i];
                data[dKills] = u_i[i];
                data[dDamage] = u_i[i];
            }
            ud[u_i[i]][udKills] = 0;
            ud[u_i[i]][udDamage] = 0;
        }
        if(data[dDamage] > ld[ldDamage] || data[dDamage] == ld[ldDamage] && data[dKills] > ld[ldKills])
        {
            if(data[dId] == ld[ldId])
            {
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                client_print_color(0, print_team_default, "%l", "LEADER_OUTDONE_HIMSELF", data[dId], data[dKills], data[dDamage]);
+                client_print_color(0, print_team_default, "%l", "UL_LEADER_OUTDONE_HIMSELF", data[dId], data[dKills], data[dDamage]);
            }
            else
            {
                ld[ldPast_id] = ld[ldId];
                ld[ldId] = data[dId];
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                client_print_color(0, print_team_default, "%l", "NEW_LEADER", data[dId], data[dKills], data[dDamage]);
+                client_print_color(0, print_team_default, "%l", "UL_NEW_LEADER", data[dId], data[dKills], data[dDamage]);
            }
        }
        else
        {
-            if(ld[ldId] < 1 || ld[ldId] > max_users)
-            {
-                client_print_color(0, print_team_default, "%l", "NO_LEADER");
-            }
-            else
-            {
-                client_print_color(0, print_team_default, "%l", "NOBODY_SUPPARSED_LEADER", ld[ldId]);
-            }
+            if(!is_client(ld[ldId]))
+            {
+                client_print_color(0, print_team_default, "%l", "UL_NO_LEADER");
+            }
+            else
+            {
+                client_print_color(0, print_team_default, "%l", "UL_NOBODY_SUPPARSED_LEADER", ld[ldId]);
+            }
        }
    }
}
Не заметил ошибочку..
Код:
/*
|----[Связь с автором]----|
|VK:         vk.com/nunfy  |
|TELEGRAM:    t.me/Nunfy    |
|-------------------------|

*/
#include <amxmodx>
#include <reapi>

new const VERSION[] =             "2.0(stable)";

const MAX_MODELS =                 1;                                         // Максимальное количество моделей

new const model_path[8][MAX_MODELS][] =
{
    {    // terror
        "models/player/terror_leader/terror_leader.mdl",
    },
    {     // leet
        "models/player/leet_leader/leet_leader.mdl",
    },
    {     // arctic
        "models/player/arctic_leader/arctic_leader.mdl",
    },
    {     // guerilla
        "models/player/guerilla_leader/guerilla_leader.mdl",
    },
    {    // urban
        "models/player/urban_leader/urban_leader.mdl",
    },
    {    // gsg9
        "models/player/gsg9_leader/gsg9_leader.mdl",
    },
    {    // sas
        "models/player/sas_leader/sas_leader.mdl",
    },
    {    // gign
        "models/player/gign_leader/gign_leader.mdl"
    }
};

new const default_model[8][MAX_MODELS][] =
{
    {    // terror
        "terror",
    },
    {
        // leet
        "leet",
    },
    {
        // arctic
        "arctic",
    },
    {
        // guerilla
        "guerilla",
    },
    {
        // urban
        "urban",
    },
    {
        // gsg9
        "gsg9",
    },
    {
        // sas
        "sas",
    },
    {
        // gign
        "gign"
    }
};

new const custom_model[8][MAX_MODELS][] =
{
    {    // terror
        "terror_leader",
    },
    {
        // leet
        "leet_leader",
    },
    {
        // arctic
        "arctic_leader",
    },
    {
        // guerilla
        "guerilla_leader",
    },
    {
        // urban
        "urban_leader",
    },
    {
        // gsg9
        "gsg9_leader",
    },
    {
        // sas
        "sas_leader",
    },
    {
        // gign
        "gign_leader"
    }
};

enum cvar_data
{
    cvar_mode
}

enum
{
    dId,
    dKills,
    dDamage
}

enum user_data
{
    udModel,
    udKills,
    udDamage
};

enum leader_data
{
    ldId,
    ldKills,
    ldDamage,
    ldPast_id
};

new cd[cvar_data],
    ud[MAX_CLIENTS + 1][user_data],
    ld[leader_data];

new max_users;

public plugin_init()
{
    register_plugin("Ultimate Leader", VERSION, "Nunf");
    register_dictionary("ultimate_leader.txt");
    bind_pcvar_num(create_cvar("ul_mode", "0", FCVAR_NONE, fmt("%l", "CVAR_MODE_DISCRIPTION"), true, 0.0, true, 1.0), cd[cvar_mode]);
    AutoExecConfig(true, "ultimate_leader");
    max_users = get_maxplayers();
    RegisterHookChain(RG_HandleMenu_ChooseAppearance,             "user_choose_appearance",     true);
    RegisterHookChain(RG_CBasePlayer_Killed,                     "user_killed",                 true);
    RegisterHookChain(RG_CBasePlayer_TakeDamage,                 "user_take_damage",         true);
    RegisterHookChain(RG_RoundEnd,                                 "round_end",                 true);
    RegisterHookChain(RG_CBasePlayer_Spawn,                     "user_spawn",                 true);
    RegisterHookChain(RG_CBasePlayer_SetClientUserInfoModel,     "set_user_model",             false);
}

public plugin_cfg()
{
    cd[cvar_mode] = get_cvar_num("ul_mode");
}

public plugin_precache()
{
    for(new i; i < sizeof model_path; i++)
    {
        for(new n; n < MAX_MODELS; n++)
        {
            if(file_exists(model_path[i][n]))
            {
                precache_model(model_path[i][n]);
            }
            else
            {
                set_fail_state("^n\
                [ERROR]: FILE NOT EXISTS(array ^"model_path^")^n\
                [FILE PATH]: %s",
                model_path[i][n]);
            }
        }
    }
}

public client_disconnected(id, bool:drop, message[], maxlen)
{
    ud[id][udModel] = 0;
    ud[id][udKills] = 0;
    ud[id][udDamage] = 0;
    if(id == ld[ldId])
    {
        ld[ldId] = 0;
        ld[ldKills] = 0;
        ld[ldDamage] = 0;
    }
    else if(id == ld[ldPast_id])
    {
        ld[ldPast_id] = 0;
    }
}

public user_choose_appearance(const id, slot)
{
    switch(get_member(id, m_iModelName))
    {
        case MODEL_T_TERROR:
        {
            ud[id][udModel] = 0;
        }
        case MODEL_T_LEET:
        {
            ud[id][udModel] = 1;
        }
        case MODEL_T_ARCTIC:
        {
            ud[id][udModel] = 2;
        }
        case MODEL_T_GUERILLA:
        {
            ud[id][udModel] = 3;
        }
        case MODEL_CT_URBAN:
        {
            ud[id][udModel] = 4;
        }
        case MODEL_CT_GSG9:
        {
            ud[id][udModel] = 5;
        }
        case MODEL_CT_SAS:
        {
            ud[id][udModel] = 6;
        }
        case MODEL_CT_GIGN:
        {
            ud[id][udModel] = 7;
        }
    }
}

public user_killed(const id, attacker_id, iGib)
{
    if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
    {
        ud[attacker_id][udKills]++;
    }
}

public user_take_damage(const id, pevInflictor, attacker_id, Float: damage, bitsDamageType)
{
    if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
    {
        if(GetHookChainReturn(ATYPE_INTEGER) == 1)
        {
            ud[attacker_id][udDamage] += floatround(damage);
        }
        else if(get_member(attacker_id, m_iTeam) != get_member(attacker_id, m_iTeam))
        {
            ud[attacker_id][udDamage] += floatround(damage) + get_user_health(id);
        }   
    }
}

public round_end(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
{
    set_task(0.1, "task_round_end");
}

public user_spawn(id)
{
    if(id == ld[ldId])
    {
        rg_set_user_model(ld[ldId], custom_model[ud[id][udModel]][random(sizeof custom_model[])]);
    }
    else if(id == ld[ldPast_id])
    {
        rg_set_user_model(ld[ldId], default_model[ud[id][udModel]][random(sizeof default_model[])]);
    }
}

public set_user_model(id, infobuffer[], new_model[])
{
    if(id == ld[ldId])
    {
        SetHookChainArg(3, ATYPE_STRING, custom_model[ud[id][udModel]][random(sizeof custom_model[])]);
    }
    else if(id == ld[ldPast_id])
    {
        SetHookChainArg(3, ATYPE_STRING, default_model[ud[id][udModel]][random(sizeof default_model[])]);
    }
}

public task_round_end()
{
    new u_i[MAX_CLIENTS],
        u_n;
    get_players(u_i, u_n, "h");
    new data[3];
    data[dId] = u_i[0];
    data[dKills] = ud[u_i[0]][udKills];
    data[dDamage] = ud[u_i[0]][udDamage];
    ud[u_i[0]][udKills] = 0;
    ud[u_i[0]][udDamage] = 0;
    if(cd[cvar_mode] == 0)
    {
        for(new i = 1; i < u_n; i++)
        {
            if(ud[u_i[i]][udKills] > data[dKills] || ud[u_i[i]][udKills] == data[dKills] && ud[u_i[i]][udDamage] > data[dDamage])
            {
                data[dId] = u_i[i];
                data[dKills] = u_i[i];
                data[dDamage] = u_i[i];
            }
            ud[u_i[i]][udKills] = 0;
            ud[u_i[i]][udDamage] = 0;
        }
        if(data[dKills] > ld[ldKills] || data[dKills] == ld[ldKills] && data[dDamage] > ld[ldDamage])
        {
            if(data[dId] == ld[ldId])
            {
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
                client_print_color(0, print_team_default, "%l", "LEADER_OUTDONE_HIMSELF", data[dId], data[dKills], data[dDamage]);
            }
            else
            {
                ld[ldPast_id] = ld[ldId];
                ld[ldId] = data[dId];
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
                client_print_color(0, print_team_default, "%l", "NEW_LEADER", data[dId], data[dKills], data[dDamage]);
            }
        }
        else
        {
            if(ld[ldId] < 1 || ld[ldId] > max_users)
            {
                client_print_color(0, print_team_default, "%l", "NO_LEADER");
            }
            else
            {
                client_print_color(0, print_team_default, "%l", "NOBODY_SUPPARSED_LEADER", ld[ldId]);
            }
        }
    }
    else
    {
        for(new i = 1; i < u_n; i++)
        {
            if(ud[u_i[i]][udDamage] > data[dDamage] || ud[u_i[i]][udDamage] == data[dDamage] && ud[u_i[i]][udKills] > data[dKills])
            {
                data[dId] = u_i[i];
                data[dKills] = u_i[i];
                data[dDamage] = u_i[i];
            }
            ud[u_i[i]][udKills] = 0;
            ud[u_i[i]][udDamage] = 0;
        }
        if(data[dDamage] > ld[ldDamage] || data[dDamage] == ld[ldDamage] && data[dKills] > ld[ldKills])
        {
            if(data[dId] == ld[ldId])
            {
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
                client_print_color(0, print_team_default, "%l", "LEADER_OUTDONE_HIMSELF", data[dId], data[dKills], data[dDamage]);
            }
            else
            {
                ld[ldPast_id] = ld[ldId];
                ld[ldId] = data[dId];
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
                client_print_color(0, print_team_default, "%l", "NEW_LEADER", data[dId], data[dKills], data[dDamage]);
            }
        }
        else
        {
            if(ld[ldId] < 1 || ld[ldId] > max_users)
            {
                client_print_color(0, print_team_default, "%l", "NO_LEADER");
            }
            else
            {
-                client_print_color(0, print_team_default, "%l", "LEADER_OUTDONE_HIMSELF", ld[ldId]);
+                client_print_color(0, print_team_default, "%l", "NOBODY_SUPPARSED_LEADER", ld[ldId]);
            }
        }
    }
}
  • Теперь настройки из конфига вступят в силу сразу же после запуска плагина, а не после рестарта либо смены карты
    Код:
    /*
    
    |----[Связь с автором]----|
    |VK:         vk.com/nunfy  |
    |TELEGRAM:    t.me/Nunfy    |
    |-------------------------|
    
    */
    #include <amxmodx>
    #include <reapi>
    
    new const VERSION[] =             "2.0(stable)";
    
    const MAX_MODELS =                 1;                                         // Максимальное количество моделей
    
    new const model_path[8][MAX_MODELS][] =
    {
        {    // terror
            "models/player/terror_leader/terror_leader.mdl",
        },
        {     // leet
            "models/player/leet_leader/leet_leader.mdl",
        },
        {     // arctic
            "models/player/arctic_leader/arctic_leader.mdl",
        },
        {     // guerilla
            "models/player/guerilla_leader/guerilla_leader.mdl",
        },
        {    // urban
            "models/player/urban_leader/urban_leader.mdl",
        },
        {    // gsg9
            "models/player/gsg9_leader/gsg9_leader.mdl",
        },
        {    // sas
            "models/player/sas_leader/sas_leader.mdl",
        },
        {    // gign
            "models/player/gign_leader/gign_leader.mdl"
        }
    };
    
    new const default_model[8][MAX_MODELS][] =
    {
        {    // terror
            "terror",
        },
        {
            // leet
            "leet",
        },
        {
            // arctic
            "arctic",
        },
        {
            // guerilla
            "guerilla",
        },
        {
            // urban
            "urban",
        },
        {
            // gsg9
            "gsg9",
        },
        {
            // sas
            "sas",
        },
        {
            // gign
            "gign"
        }
    };
    
    new const custom_model[8][MAX_MODELS][] =
    {
        {    // terror
            "terror_leader",
        },
        {
            // leet
            "leet_leader",
        },
        {
            // arctic
            "arctic_leader",
        },
        {
            // guerilla
            "guerilla_leader",
        },
        {
            // urban
            "urban_leader",
        },
        {
            // gsg9
            "gsg9_leader",
        },
        {
            // sas
            "sas_leader",
        },
        {
            // gign
            "gign_leader"
        }
    };
    
    enum cvar_data
    {
        cvar_mode
    }
    
    enum
    {
        dId,
        dKills,
        dDamage
    }
    
    enum user_data
    {
        udModel,
        udKills,
        udDamage
    };
    
    enum leader_data
    {
        ldId,
        ldKills,
        ldDamage,
        ldPast_id
    };
    
    new cd[cvar_data],
        ud[MAX_CLIENTS + 1][user_data],
        ld[leader_data];
    
    new max_users;
    
    public plugin_init()
    {
        register_plugin("Ultimate Leader", VERSION, "Nunf");
        register_dictionary("ultimate_leader.txt");
        bind_pcvar_num(create_cvar("ul_mode", "0", FCVAR_NONE, fmt("%l", "CVAR_MODE_DISCRIPTION"), true, 0.0, true, 1.0), cd[cvar_mode]);
        AutoExecConfig(true, "ultimate_leader");
        max_users = get_maxplayers();
        RegisterHookChain(RG_HandleMenu_ChooseAppearance,             "user_choose_appearance",     true);
        RegisterHookChain(RG_CBasePlayer_Killed,                     "user_killed",                 true);
        RegisterHookChain(RG_CBasePlayer_TakeDamage,                 "user_take_damage",         true);
        RegisterHookChain(RG_RoundEnd,                                 "round_end",                 true);
        RegisterHookChain(RG_CBasePlayer_Spawn,                     "user_spawn",                 true);
        RegisterHookChain(RG_CBasePlayer_SetClientUserInfoModel,     "set_user_model",             false);
    }
    
    +public plugin_cfg()
    +{
    +    cd[cvar_mode] = get_cvar_num("ul_mode");
    +}
    
    public plugin_precache()
    {
        for(new i; i < sizeof model_path; i++)
        {
            for(new n; n < MAX_MODELS; n++)
            {
                if(file_exists(model_path[i][n]))
                {
                    precache_model(model_path[i][n]);
                }
                else
                {
                    set_fail_state("^n\
                    [ERROR]: FILE NOT EXISTS(array ^"model_path^")^n\
                    [FILE PATH]: %s",
                    model_path[i][n]);
                }
            }
        }
    }
    
    public client_disconnected(id, bool:drop, message[], maxlen)
    {
        ud[id][udModel] = 0;
        ud[id][udKills] = 0;
        ud[id][udDamage] = 0;
        if(id == ld[ldId])
        {
            ld[ldId] = 0;
            ld[ldKills] = 0;
            ld[ldDamage] = 0;
        }
        else if(id == ld[ldPast_id])
        {
            ld[ldPast_id] = 0;
        }
    }
    
    public user_choose_appearance(const id, slot)
    {
        switch(get_member(id, m_iModelName))
        {
            case MODEL_T_TERROR:
            {
                ud[id][udModel] = 0;
            }
            case MODEL_T_LEET:
            {
                ud[id][udModel] = 1;
            }
            case MODEL_T_ARCTIC:
            {
                ud[id][udModel] = 2;
            }
            case MODEL_T_GUERILLA:
            {
                ud[id][udModel] = 3;
            }
            case MODEL_CT_URBAN:
            {
                ud[id][udModel] = 4;
            }
            case MODEL_CT_GSG9:
            {
                ud[id][udModel] = 5;
            }
            case MODEL_CT_SAS:
            {
                ud[id][udModel] = 6;
            }
            case MODEL_CT_GIGN:
            {
                ud[id][udModel] = 7;
            }
        }
    }
    
    public user_killed(const id, attacker_id, iGib)
    {
        if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
        {
            ud[attacker_id][udKills]++;
        }
    }
    
    public user_take_damage(const id, pevInflictor, attacker_id, Float: damage, bitsDamageType)
    {
        if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
        {
            if(GetHookChainReturn(ATYPE_INTEGER) == 1)
            {
                ud[attacker_id][udDamage] += floatround(damage);
            }
            else if(get_member(attacker_id, m_iTeam) != get_member(attacker_id, m_iTeam))
            {
                ud[attacker_id][udDamage] += floatround(damage) + get_user_health(id);
            }
        }
    }
    
    public round_end(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
    {
        set_task(0.1, "task_round_end");
    }
    
    public user_spawn(id)
    {
        if(id == ld[ldId])
        {
            rg_set_user_model(ld[ldId], custom_model[ud[id][udModel]][random(sizeof custom_model[])]);
        }
        else if(id == ld[ldPast_id])
        {
            rg_set_user_model(ld[ldId], default_model[ud[id][udModel]][random(sizeof default_model[])]);
        }
    }
    
    public set_user_model(id, infobuffer[], new_model[])
    {
        if(id == ld[ldId])
        {
            SetHookChainArg(3, ATYPE_STRING, custom_model[ud[id][udModel]][random(sizeof custom_model[])]);
        }
        else if(id == ld[ldPast_id])
        {
            SetHookChainArg(3, ATYPE_STRING, default_model[ud[id][udModel]][random(sizeof default_model[])]);
        }
    }
    
    public task_round_end()
    {
        new u_i[MAX_CLIENTS],
            u_n;
        get_players(u_i, u_n, "h");
        new data[3];
        data[dId] = u_i[0];
        data[dKills] = ud[u_i[0]][udKills];
        data[dDamage] = ud[u_i[0]][udDamage];
        ud[u_i[0]][udKills] = 0;
        ud[u_i[0]][udDamage] = 0;
        if(cd[cvar_mode] == 0)
        {
            for(new i = 1; i < u_n; i++)
            {
                if(ud[u_i[i]][udKills] > data[dKills] || ud[u_i[i]][udKills] == data[dKills] && ud[u_i[i]][udDamage] > data[dDamage])
                {
                    data[dId] = u_i[i];
                    data[dKills] = u_i[i];
                    data[dDamage] = u_i[i];
                }
                ud[u_i[i]][udKills] = 0;
                ud[u_i[i]][udDamage] = 0;
            }
            if(data[dKills] > ld[ldKills] || data[dKills] == ld[ldKills] && data[dDamage] > ld[ldDamage])
            {
                if(data[dId] == ld[ldId])
                {
                    ld[ldKills] = data[dKills];
                    ld[ldDamage] = data[dDamage];
                    client_print_color(0, print_team_default, "%l", "LEADER_OUTDONE_HIMSELF", data[dId], data[dKills], data[dDamage]);
                }
                else
                {
                    ld[ldPast_id] = ld[ldId];
                    ld[ldId] = data[dId];
                    ld[ldKills] = data[dKills];
                    ld[ldDamage] = data[dDamage];
                    client_print_color(0, print_team_default, "%l", "NEW_LEADER", data[dId], data[dKills], data[dDamage]);
                }
            }
            else
            {
                if(ld[ldId] < 1 || ld[ldId] > max_users)
                {
                    client_print_color(0, print_team_default, "%l", "NO_LEADER");
                }
                else
                {
                    client_print_color(0, print_team_default, "%l", "NOBODY_SUPPARSED_LEADER", ld[ldId]);
                }
            }
        }
        else
        {
            for(new i = 1; i < u_n; i++)
            {
                if(ud[u_i[i]][udDamage] > data[dDamage] || ud[u_i[i]][udDamage] == data[dDamage] && ud[u_i[i]][udKills] > data[dKills])
                {
                    data[dId] = u_i[i];
                    data[dKills] = u_i[i];
                    data[dDamage] = u_i[i];
                }
                ud[u_i[i]][udKills] = 0;
                ud[u_i[i]][udDamage] = 0;
            }
            if(data[dDamage] > ld[ldDamage] || data[dDamage] == ld[ldDamage] && data[dKills] > ld[ldKills])
            {
                if(data[dId] == ld[ldId])
                {
                    ld[ldKills] = data[dKills];
                    ld[ldDamage] = data[dDamage];
                    client_print_color(0, print_team_default, "%l", "LEADER_OUTDONE_HIMSELF", data[dId], data[dKills], data[dDamage]);
                }
                else
                {
                    ld[ldPast_id] = ld[ldId];
                    ld[ldId] = data[dId];
                    ld[ldKills] = data[dKills];
                    ld[ldDamage] = data[dDamage];
                    client_print_color(0, print_team_default, "%l", "NEW_LEADER", data[dId], data[dKills], data[dDamage]);
                }
            }
            else
            {
                if(ld[ldId] < 1 || ld[ldId] > max_users)
                {
                    client_print_color(0, print_team_default, "%l", "NO_LEADER");
                }
                else
                {
                    client_print_color(0, print_team_default, "%l", "LEADER_OUTDONE_HIMSELF", ld[ldId]);
                }
            }
        }
    }
Код:
/*

|----[Связь с автором]----|
|VK:         vk.com/nunfy  |
|TELEGRAM:    t.me/Nunfy    |
|-------------------------|

*/
#include <amxmodx>
#include <reapi>

-new const VERSION[] =             "2.0";
+new const VERSION[] =             "2.0(stable)";

const MAX_MODELS =                 1;                                         // Максимальное количество моделей

new const model_path[8][MAX_MODELS][] =
{
    {    // terror
        "models/player/terror_leader/terror_leader.mdl",
    },
    {     // leet
        "models/player/leet_leader/leet_leader.mdl",
    },
    {     // arctic
        "models/player/arctic_leader/arctic_leader.mdl",
    },
    {     // guerilla
        "models/player/guerilla_leader/guerilla_leader.mdl",
    },
    {    // urban
        "models/player/urban_leader/urban_leader.mdl",
    },
    {    // gsg9
        "models/player/gsg9_leader/gsg9_leader.mdl",
    },
    {    // sas
        "models/player/sas_leader/sas_leader.mdl",
    },
    {    // gign
        "models/player/gign_leader/gign_leader.mdl"
    }
};

new const default_model[8][MAX_MODELS][] =
{
    {    // terror
        "terror",
    },
    {
        // leet
        "leet",
    },
    {
        // arctic
        "arctic",
    },
    {
        // guerilla
        "guerilla",
    },
    {
        // urban
        "urban",
    },
    {
        // gsg9
        "gsg9",
    },
    {
        // sas
        "sas",
    },
    {
        // gign
        "gign"
    }
};

new const custom_model[8][MAX_MODELS][] =
{
    {    // terror
        "terror_leader",
    },
    {
        // leet
        "leet_leader",
    },
    {
        // arctic
        "arctic_leader",
    },
    {
        // guerilla
        "guerilla_leader",
    },
    {
        // urban
        "urban_leader",
    },
    {
        // gsg9
        "gsg9_leader",
    },
    {
        // sas
        "sas_leader",
    },
    {
        // gign
        "gign_leader"
    }
};

-new const cvar_mode_description[] = "The mode of counting the leader of the round^n\
-    0 - until the player surpasses the current leader in kills.^n\
-    1 - until the player surpasses the current leader in damage.";

enum cvar_data
{
    cvar_mode
}

enum
{
    dId,
    dKills,
    dDamage
}

enum user_data
{
    udModel,
    udKills,
    udDamage
};

enum leader_data
{
    ldId,
    ldKills,
    ldDamage,
    ldPast_id
};

new cd[cvar_data],
    ud[MAX_CLIENTS + 1][user_data],
    ld[leader_data];

new max_users;

public plugin_init()
{
    register_plugin("Ultimate Leader", VERSION, "Nunf");
    register_dictionary("ultimate_leader.txt");
-    bind_pcvar_num(create_cvar("ul_mode", "1", .description = cvar_mode_description), cd[cvar_mode]);
+    bind_pcvar_num(create_cvar("ul_mode", "0", FCVAR_NONE, fmt("%l", "CVAR_MODE_DISCRIPTION"), true, 0.0, true, 1.0), cd[cvar_mode]);
    AutoExecConfig(true, "ultimate_leader");
    max_users = get_maxplayers();
    RegisterHookChain(RG_HandleMenu_ChooseAppearance,             "user_choose_appearance",     true);
-    RegisterHookChain(RG_CBasePlayer_Killed,                     "user_killed",                 false);
+    RegisterHookChain(RG_CBasePlayer_Killed,                     "user_killed",                 true);
    RegisterHookChain(RG_CBasePlayer_TakeDamage,                 "user_take_damage",         true);
    RegisterHookChain(RG_RoundEnd,                                 "round_end",                 true);
    RegisterHookChain(RG_CBasePlayer_Spawn,                     "user_spawn",                 true);
    RegisterHookChain(RG_CBasePlayer_SetClientUserInfoModel,     "set_user_model",             false);
}

public plugin_precache()
{
    for(new i; i < sizeof model_path; i++)
    {
        for(new n; n < MAX_MODELS; n++)
        {
            if(file_exists(model_path[i][n]))
            {
                precache_model(model_path[i][n]);
            }
            else
            {
                set_fail_state("^n\
                [ERROR]: FILE NOT EXISTS(array ^"model_path^")^n\
                [FILE PATH]: %s",
                model_path[i][n]);
            }
        }
    }
}

public client_disconnected(id, bool:drop, message[], maxlen)
{
    ud[id][udModel] = 0;
    ud[id][udKills] = 0;
    ud[id][udDamage] = 0;
    if(id == ld[ldId])
    {
        ld[ldId] = 0;
        ld[ldKills] = 0;
        ld[ldDamage] = 0;
    }
    else if(id == ld[ldPast_id])
    {
        ld[ldPast_id] = 0;
    }
}

public user_choose_appearance(const id, slot)
{
-    if(slot == 5)
-    {
-        slot = random(5);
-    }
-    if(get_member(id, m_iTeam) == TEAM_TERRORIST)
-    {
-        ud[id][udModel] = slot;
-    }
-    else if(get_member(id, m_iTeam) == TEAM_CT)
-    {
-        ud[id][udModel] = 4 + slot;
-    }
+    switch(get_member(id, m_iModelName))
+    {
+        case MODEL_T_TERROR:
+        {
+            ud[id][udModel] = 0;
+        }
+        case MODEL_T_LEET:
+        {
+            ud[id][udModel] = 1;
+        }
+        case MODEL_T_ARCTIC:
+        {
+            ud[id][udModel] = 2;
+        }
+        case MODEL_T_GUERILLA:
+        {
+            ud[id][udModel] = 3;
+        }
+        case MODEL_CT_URBAN:
+        {
+            ud[id][udModel] = 4;
+        }
+        case MODEL_CT_GSG9:
+        {
+            ud[id][udModel] = 5;
+        }
+        case MODEL_CT_SAS:
+        {
+            ud[id][udModel] = 6;
+        }
+        case MODEL_CT_GIGN:
+        {
+            ud[id][udModel] = 7;
+        }
+    }
}

public user_killed(const id, attacker_id, iGib)
{
    if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
    {
        ud[attacker_id][udKills]++;
    }
}

public user_take_damage(const id, pevInflictor, attacker_id, Float: damage, bitsDamageType)
{
    if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
    {
        if(GetHookChainReturn(ATYPE_INTEGER) == 1)
        {
            ud[attacker_id][udDamage] += floatround(damage);
        }
        else if(get_member(attacker_id, m_iTeam) != get_member(attacker_id, m_iTeam))
        {
            ud[attacker_id][udDamage] += floatround(damage) + get_user_health(id);
        }   
    }
}

public round_end(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
{
    set_task(0.1, "task_round_end");
}

public user_spawn(id)
{
    if(id == ld[ldId])
    {
-        rg_set_user_model(ld[ldId], custom_model[ud[id][udModel] - 1][random(sizeof custom_model[])]);
+        rg_set_user_model(ld[ldId], custom_model[ud[id][udModel]][random(sizeof custom_model[])]);
    }
    else if(id == ld[ldPast_id])
    {
-        rg_set_user_model(ld[ldId], default_model[ud[id][udModel] - 1][random(sizeof default_model[])]);
+        rg_set_user_model(ld[ldId], default_model[ud[id][udModel]][random(sizeof default_model[])]);
    }
}

public set_user_model(id, infobuffer[], new_model[])
{
    if(id == ld[ldId])
    {
-        SetHookChainArg(3, ATYPE_STRING, custom_model[ud[id][udModel] - 1][random(sizeof custom_model[])]);
+        SetHookChainArg(3, ATYPE_STRING, custom_model[ud[id][udModel]][random(sizeof custom_model[])]);
    }
    else if(id == ld[ldPast_id])
    {
-        SetHookChainArg(3, ATYPE_STRING, default_model[ud[id][udModel] - 1][random(sizeof default_model[])]);
+        SetHookChainArg(3, ATYPE_STRING, default_model[ud[id][udModel]][random(sizeof default_model[])]);
    }
}

public task_round_end()
{
    new u_i[MAX_CLIENTS],
        u_n;
    get_players(u_i, u_n, "h");
    new data[3];
    data[dId] = u_i[0];
    data[dKills] = ud[u_i[0]][udKills];
    data[dDamage] = ud[u_i[0]][udDamage];
    ud[u_i[0]][udKills] = 0;
    ud[u_i[0]][udDamage] = 0;
    if(cd[cvar_mode] == 0)
    {
        for(new i = 1; i < u_n; i++)
        {
            if(ud[u_i[i]][udKills] > data[dKills] || ud[u_i[i]][udKills] == data[dKills] && ud[u_i[i]][udDamage] > data[dDamage])
            {
                data[dId] = u_i[i];
                data[dKills] = u_i[i];
                data[dDamage] = u_i[i];
            }
            ud[u_i[i]][udKills] = 0;
            ud[u_i[i]][udDamage] = 0;
        }
        if(data[dKills] > ld[ldKills] || data[dKills] == ld[ldKills] && data[dDamage] > ld[ldDamage])
        {
            if(data[dId] == ld[ldId])
            {
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                client_print_color(0, print_team_default, "%L", "ru", "Q", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
+                client_print_color(0, print_team_default, "%l", "LEADER_OUTDONE_HIMSELF", data[dId], data[dKills], data[dDamage]);
            }
            else
            {
                ld[ldPast_id] = ld[ldId];
                ld[ldId] = data[dId];
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                client_print_color(0, print_team_default, "%L", "ru", "W", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
+                client_print_color(0, print_team_default, "%l", "NEW_LEADER", data[dId], data[dKills], data[dDamage]);
            }
        }
        else
        {
            if(ld[ldId] < 1 || ld[ldId] > max_users)
            {
-                client_print_color(0, print_team_default, "%L", "ru", "E");
+                client_print_color(0, print_team_default, "%l", "NO_LEADER");
            }
            else
            {
-                client_print_color(0, print_team_default, "%L", "ru", "R", get_user_nickname(ld[ldId]));
+                client_print_color(0, print_team_default, "%l", "NOBODY_SUPPARSED_LEADER", ld[ldId]);
            }
        }
    }
    else
    {
        for(new i = 1; i < u_n; i++)
        {
            if(ud[u_i[i]][udDamage] > data[dDamage] || ud[u_i[i]][udDamage] == data[dDamage] && ud[u_i[i]][udKills] > data[dKills])
            {
                data[dId] = u_i[i];
                data[dKills] = u_i[i];
                data[dDamage] = u_i[i];
            }
            ud[u_i[i]][udKills] = 0;
            ud[u_i[i]][udDamage] = 0;
        }
        if(data[dDamage] > ld[ldDamage] || data[dDamage] == ld[ldDamage] && data[dKills] > ld[ldKills])
        {
            if(data[dId] == ld[ldId])
            {
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                client_print_color(0, print_team_default, "%L", "ru", "1", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
+                client_print_color(0, print_team_default, "%l", "LEADER_OUTDONE_HIMSELF", data[dId], data[dKills], data[dDamage]);
            }
            else
            {
                ld[ldPast_id] = ld[ldId];
                ld[ldId] = data[dId];
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                client_print_color(0, print_team_default, "%L", "ru", "2", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
+                client_print_color(0, print_team_default, "%l", "NEW_LEADER", data[dId], data[dKills], data[dDamage]);
            }
        }
        else
        {
            if(ld[ldId] < 1 || ld[ldId] > max_users)
            {
-                client_print_color(0, print_team_default, "3", "ru");
+                client_print_color(0, print_team_default, "%l", "NO_LEADER");
            }
            else
            {
-                client_print_color(0, print_team_default, "4", "ru", get_user_nickname(ld[ldId]));
+                client_print_color(0, print_team_default, "%l", "LEADER_OUTDONE_HIMSELF", ld[ldId]);
            }
        }
    }
}

-get_user_nickname(id)
-{
-    new nickname[MAX_NAME_LENGTH];
-    get_entvar(id, var_netname, nickname, charsmax(nickname));
-    return nickname;
-}
Код:
[ru]
-Q = ^3[Ultimate] ^1Текущий лидер^4 %s ^1превзошел свои показатели. Количество убийств:^4 %d ^1| Количество урона:^4 %d
-W = ^3[Ultimate] ^4%s ^1становится новым лидером. Количество убийств:^4 %d ^1| Количество урона:^4 %d
-E = ^3[Ultimate] ^4Лидер ^1будет определен в текущем раунде
-R = ^3[Ultimate] ^1В этом раунде никто не превзошел лидера^4 %s
+LEADER_OUTDONE_HIMSELF     = ^3[Ultimate] ^1Текущий лидер^4 %n ^1превзошел свои показатели. Количество убийств:^4 %d ^1| Количество урона:^4 %d
+NEW_LEADER                 = ^3[Ultimate] ^4%n ^1становится новым лидером. Количество убийств:^4 %d ^1| Количество урона:^4 %d
+NO_LEADER                 = ^3[Ultimate] ^4Лидер ^1будет определен в текущем раунде
+NOBODY_SUPPARSED_LEADER = ^3[Ultimate] ^1В этом раунде никто не превзошел лидера^4 %n
+CVAR_MODE_DISCRIPTION     = Режим подсчета лидера раунда^n0 - пока игрок не превзойдет текущего лидера по количеству убийств^n1 - пока игрок не превзойдет текущего лидера по урону
Код:
/*

|----[Связь с автором]----|
|VK:         vk.com/nunfy  |
|TELEGRAM:    t.me/Nunfy    |
|-------------------------|

*/
#include <amxmodx>
#include <reapi>

-#define PLUGIN                  "Ultimate Leader"
-#define VERSION                 "2.0"
-#define AUTHOR                  "Nunf"

-#define cpc                     client_print_color
-#define ptd                     print_team_default

const MAX_MODELS =                 1;                                         // Максимальное количество моделей
-const MAX_NICKNAME_LENGHT =     32;                                     // Максимальная длинна никнейма

enum
{
    dId,
    dKills,
    dDamage
}

enum user_data
{
    udModel,
    udKills,
    udDamage
};

enum leader_data
{
    ldId,
    ldKills,
    ldDamage,
    ldPast_id
};

new ud[MAX_PLAYERS + 1][user_data],
    ld[leader_data];

-new bool: cvar_mode;

-static max_users;

-static model_path[8][MAX_MODELS][] =
{
    {    // terror
        "models/player/terror_leader/terror_leader.mdl",
    },
    {     // leet
        "models/player/leet_leader/leet_leader.mdl",
    },
    {     // arctic
        "models/player/arctic_leader/arctic_leader.mdl",
    },
    {     // guerilla
        "models/player/guerilla_leader/guerilla_leader.mdl",
    },
    {    // urban
        "models/player/urban_leader/urban_leader.mdl",
    },
    {    // gsg9
        "models/player/gsg9_leader/gsg9_leader.mdl",
    },
    {    // sas
        "models/player/sas_leader/sas_leader.mdl",
    },
    {    // gign
        "models/player/gign_leader/gign_leader.mdl"
    }
};

-static default_model[8][MAX_MODELS][] =
{
    {    // terror
        "terror",
    },
    {
        // leet
        "leet",
    },
    {
        // arctic
        "arctic",
    },
    {
        // guerilla
        "guerilla",
    },
    {
        // urban
        "urban",
    },
    {
        // gsg9
        "gsg9",
    },
    {
        // sas
        "sas",
    },
    {
        // gign
        "gign"
    }
};

-static custom_model[8][MAX_MODELS][] =
{
    {    // terror
        "terror_leader",
    },
    {
        // leet
        "leet_leader",
    },
    {
        // arctic
        "arctic_leader",
    },
    {
        // guerilla
        "guerilla_leader",
    },
    {
        // urban
        "urban_leader",
    },
    {
        // gsg9
        "gsg9_leader",
    },
    {
        // sas
        "sas_leader",
    },
    {
        // gign
        "gign_leader"
    }
};

-static config_path[] = "addons/amxmodx/configs/ultimate_leader.cfg";

public plugin_init()
{
-    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_dictionary("ultimate_leader.txt");
    max_users = get_maxplayers();
    RegisterHookChain(RG_HandleMenu_ChooseAppearance,             "user_choose_appearance",     true);
    RegisterHookChain(RG_CBasePlayer_Killed,                     "user_killed",                 false);
    RegisterHookChain(RG_CBasePlayer_TakeDamage,                 "user_take_damage",         true);
    RegisterHookChain(RG_RoundEnd,                                 "round_end",                 true);
    RegisterHookChain(RG_CBasePlayer_Spawn,                     "user_spawn",                 true);
    RegisterHookChain(RG_CBasePlayer_SetClientUserInfoModel,     "set_user_model",             false);
}

-public plugin_cfg()
-{
-    cvar_mode = get_pcvar_bool(register_cvar("ul_mode", "0"));
-    server_cmd("exec %s", config_path);
-}

public plugin_precache()
{
-    for(new i; i < 8; i++)
    {
        for(new n; n < MAX_MODELS; n++)
        {
            if(file_exists(model_path[i][n]))
            {
                precache_model(model_path[i][n]);
            }
            else
            {
                set_fail_state("^n\
                [ERROR]: FILE NOT EXISTS(array ^"model_path^")^n\
                [FILE PATH]: %s",
                model_path[i][n]);
            }
        }
    }
}

public client_disconnected(id, bool:drop, message[], maxlen)
{
    ud[id][udModel] = 0;
    ud[id][udKills] = 0;
    ud[id][udDamage] = 0;
    if(id == ld[ldId])
    {
        ld[ldId] = 0;
        ld[ldKills] = 0;
        ld[ldDamage] = 0;
    }
    else if(id == ld[ldPast_id])
    {
        ld[ldPast_id] = 0;
    }
}

public user_choose_appearance(const id, const slot)
{
-    if(get_user_team(id) == 1)
    {
        ud[id][udModel] = slot;
    }
-    else if(get_user_team(id) == 2)
    {
        ud[id][udModel] = 4 + slot;
    }
}

public user_killed(const id, attacker_id, iGib)
{
    if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
    {
        ud[attacker_id][udKills]++;
    }
}

public user_take_damage(const id, pevInflictor, attacker_id, Float: damage, bitsDamageType)
{
    if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
    {
        if(GetHookChainReturn(ATYPE_INTEGER) == 1)
        {
            ud[attacker_id][udDamage] += floatround(damage);
        }
-        else if(get_user_team(id) != get_user_team(attacker_id))
        {
            ud[attacker_id][udDamage] += floatround(damage) + get_user_health(id);
        }
    }
}

public round_end(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
{
    set_task(0.1, "task_round_end");
}

public user_spawn(id)
{
    if(id == ld[ldId])
    {
        rg_set_user_model(ld[ldId], custom_model[ud[id][udModel] - 1][random(sizeof custom_model[])]);
    }
    else if(id == ld[ldPast_id])
    {
        rg_set_user_model(ld[ldId], default_model[ud[id][udModel] - 1][random(sizeof default_model[])]);
    }
}

public set_user_model(id, infobuffer[], new_model[])
{
    if(id == ld[ldId])
    {
        SetHookChainArg(3, ATYPE_STRING, custom_model[ud[id][udModel] - 1][random(sizeof custom_model[])]);
    }
    else if(id == ld[ldPast_id])
    {
        SetHookChainArg(3, ATYPE_STRING, default_model[ud[id][udModel] - 1][random(sizeof default_model[])]);
    }
}

public task_round_end()
{
    new u_i[MAX_PLAYERS],
        u_n;
    get_players(u_i, u_n, "h");
    new data[3];
    data[dId] = u_i[0];
    data[dKills] = ud[u_i[0]][udKills];
    data[dDamage] = ud[u_i[0]][udDamage];
    ud[u_i[0]][udKills] = 0;
    ud[u_i[0]][udDamage] = 0;
    if(cvar_mode == false)
    {
        for(new i = 1; i < u_n; i++)
        {
            if(ud[u_i[i]][udKills] > data[dKills] || ud[u_i[i]][udKills] == data[dKills] && ud[u_i[i]][udDamage] > data[dDamage])
            {
                data[dId] = u_i[i];
                data[dKills] = u_i[i];
                data[dDamage] = u_i[i];
            }
            ud[u_i[i]][udKills] = 0;
            ud[u_i[i]][udDamage] = 0;
        }
        if(data[dKills] > ld[ldKills] || data[dKills] == ld[ldKills] && data[dDamage] > ld[ldDamage])
        {
            if(data[dId] == ld[ldId])
            {
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                cpc(0, ptd, "%L", "ru", "Q", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
            }
            else
            {
                ld[ldPast_id] = ld[ldId];
                ld[ldId] = data[dId];
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                cpc(0, ptd, "%L", "ru", "W", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
            }
        }
        else
        {
            if(ld[ldId] < 1 || ld[ldId] > max_users)
            {
-                cpc(0, ptd, "%L", "ru", "E");
            }
            else
            {
-                cpc(0, ptd, "%L", "ru", "R", get_user_nickname(ld[ldId]));
            }
        }
    }
    else
    {
        for(new i = 1; i < u_n; i++)
        {
            if(ud[u_i[i]][udDamage] > data[dDamage] || ud[u_i[i]][udDamage] == data[dDamage] && ud[u_i[i]][udKills] > data[dKills])
            {
                data[dId] = u_i[i];
                data[dKills] = u_i[i];
                data[dDamage] = u_i[i];
            }
            ud[u_i[i]][udKills] = 0;
            ud[u_i[i]][udDamage] = 0;
        }
        if(data[dDamage] > ld[ldDamage] || data[dDamage] == ld[ldDamage] && data[dKills] > ld[ldKills])
        {
            if(data[dId] == ld[ldId])
            {
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                cpc(0, ptd, "%L", "ru", "1", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
            }
            else
            {
                ld[ldPast_id] = ld[ldId];
                ld[ldId] = data[dId];
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
-                cpc(0, ptd, "%L", "ru", "2", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
            }
        }
        else
        {
            if(ld[ldId] < 1 || ld[ldId] > max_users)
            {
-                cpc(0, ptd, "3", "ru");
            }
            else
            {
-                cpc(0, ptd, "4", "ru", get_user_nickname(ld[ldId]));
            }
        }
    }
}

get_user_nickname(id)
{
-    new nickname[MAX_NICKNAME_LENGHT + 1];
-    get_user_name(id, nickname, MAX_NICKNAME_LENGHT + 1);
    return nickname;
}
Код:
/*

|----[Связь с автором]----|
|VK:         vk.com/nunfy  |
|TELEGRAM:    t.me/Nunfy    |
|-------------------------|

*/
#include <amxmodx>
#include <reapi>

+new const VERSION[] =             "2.0";

const MAX_MODELS =                 1;                                         // Максимальное количество моделей

+new const model_path[8][MAX_MODELS][] =
{
    {    // terror
        "models/player/terror_leader/terror_leader.mdl",
    },
    {     // leet
        "models/player/leet_leader/leet_leader.mdl",
    },
    {     // arctic
        "models/player/arctic_leader/arctic_leader.mdl",
    },
    {     // guerilla
        "models/player/guerilla_leader/guerilla_leader.mdl",
    },
    {    // urban
        "models/player/urban_leader/urban_leader.mdl",
    },
    {    // gsg9
        "models/player/gsg9_leader/gsg9_leader.mdl",
    },
    {    // sas
        "models/player/sas_leader/sas_leader.mdl",
    },
    {    // gign
        "models/player/gign_leader/gign_leader.mdl"
    }
};

+new const default_model[8][MAX_MODELS][] =
{
    {    // terror
        "terror",
    },
    {
        // leet
        "leet",
    },
    {
        // arctic
        "arctic",
    },
    {
        // guerilla
        "guerilla",
    },
    {
        // urban
        "urban",
    },
    {
        // gsg9
        "gsg9",
    },
    {
        // sas
        "sas",
    },
    {
        // gign
        "gign"
    }
};

+new const custom_model[8][MAX_MODELS][] =
{
    {    // terror
        "terror_leader",
    },
    {
        // leet
        "leet_leader",
    },
    {
        // arctic
        "arctic_leader",
    },
    {
        // guerilla
        "guerilla_leader",
    },
    {
        // urban
        "urban_leader",
    },
    {
        // gsg9
        "gsg9_leader",
    },
    {
        // sas
        "sas_leader",
    },
    {
        // gign
        "gign_leader"
    }
};

+new const cvar_mode_description[] = "The mode of counting the leader of the round^n\
+    0 - until the player surpasses the current leader in kills.^n\
+    1 - until the player surpasses the current leader in damage.";

+enum cvar_data
+{
+    cvar_mode
+}

enum
{
    dId,
    dKills,
    dDamage
}

enum user_data
{
    udModel,
    udKills,
    udDamage
};

enum leader_data
{
    ldId,
    ldKills,
    ldDamage,
    ldPast_id
};

+new cd[cvar_data],
    ud[MAX_CLIENTS + 1][user_data],
    ld[leader_data];

new max_users;

public plugin_init()
{
    +register_plugin("Ultimate Leader", VERSION, "Nunf");
    register_dictionary("ultimate_leader.txt");
    +bind_pcvar_num(create_cvar("ul_mode", "1", .description = cvar_mode_description), cd[cvar_mode]);
    +AutoExecConfig(true, "ultimate_leader");
    max_users = get_maxplayers();
    RegisterHookChain(RG_HandleMenu_ChooseAppearance,             "user_choose_appearance",     true);
    RegisterHookChain(RG_CBasePlayer_Killed,                     "user_killed",                 false);
    RegisterHookChain(RG_CBasePlayer_TakeDamage,                 "user_take_damage",         true);
    RegisterHookChain(RG_RoundEnd,                                 "round_end",                 true);
    RegisterHookChain(RG_CBasePlayer_Spawn,                     "user_spawn",                 true);
    RegisterHookChain(RG_CBasePlayer_SetClientUserInfoModel,     "set_user_model",             false);
}

public plugin_precache()
{
    for(new i; i < +sizeof model_path; i++)
    {
        for(new n; n < MAX_MODELS; n++)
        {
            if(file_exists(model_path[i][n]))
            {
                precache_model(model_path[i][n]);
            }
            else
            {
                set_fail_state("^n\
                [ERROR]: FILE NOT EXISTS(array ^"model_path^")^n\
                [FILE PATH]: %s",
                model_path[i][n]);
            }
        }
    }
}

public client_disconnected(id, bool:drop, message[], maxlen)
{
    ud[id][udModel] = 0;
    ud[id][udKills] = 0;
    ud[id][udDamage] = 0;
    if(id == ld[ldId])
    {
        ld[ldId] = 0;
        ld[ldKills] = 0;
        ld[ldDamage] = 0;
    }
    else if(id == ld[ldPast_id])
    {
        ld[ldPast_id] = 0;
    }
}

public user_choose_appearance(const id, slot)
{
+    if(slot == 5)
+    {
+        slot = random(5);
+    }
+    if(get_member(id, m_iTeam) == TEAM_TERRORIST)
    {
        ud[id][udModel] = slot;
    }
+    else if(get_member(id, m_iTeam) == TEAM_CT)
    {
        ud[id][udModel] = 4 + slot;
    }
}

public user_killed(const id, attacker_id, iGib)
{
    if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
    {
        ud[attacker_id][udKills]++;
    }
}

public user_take_damage(const id, pevInflictor, attacker_id, Float: damage, bitsDamageType)
{
    if(attacker_id > 0 || attacker_id <= max_users && id != attacker_id)
    {
        if(GetHookChainReturn(ATYPE_INTEGER) == 1)
        {
            ud[attacker_id][udDamage] += floatround(damage);
        }
+        else if(get_member(attacker_id, m_iTeam) != get_member(attacker_id, m_iTeam))
        {
            ud[attacker_id][udDamage] += floatround(damage) + get_user_health(id);
        }
    }
}

public round_end(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
{
    set_task(0.1, "task_round_end");
}

public user_spawn(id)
{
    if(id == ld[ldId])
    {
        rg_set_user_model(ld[ldId], custom_model[ud[id][udModel] - 1][random(sizeof custom_model[])]);
    }
    else if(id == ld[ldPast_id])
    {
        rg_set_user_model(ld[ldId], default_model[ud[id][udModel] - 1][random(sizeof default_model[])]);
    }
}

public set_user_model(id, infobuffer[], new_model[])
{
    if(id == ld[ldId])
    {
        SetHookChainArg(3, ATYPE_STRING, custom_model[ud[id][udModel] - 1][random(sizeof custom_model[])]);
    }
    else if(id == ld[ldPast_id])
    {
        SetHookChainArg(3, ATYPE_STRING, default_model[ud[id][udModel] - 1][random(sizeof default_model[])]);
    }
}

public task_round_end()
{
    new u_i[MAX_CLIENTS],
        u_n;
    get_players(u_i, u_n, "h");
    new data[3];
    data[dId] = u_i[0];
    data[dKills] = ud[u_i[0]][udKills];
    data[dDamage] = ud[u_i[0]][udDamage];
    ud[u_i[0]][udKills] = 0;
    ud[u_i[0]][udDamage] = 0;
    if(cd[cvar_mode] == 0)
    {
        for(new i = 1; i < u_n; i++)
        {
            if(ud[u_i[i]][udKills] > data[dKills] || ud[u_i[i]][udKills] == data[dKills] && ud[u_i[i]][udDamage] > data[dDamage])
            {
                data[dId] = u_i[i];
                data[dKills] = u_i[i];
                data[dDamage] = u_i[i];
            }
            ud[u_i[i]][udKills] = 0;
            ud[u_i[i]][udDamage] = 0;
        }
        if(data[dKills] > ld[ldKills] || data[dKills] == ld[ldKills] && data[dDamage] > ld[ldDamage])
        {
            if(data[dId] == ld[ldId])
            {
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
+                client_print_color(0, print_team_default, "%L", "ru", "Q", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
            }
            else
            {
                ld[ldPast_id] = ld[ldId];
                ld[ldId] = data[dId];
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
+                client_print_color(0, print_team_default, "%L", "ru", "W", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
            }
        }
        else
        {
            if(ld[ldId] < 1 || ld[ldId] > max_users)
            {
+                client_print_color(0, print_team_default, "%L", "ru", "E");
            }
            else
            {
+                client_print_color(0, print_team_default, "%L", "ru", "R", get_user_nickname(ld[ldId]));
            }
        }
    }
    else
    {
        for(new i = 1; i < u_n; i++)
        {
            if(ud[u_i[i]][udDamage] > data[dDamage] || ud[u_i[i]][udDamage] == data[dDamage] && ud[u_i[i]][udKills] > data[dKills])
            {
                data[dId] = u_i[i];
                data[dKills] = u_i[i];
                data[dDamage] = u_i[i];
            }
            ud[u_i[i]][udKills] = 0;
            ud[u_i[i]][udDamage] = 0;
        }
        if(data[dDamage] > ld[ldDamage] || data[dDamage] == ld[ldDamage] && data[dKills] > ld[ldKills])
        {
            if(data[dId] == ld[ldId])
            {
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
+                client_print_color(0, print_team_default, "%L", "ru", "1", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
            }
            else
            {
                ld[ldPast_id] = ld[ldId];
                ld[ldId] = data[dId];
                ld[ldKills] = data[dKills];
                ld[ldDamage] = data[dDamage];
+                client_print_color(0, print_team_default, "%L", "ru", "2", get_user_nickname(data[dId]), data[dKills], data[dDamage]);
            }
        }
        else
        {
            if(ld[ldId] < 1 || ld[ldId] > max_users)
            {
+                client_print_color(0, print_team_default, "3", "ru");
            }
            else
            {
+                client_print_color(0, print_team_default, "4", "ru", get_user_nickname(ld[ldId]));
            }
        }
    }
}

get_user_nickname(id)
{
+    new nickname[MAX_NAME_LENGTH];
+    get_entvar(id, var_netname, nickname, charsmax(nickname));
    return nickname;
}
В качестве временного решения ошибки Index out of bounds, было добавлено:
Код:
public user_choose_appearance(const id, slot)
{
+    if(slot == 5)
+    {
+        slot = random(5);
+    }
    if(get_member(id, m_iTeam) == TEAM_TERRORIST)
    {
        ud[id][udModel] = slot;
    }
    else if(get_member(id, m_iTeam) == TEAM_CT)
    {
        ud[id][udModel] = 4 + slot;
    }
}
Некоторые изменения были добавлены с расчетом на будующие обновления
Сверху Снизу