Vip menu открывается при возрождении игрока как убрать?

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
19
Реакции
0
Ошибка
нет
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5262 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Oct 23 2019 07:26:46
Built from: https://github.com/alliedmodders/amxmodx/commit/be3f2f5
Build ID: 5262:be3f2f5
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.12.0.780-dev
Build date: 18:40:12 Oct 05 2022 (3098)
Build from: https://github.com/dreamstalker/rehlds/commit/d6ebe82
ReGamedll
ReGameDLL version: 5.21.0.556-dev
Build date: 08:43:58 Jul 22 2022
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/1081301
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] SafeNameAndChat RUN - SafeNameAndChat.so v1.1 ini ANY ANY
[ 2] Reunion RUN - reunion_mm_i386.so v0.1.92d ini Start Never
[ 3] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5262 ini Start ANY
[ 4] Revoice RUN - revoice_mm_i386.so v0.1.0.34 ini Start Never
[ 5] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 6] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 7] WHBlocker RUN - whblocker_mm_i386.so v1.5.697 ini Chlvl ANY
[ 8] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 9] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9+MA ini Chlvl ANY
[10] MySQL RUN - mysql_amxx_i386.so v1.9.0.5262 pl3 ANY ANY
[11] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5262 pl3 ANY ANY
[12] CSX RUN - csx_amxx_i386.so v1.9.0.5262 pl3 ANY ANY
[13] ReAPI RUN - reapi_amxx_i386.so v5.21.0.252-dev pl3 ANY Never
[14] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5262 pl3 ANY ANY
[15] SxGeo RUN - sxgeo_amxx_i386.so v2.2 pl3 ANY Never
[16] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl3 ANY Never
[17] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5262 pl3 ANY ANY
[18] Fun RUN - fun_amxx_i386.so v1.9.0.5262 pl3 ANY ANY
[19] Engine RUN - engine_amxx_i386.so v1.9.0.5262 pl3 ANY ANY
Список плагинов
[  1] Admin Loader            3.5         neygomon          admin_loader.am  running  
[ 2] FreshBans 1.4.7b kanagava fresh_bans.amxx running
[ 3] Admin Commands 1.9.0.5262 AMXX Dev Team admincmd.amxx running
[ 4] Admin Help 1.9.0.5262 AMXX Dev Team adminhelp.amxx running
[ 5] Slots Reservation 1.9.0.5262 AMXX Dev Team adminslots.amxx running
[ 6] Multi-Lingual System 1.9.0.5262 AMXX Dev Team multilingual.am running
[ 7] menufront 2.0 edit by a!max menufront.amxx running
[ 8] Commands Menu 1.9.0.5262 AMXX Dev Team cmdmenu.amxx running
[ 9] Players Menu 1.9.0.5262 AMXX Dev Team plmenu.amxx running
[ 10] Maps Menu 1.9.0.5262 AMXX Dev Team mapsmenu.amxx running
[ 11] Plugin Menu 1.9.0.5262 AMXX Dev Team pluginmenu.amxx running
[ 12] Admin Chat 1.9.0.5262 AMXX Dev Team adminchat.amxx running
[ 13] Anti Flood 1.9.0.5262 AMXX Dev Team antiflood.amxx running
[ 14] Scrolling Message 1.9.0.5262 AMXX Dev Team scrollmsg.amxx running
[ 15] Info. Messages 1.9.0.5262 AMXX Dev Team imessage.amxx running
[ 16] Admin Votes 1.9.0.5262 AMXX Dev Team adminvote.amxx running
[ 17] Pause Plugins 1.9.0.5262 AMXX Dev Team pausecfg.amxx running
[ 18] Stats Configuration 1.9.0.5262 AMXX Dev Team statscfg.amxx running
[ 19] Restrict Weapons 1.8.1.3746 AMXX Dev Team restmenu.amxx running
[ 20] [SxGeo] Connect Info 1.0 s1lent sxgeo_connect_i running
[ 21] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 22] Smoke FIX 0.1 many Smoke_FIX.amxx running
[ 23] [ReAPI] Healthnade 0.0.7f F@nt0M + mx?! + reapi_healthnad running
[ 24] Advanced Kill Assists 1.3c Xelson kill_assist.amx running
[ 25] VIP Menu [CS RAIN] 0.15 Leo_[BH] vip_menu.amxx running
[ 26] VIP Score Board 1.0 Leo_[BH] vip_score_board running
[ 27] [GM] VIP Test 1.2.0 [GM] NWC gm_vip_test.amx running
[ 28] Mode 2x2 2.5re s1lent mode.amxx running
[ 29] Revive/Mined Die Playe 2.3.9 Emma Jule revive_teammate running
[ 30] Demo Recorder 2.4.1 F@nt0M demo_recorder.a running
[ 31] [ReAPI] No Team Flash 0.0.3 Vaqtincha no_team_flash.a running
[ 32] Custom Smoke 1.07 bionext custom_smoke.am running
[ 33] recoil_manager 1.0.0 fl0wer recoil_manager. running
[ 34] Server Menu 1.0 mx?! server_menu.amx running
[ 35] SlayNoobs 1.0 neygomon slay_noobs.amxx running
[ 36] Chat Manager 1.1.2-16 Mistrick chatmanager.amx running
[ 37] Reset Score 0.2 Silenttt / CepeH RESET_SCORE_V0. running
[ 38] Auto Team Balance Adva 1.5.1 Radius auto_team_balan running
[ 39] AFK Control 1.0 mx?! afk_control.amx running
[ 40] RockTheVote 1.8 DA rockthevote_cus running
[ 41] Killa HP 1.6 jas0n killa_hp.amxx running
[ 42] Blue Fade 0.1 Stimul Blue_Fade.amxx running
[ 43] C4 CD Voice 1.1 c4timer_for_dv-z c4.amxx running
[ 44] [ReAPI] Block 'Fire in 0.0.1 sergrib reapi_block_FIT running
[ 45] Admin Spectator ESP 1.3 KoST admin_spec_esp. running
[ 46] Autoresponder/Advertis 0.5 MaximusBrood ad_manager.amxx running
[ 47] Top Round Damage 1.0.4 ReAP Dager* *.* -G- damage_round.am running
[ 48] Auto VIP [STEAM] 1.1 ArtHa auto_steam_vip. running
[ 49] [ReAPI] Custom Models 1.6.1 neugomon custom_models.a running
[ 50] Kill's Like CS Online 0.1 fl0wer kills_like_cso. running
[ 51] Admin Gag 1.0 AndrewZ admin_gag.amxx running
[ 52] Parachute for ALL [ReA 3.0 Leo_[BH] parachute_for_a running
[ 53] Me_Hp_StatsX 1.3 AMXX Dev Team & me_hp_statsx.am running
[ 54] Info Rank 4.0 UFPS.Team info_ranki.amxx running
[ 55] mute menu 1.0 cheap_suit mutemenu.amxx running
[ 56] Simple Damager 2.1.0 fl0wer simple_damager. running
[ 57] GameName 1.0 Lonkura GameName.amxx running
[ 58] WarmUP Pro 5.6 Beta ReymonARG warmuppro.amxx running
[ 59] SF Bets 0.1.5 serfreeman1337 sf_bets.amxx running
[ 60] Advanced MapChooser 1.4 neygomon mapsku.amxx running
[ 61] Models Replacement 0.0.2 ConnorMcLeod | V models_replacem running
[ 62] WelcomeMusic 1.0 My_StyLe^ wcm_music.amxx running
[ 63] Played Time 1.3 Alka played_time.amx debug
[ 64] Time Bonus 1.1 SKOBAR1K time_bonus.amxx running
[ 65] Bomb Timer 3.2 Twe3k plent_bomb.amxx running
[ 66] Top Awards 0.11h Safety1st top_awards.amxx running
[ 67] Advanced System Quests 2.0.2 6u3oH reapi_asq.amxx running
[ 68] Yet Another Voteban 1.8 AndrewZ/voed yet_another_vot running
[ 69] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 70] CSStatsX SQL 0.7.4+2 serfreeman1337 csstatsx_sql.am running
[ 71] AES: StatsX 0.5+1 serfreeman1337 aes_statsx_cstr running
[ 72] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 73] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 74] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 75] AES: Bonus System 0.5.9 Vega serfreeman1337/s aes_bonus_syste running
[ 76] AES: Bonus CSTRIKE 0.5.9.1 [R serfreeman1337/s aes_bonus_cstri running
Автор плагина
leo
Версия плагина
0.15
Исходный код
#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 = 4, 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();
}
}
}
}
Здравствуйте помогите настроить плагин чтоб меню вип не выскакивало при поднятии игрока по среди раунда! А выскакивало только вначале! Заранее спасибо
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
1,082
Реакции
58
Помог
11 раз(а)
Pavluha913, добавить проверку if(time_open_to_menu - get_gametime()) {/*code*/}
Код:
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) && time_open_to_menu - get_gametime()) {
        if(round >= get_pcvar_num(cvar_round_primary))
            open_vipmenu(id)
    }
}
 
