Skip to content

Commit

Permalink
ConVar redm_spawn_preset hot change support
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyShorokhov committed Mar 27, 2024
1 parent fd9f9f5 commit cb94725
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cstrike/addons/amxmodx/scripting/ReDeathmatch/ReDM_api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ public bool: native_redm_setstyle(const plugin_id, const argc) {
}
}

// TODO: rework
log_error(AMX_ERR_NOTFOUND, "Spawn preset style `%s` not found!", name)
return false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ SpawnManager_Init() {
redm_spawn_preset,
charsmax(redm_spawn_preset)
)
hook_cvar_change(get_cvar_pointer("redm_spawn_preset"), "CvarChange_redm_spawn_preset")

RegisterHookChain(RG_CSGameRules_GetPlayerSpawnSpot, "CSGameRules_GetPlayerSpawnSpot", .post = false)

redm_setstyle(redm_spawn_preset)
}

public CvarChange_redm_spawn_preset(const cvar, const oldValue[], const value[]) {
redm_setstyle(value)
}

public CSGameRules_GetPlayerSpawnSpot(const player) {
if (!IsActive())
return HC_CONTINUE
Expand Down

0 comments on commit cb94725

Please sign in to comment.