• Гость, перед открытием темы прочитай описание раздела, чтобы не ошибиться. Любые вопросы по настройке сервера создаются в разделе Технической Поддержки.
VIP Menu [CS RAIN]

AmxModX VIP Menu [CS RAIN] 0.15

Нет прав для скачивания
C++:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>

#define PLUGIN_VERSION "0.15"

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

new const pistols[6] = {CSW_GLOCK18, CSW_USP, CSW_P228, CSW_DEAGLE, CSW_FIVESEVEN, CSW_ELITE}
new const primary[18] = {CSW_SCOUT, CSW_XM1014, CSW_MAC10, CSW_AUG, CSW_UMP45, CSW_SG550, CSW_GALIL, CSW_FAMAS, CSW_AWP,
CSW_MP5NAVY, CSW_M249, CSW_M3, CSW_M4A1, CSW_TMP, CSW_G3SG1, CSW_SG552, CSW_AK47, CSW_P90}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

new g_msg_SayText

new cvar_flag, cvar_round_primary, cvar_round_awp, cvar_grenadepack_limit, cvar_opentime_menu, cvar_auto_open, cvar_chat_show, cvar_custom_type

new bool:map_blocked
new round
new Float:time_open_to_menu

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

new const pistols_names[7][] = { "", "GLOCK18", "USP", "P228", "DEAGLE", "FIVESEVEN", "ELITE" }
new const pistols_entnames[7][] = { "", "weapon_glock18", "weapon_usp", "weapon_p228", "weapon_deagle", "weapon_fiveseven", "weapon_elite" }
new const bpammo_pistol[7] = { -1, 120, 100, 52, 35, 100, 100 }

new i_pistol[33]

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

new const armor_names[][] = { "Без брони", "Бронежилет", "Бронежилет + Шлем" }

new i_armor[33]

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

new const nade_names[][] = { "Без гранат", "Все гранаты", "Световые", "Боевая", "Дымовая", "Боевая + Световые" }

new i_nades[33]

new i_round_grenades[33]

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

public plugin_precache()
{
    map_check()
}