Сообщения
594
Реакции
350
Предупреждения
1
Помог
9 раз(а)
Код:
if(get_member(id, m_iNumSpawns) > 1) return;
 
Сообщения
19
Реакции
0
@Code_0xABC,спасибо твое скомпилировал но не заработало(((
10 Апр 2023
@steelzzz,Спасибо с твоим не компилирует((
10 Апр 2023
vip_menu.sma(135) : error 017: undefined symbol "get_member"
vip_menu.sma(136) : warning 217: loose indentation
10 Апр 2023
Code_0xABC,

vip_menu.sma(135) : error 017: undefined symbol "get_member"
vip_menu.sma(136) : warning 217: loose indentation
10 Апр 2023
Код:
// Автор плагина: Leo_[BH] (http://vk.com/id64427766)
// Создание плагинов на заказ: https://vk.com/cs_rain


#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) && time_open_to_menu - get_member(id, m_iNumSpawns) > 1) return;
        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 = 4, 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();
            }
        }
    }
}
 
Сообщения
19
Реакции
0
@steelzzz,можешь пожалуйста скинуть код
10 Апр 2023
@Code_0xABC,можешь пожалуйста скинуть код
 
Сообщения
1,082
Реакции
58
Помог
11 раз(а)
Pavluha913, во втором посте я все подставил, осталось скопировать и заменить у себя!!!
Второй вариант, (-) убрать строку, (+) добавить строку
Код:
+#include <reapi>

-new Float:time_open_to_menu, cvar_opentime_menu;

public plugin_init() {
    -cvar_opentime_menu = register_cvar("vipmenu_open_time", "30");
}

public event_round_start() {
    -time_open_to_menu = get_gametime() + get_pcvar_float(cvar_opentime_menu);
}

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))
            +if(get_member(id, m_iNumSpawns) > 1)
                +return;

            open_vipmenu(id);
    }
}
Плюс ко всему установленный модуль Reapi на сервере и в твоем компиляторе соответствующие (inc)
 
