Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New ConVar: redm_hide_hostages #134

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cstrike/addons/amxmodx/configs/redm/gamemode_deathmatch.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@
In seconds. */
"redm_changeteam_freq": "2.0",

// Hide hostages.
"redm_hide_hostages": 1,

/* Number of times a team can
have players respawn before they stop
being able to respawn.
Expand Down
31 changes: 31 additions & 0 deletions cstrike/addons/amxmodx/scripting/ReDeathmatch/ReDM_features.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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)
}
}