public plugin_init()
{
    register_plugin("VIP Menu [CS RAIN]", PLUGIN_VERSION, "Leo_[BH]")
    
    register_cvar("cs_rain_vipmenu", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
    
    // [data/lang]
    register_dictionary("vip.txt")
    
    // Cvars
    cvar_flag = register_cvar("vipmenu_access",    "t")
    cvar_round_primary = register_cvar("vipmenu_round_primary",    "2")
    cvar_round_awp = register_cvar("vipmenu_round_awp",    "3")
    cvar_grenadepack_limit = register_cvar("vipmenu_grenade_limit",    "4")
    cvar_opentime_menu = register_cvar("vipmenu_open_time",    "30")
    cvar_auto_open = register_cvar("vipmenu_auto_open",    "1")
    cvar_chat_show = register_cvar("vipmenu_chat_show",    "1")
    cvar_custom_type = register_cvar("vipmenu_custom_type",    "3")
    
    // Client Commands
    register_clcmd("vipmenu", "vipmenu")
    register_clcmd("say vipmenu", "vipmenu")
    register_clcmd("say /vipmenu", "vipmenu")
    register_clcmd("say_team vipmenu", "vipmenu")
    register_clcmd("say_team /vipmenu", "vipmenu")
    
    // Messages
    g_msg_SayText = get_user_msgid("SayText")
    
    if(!map_blocked)
    {
        // Events
        register_event("TextMsg", "event_game_restart", "a", "2=#Game_will_restart_in")
        register_event("TextMsg", "event_game_restart", "a", "2=#Game_Commencing")
        register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
        
        // Player Spawn
        RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
        // RegisterHookChain(RG_CBasePlayer_Spawn, "fw_PlayerSpawn_Post", 1)
    }
}

public plugin_cfg()
{
    server_cmd("exec addons/amxmodx/configs/vip/vip.cfg")
}

public event_game_restart()
{
    round = 0
}

public event_round_start()
{
    round++
    arrayset(i_round_grenades, get_pcvar_num(cvar_grenadepack_limit), 33)
    time_open_to_menu = get_gametime() + get_pcvar_float(cvar_opentime_menu)
}

public client_connect(id)
{
    i_pistol[id] = 4 // дигл
    i_armor[id] = 2 // броня + шлем
    i_nades[id] = 1 // все гранаты
}

public fw_PlayerSpawn_Post(id)
{
    if(!is_user_alive(id)) return;
    
    if(!has_access_vipmenu(id)) return;
    
    give_my_pistol(id)
    give_my_armor(id)
    give_my_grenades(id)
    
    if(get_pcvar_num(cvar_auto_open)) if(round >= get_pcvar_num(cvar_round_primary)) open_vipmenu(id)
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

public vipmenu(id)
{
    if(map_blocked)
    {
        chat_color(id, "%L %L", id, "VIP_CHAT_PREFIX", id, "VIP_CHAT_MAP_BLOCKED")
        return PLUGIN_HANDLED;
    }
    
    if(!has_access_vipmenu(id))
    {
        chat_color(id, "%L %L", id, "VIP_CHAT_PREFIX", id, "VIP_CHAT_NOT_ACCESS")
        return PLUGIN_HANDLED;
    }
    
    open_vipmenu(id)
    
    return PLUGIN_HANDLED;
}

public open_vipmenu(id)
{
    static text_vip_menu[9][64]
    formatex(text_vip_menu[0], 63, "%L", id, "VIP_MENU_0")

    new r_prim = get_pcvar_num(cvar_round_primary)
    new r_awp = get_pcvar_num(cvar_round_awp)

    if(round < r_awp)
    {
        formatex(text_vip_menu[1], 63, "\d%L \r[\d%d %s\r]", id, "VIP_MENU_1", r_awp, "раунд")
    }
    else if(!is_user_alive(id))
    {
        formatex(text_vip_menu[1], 63, "\d%L", id, "VIP_MENU_1")
    }
    else if(get_gametime() > time_open_to_menu)
    {
        formatex(text_vip_menu[1], 63, "\d%L", id, "VIP_MENU_1")
    }
    else
    {
        formatex(text_vip_menu[1], 63, "\w%L", id, "VIP_MENU_1")
    }

    if(round < r_prim)
    {
        formatex(text_vip_menu[2], 63, "\d%L \r[\d%d %s\r]", id, "VIP_MENU_2", r_prim, "раунд")
        formatex(text_vip_menu[3], 63, "\d%L \r[\d%d %s\r]", id, "VIP_MENU_3", r_prim, "раунд")
        formatex(text_vip_menu[4], 63, "\d%L \r[\d%d %s\r]^n", id, "VIP_MENU_4", r_prim, "раунд")
    }
    else if(!is_user_alive(id))
    {
        formatex(text_vip_menu[2], 63, "\d%L", id, "VIP_MENU_2")
        formatex(text_vip_menu[3], 63, "\d%L", id, "VIP_MENU_3")
        formatex(text_vip_menu[4], 63, "\d%L^n", id, "VIP_MENU_4")
    }
    else if(get_gametime() > time_open_to_menu)
    {
        formatex(text_vip_menu[2], 63, "\d%L", id, "VIP_MENU_2")
        formatex(text_vip_menu[3], 63, "\d%L", id, "VIP_MENU_3")
        formatex(text_vip_menu[4], 63, "\d%L^n", id, "VIP_MENU_4")
    }
    else
    {
        formatex(text_vip_menu[2], 63, "\w%L", id, "VIP_MENU_2")
        formatex(text_vip_menu[3], 63, "\w%L", id, "VIP_MENU_3")
        formatex(text_vip_menu[4], 63, "\w%L^n", id, "VIP_MENU_4")
    }
    
    new custom_type = get_pcvar_num(cvar_custom_type)
    clamp(custom_type, 0, 3)

    if(custom_type >= 1) formatex(text_vip_menu[5], 63, "%L", id, "VIP_MENU_5", pistols_names[i_pistol[id]])
    if(custom_type >= 2) formatex(text_vip_menu[6], 63, "%L", id, "VIP_MENU_6", armor_names[i_armor[id]])
    if(custom_type >= 3) formatex(text_vip_menu[7], 63, "%L", id, "VIP_MENU_7", nade_names[i_nades[id]])
    formatex(text_vip_menu[8], 63, "%L", id, "VIP_MENU_EXIT")

    new menu = menu_create(text_vip_menu[0], "hand_vipmenu")

    for (new n = 1; n <= 4+custom_type; n++)
    {
        new Number[4]
        formatex(Number, charsmax(Number), "%i", n)
        menu_additem(menu, text_vip_menu[n], Number, 0)
    }

    menu_setprop(menu, MPROP_EXITNAME, text_vip_menu[8])
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)

    menu_display(id, menu, 0)

    return PLUGIN_HANDLED;
}

public hand_vipmenu(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }
    
    new data[6], iName[64], access, callback
    menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
    
    new key = str_to_num(data)
    
    switch(key)
    {
        case 1:
        {
            if(!is_user_alive(id)) return PLUGIN_HANDLED
            
            if(round < get_pcvar_num(cvar_round_awp))
            {
                open_vipmenu(id)
                return PLUGIN_HANDLED
            }
            
            if(get_gametime() > time_open_to_menu)
            {
                client_print(id, print_center, "%L", id, "VIP_MSG_TIME", get_pcvar_num(cvar_opentime_menu))
                open_vipmenu(id)
                return PLUGIN_HANDLED
            }
            
            give_primary_weapon(id, 1)
            give_my_pistol(id)
            give_my_armor(id)
            give_my_grenades(id)
        }
        case 2:
        {
            if(!is_user_alive(id)) return PLUGIN_HANDLED
            
            if(round < get_pcvar_num(cvar_round_primary))
            {
                open_vipmenu(id)
                return PLUGIN_HANDLED
            }
            
            if(get_gametime() > time_open_to_menu)
            {
                client_print(id, print_center, "%L", id, "VIP_MSG_TIME", get_pcvar_num(cvar_opentime_menu))
                open_vipmenu(id)
                return PLUGIN_HANDLED
            }
            
            give_primary_weapon(id, 2)
            give_my_pistol(id)
            give_my_armor(id)
            give_my_grenades(id)
        }
        case 3:
        {
            if(!is_user_alive(id)) return PLUGIN_HANDLED
            
            if(round < get_pcvar_num(cvar_round_primary))
            {
                open_vipmenu(id)
                return PLUGIN_HANDLED
            }
            
            if(get_gametime() > time_open_to_menu)
            {
                client_print(id, print_center, "%L", id, "VIP_MSG_TIME", get_pcvar_num(cvar_opentime_menu))
                open_vipmenu(id)
                return PLUGIN_HANDLED
            }
            
            give_primary_weapon(id, 3)
            give_my_pistol(id)
            give_my_armor(id)
            give_my_grenades(id)
        }
        case 4:
        {
            if(!is_user_alive(id)) return PLUGIN_HANDLED
            
            if(round < get_pcvar_num(cvar_round_primary))
            {
                open_vipmenu(id)
                return PLUGIN_HANDLED
            }
            
            if(get_gametime() > time_open_to_menu)
            {
                client_print(id, print_center, "%L", id, "VIP_MSG_TIME", get_pcvar_num(cvar_opentime_menu))
                open_vipmenu(id)
                return PLUGIN_HANDLED
            }
            
            give_primary_weapon(id, 4)
            give_my_pistol(id)
            give_my_armor(id)
            give_my_grenades(id)
        }
        
        case 5:
        {
            open_pistol_menu(id)
        }
        case 6:
        {
            open_armor_menu(id)
        }
        case 7:
        {
            open_nade_menu(id)
        }
    }
    
    return PLUGIN_HANDLED;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

public open_pistol_menu(id)
{
    new menu = menu_create("\rВыбор пистолета\y:\w", "hand_pistol_menu")
    
    for (new n = 1; n <= 6; n++)
    {
        new Number[4]
        formatex(Number, charsmax(Number), "%i", n)
        menu_additem(menu, pistols_names[n], Number, 0)
    }
    
    menu_setprop(menu, MPROP_EXITNAME, "\rОтмена")
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)

    menu_display(id, menu, 0)
    
    return PLUGIN_HANDLED;
}

public hand_pistol_menu(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu)
        open_vipmenu(id)
        return PLUGIN_HANDLED
    }
    
    new data[6], iName[64], access, callback
    menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
    
    new key = str_to_num(data)
    
    if(1 <= key <= 6)
    {
        i_pistol[id] = key
        
        if(is_user_alive(id)) if(get_gametime() <= time_open_to_menu) give_my_pistol(id)
        
        open_vipmenu(id)
    }
    
    return PLUGIN_HANDLED;
}

public open_armor_menu(id)
{
    new menu = menu_create("\rВыбор брони\y:\w", "hand_armor_menu")
    
    for (new n = 1; n <= 3; n++)
    {
        new Number[4]
        formatex(Number, charsmax(Number), "%i", n)
        menu_additem(menu, armor_names[n-1], Number, 0)
    }
    
    menu_setprop(menu, MPROP_EXITNAME, "\rОтмена")
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)

    menu_display(id, menu, 0)
    
    return PLUGIN_HANDLED;
}

public hand_armor_menu(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu)
        open_vipmenu(id)
        return PLUGIN_HANDLED
    }
    
    new data[6], iName[64], access, callback
    menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
    
    new key = str_to_num(data)
    
    if(1 <= key <= 3)
    {
        i_armor[id] = key - 1
        
        if(is_user_alive(id)) give_my_armor(id)
        
        open_vipmenu(id)
    }
    
    return PLUGIN_HANDLED;
}