Последнее редактирование:
Сообщения
19
Реакции
0
Pavluha913,
Код:
// Автор плагина: Leo_[BH] (http://vk.com/id64427766)
// Создание плагинов на заказ: https://vk.com/cs_rain


#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>
#include <reapi>

#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_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)
}

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))
            #include <reapi>
                #include <reapi>

            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 = 4, 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();
            }
        }
    }
}
11 Апр 2023
@Pavluha913,смотри сделал вот так все скомпилировалось но меню все равно выскакивает но недоступно серым цветом(
 
Сообщения
893
Реакции
149
Помог
25 раз(а)
Pavluha913, зачем ты 2 раза инклюд впихнул, куда нужна проверка?
Изменение в 135, 136 строке.
C++:
// Автор плагина: Leo_[BH] (http://vk.com/id64427766)
// Создание плагинов на заказ: https://vk.com/cs_rain


#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>
#include <reapi>

#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_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)
}

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(get_member(id, m_iNumSpawns) > 1)
            return;

        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 = 4, 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();
            }
        }
    }
}
 
Сообщения
19
Реакции
0
ImmortalAmxx, вот твое не выдает после воскрешения но сцуко не доступно в начале серым цветом
11 Апр 2023
@ImmortalAmxx,ну я чисто твое взял и скопировал не чего не изменял!
 
Сообщения
19
Реакции
0
@ImmortalAmxx,Все огромное спасибо ты все правильно скинул ну пару строк не хватало теперь все допилили и все заработало!!! Спасибо еще раз огромное!!!
Код:
// Автор плагина: Leo_[BH] (http://vk.com/id64427766)
// Создание плагинов на заказ: https://vk.com/cs_rain


#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>
#include <reapi>

#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",    "15")
    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(get_member(id, m_iNumSpawns) > 1)
            return;

        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 = 4, 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();
            }
        }
    }
}
 
Сообщения
893
Реакции
149
Помог
25 раз(а)
Pavluha913, не мне спасибо, а другим людям, которые навели тебя на код, я лишь "слипил" его.
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу