From 9548e4bd877f722091c079e640e0158d1f0e69e2 Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Tue, 24 Sep 2024 16:44:35 +0300 Subject: [PATCH] New ConVar: `redm_hide_hostages` --- .../scripting/ReDeathmatch/ReDM_features.inc | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/cstrike/addons/amxmodx/scripting/ReDeathmatch/ReDM_features.inc b/cstrike/addons/amxmodx/scripting/ReDeathmatch/ReDM_features.inc index 4c46042..d699de1 100644 --- a/cstrike/addons/amxmodx/scripting/ReDeathmatch/ReDM_features.inc +++ b/cstrike/addons/amxmodx/scripting/ReDeathmatch/ReDM_features.inc @@ -22,6 +22,7 @@ static redm_protection_color_ct[32] static bool: mp_respawn_immunity_effects static bool: redm_changeteam_unlimited static Float: redm_changeteam_freq +static bool: redm_hide_hostages Features_Precache() { AimBarriers_Precache() @@ -49,6 +50,7 @@ Features_Init() { RegisterHookChain(RG_ShowVGUIMenu, "ShowVGUIMenu_Pre", .post = false) RegisterHookChain(RG_HandleMenu_ChooseTeam, "HandleMenu_ChooseTeam_Pre", .post = false) RegisterHookChain(RG_HandleMenu_ChooseTeam, "HandleMenu_ChooseTeam", .post = true) + RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound_Post", .post = true) AimBarriers_Init() Tickets_Init() @@ -190,6 +192,17 @@ Features_Init() { ), redm_changeteam_freq ) + bind_pcvar_num( + create_cvar( + "redm_hide_hostages", + "1", + .has_min = true, .min_val = 0.0, + .has_max = true, .max_val = 1.0, + .flags = _FCVAR_BOOLEAN, + .description = "Hide hostages." + ), + redm_hide_hostages + ) } public MsgHook_HudTextArgs() { @@ -538,3 +551,21 @@ stock WeaponIdType: GetCurrentWeapon(const player) { return WeaponIdType: get_member(activeItem, m_iId) } + +public CSGameRules_RestartRound_Post() { + if (!IsActive()) + return + + if (redm_hide_hostages) + HideHostages() +} + +HideHostages() { + new entity = NULLENT + while ((entity = fm_find_ent_by_class(entity, "hostage_entity"))) { + new Float: origin[3] + get_entvar(entity, var_origin, origin) + xs_vec_add(origin, Float: {0.0, 0.0, -8192.0}, origin) + set_entvar(entity, var_origin, origin) + } +}