public open_nade_menu(id)
{
    new menu = menu_create("\rВыбор гранат\y:\w", "hand_grenade_menu")
    
    for (new n = 1; n <= 6; n++)
    {
        new Number[4]
        formatex(Number, charsmax(Number), "%i", n)
        menu_additem(menu, nade_names[n-1], Number, 0)
    }
    
    menu_setprop(menu, MPROP_EXITNAME, "\rОтмена")
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)

    menu_display(id, menu, 0)
    
    return PLUGIN_HANDLED;
}

public hand_grenade_menu(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu)
        open_vipmenu(id)
        return PLUGIN_HANDLED
    }
    
    new data[6], iName[64], access, callback
    menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
    
    new key = str_to_num(data)
    
    if(1 <= key <= 6)
    {
        i_nades[id] = key - 1
        
        // if(is_user_alive(id)) give_my_grenades(id)
        
        open_vipmenu(id)
    }
    
    return PLUGIN_HANDLED;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

public give_primary_weapon(id, num)
{
    switch(num)
    {
        case 1:
        {
            remove_primary(id)
            give_item(id, "weapon_awp")
            cs_set_user_bpammo(id, CSW_AWP, 30)
            
            if(!get_pcvar_num(cvar_chat_show)) return;
            
            new name[32]
            get_user_name(id, name, 31)
            chat_color(0, "%L !g%s !tвзял !gAWP !tчерез !gвипменю", id, "VIP_CHAT_PREFIX", name)
        }
        case 2:
        {
            remove_primary(id)
            give_item(id, "weapon_ak47")
            cs_set_user_bpammo(id, CSW_AK47, 90)
            
            if(!get_pcvar_num(cvar_chat_show)) return;
            
            new name[32]
            get_user_name(id, name, 31)
            chat_color(0, "%L !g%s !tвзял !gAK47 !tчерез !gвипменю", id, "VIP_CHAT_PREFIX", name)
        }
        case 3:
        {
            remove_primary(id)
            give_item(id, "weapon_m4a1")
            cs_set_user_bpammo(id, CSW_M4A1, 90)
            
            if(!get_pcvar_num(cvar_chat_show)) return;
            
            new name[32]
            get_user_name(id, name, 31)
            chat_color(0, "%L !g%s !tвзял !gM4A1 !tчерез !gвипменю", id, "VIP_CHAT_PREFIX", name)
        }
        case 4:
        {
            remove_primary(id)
            give_item(id, "weapon_famas")
            cs_set_user_bpammo(id, CSW_FAMAS, 90)
            
            if(!get_pcvar_num(cvar_chat_show)) return;
            
            new name[32]
            get_user_name(id, name, 31)
            chat_color(0, "%L !g%s !tвзял !gFAMAS !tчерез !gвипменю", id, "VIP_CHAT_PREFIX", name)
        }
    }
}

public give_my_pistol(id)
{
    remove_secondary(id)
    
    give_item(id, pistols_entnames[i_pistol[id]])
    
    cs_set_user_bpammo(id, pistols[i_pistol[id]-1], bpammo_pistol[i_pistol[id]])
}

public give_my_armor(id)
{
    switch(i_armor[id])
    {
        case 1: cs_set_user_armor(id, 100, CsArmorType:1)
        case 2: cs_set_user_armor(id, 100, CsArmorType:2)
    }
}

public give_my_grenades(id)
{
    if(i_nades[id] == 0)
        return;
    
    if(i_round_grenades[id] <= 0)
        return;
    
    switch(i_nades[id])
    {
        case 1:
        {
            give_item(id, "weapon_flashbang")
            give_item(id, "weapon_flashbang")
            give_item(id, "weapon_hegrenade")
            give_item(id, "weapon_smokegrenade")
        }
        case 2:
        {
            give_item(id, "weapon_flashbang")
            give_item(id, "weapon_flashbang")
        }
        case 3:
        {
            give_item(id, "weapon_hegrenade")
        }
        case 4:
        {
            give_item(id, "weapon_smokegrenade")
        }
        case 5:
        {
            give_item(id, "weapon_flashbang")
            give_item(id, "weapon_flashbang")
            give_item(id, "weapon_hegrenade")
        }
    }
    
    i_round_grenades[id]--
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

public remove_primary(id)
{
    for(new i = 0; i < 18; i++)
    {
        fm_strip_user_gun(id, primary[i])
    }
}

public remove_secondary(id)
{
    for(new i = 0; i < 6; i++)
    {
        fm_strip_user_gun(id, pistols[i])
    }
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

public map_check()
{
    new got_line, line_num, len
    new cfgpath[256],  mapname[64], txt[256]
    get_mapname(mapname, 63)

    format(cfgpath, 256, "addons/amxmodx/configs/vip/maps_block.ini")

    if (file_exists(cfgpath))
    {
        got_line = read_file(cfgpath, line_num, txt, 255, len)
        while (got_line>0)
        {
            if (containi(mapname, txt) != -1)
            {
                map_blocked = true
                return 1
            }
            line_num++
            got_line = read_file(cfgpath, line_num, txt, 255, len)
        }
    }
    
    return 0
}

stock bool:has_access_vipmenu(id)
{
    new u_flags[32]
    get_flags(get_user_flags(id), u_flags, 31)
    
    new g_szFlagMenu[32]
    get_pcvar_string(cvar_flag, g_szFlagMenu, 31)
    
    return (containi(u_flags,g_szFlagMenu) != -1) ? true : false
}

stock chat_color(const id, const input[], any:...)
{
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    replace_all(msg, 190, "!g", "^4"); // Green Color
    replace_all(msg, 190, "!y", "^1"); // Default Color
    replace_all(msg, 190, "!t", "^3"); // Team Color
    if (id) players[0] = id; else get_players(players, count, "ch");
    {
        for ( new i = 0; i < count; i++ )
        {
            if ( is_user_connected(players[i]) )
            {
                message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

// Автор плагина: Leo_[BH] - http://vk.com/id64427766
// Другие мои плагины: https://vk.com/cs_rain
Сверху