diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index 2d3a7d6..a365fb1 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -211,6 +211,7 @@ public OnConfigsExecuted() WeaponsLoad(); HitgroupsLoad(); InfectLoad(); + DamageLoad(); VEffectsLoad(); SEffectsLoad(); AntiStickLoad(); diff --git a/src/zr/commands.inc b/src/zr/commands.inc index 7cd9e8b..2fad823 100644 --- a/src/zr/commands.inc +++ b/src/zr/commands.inc @@ -54,5 +54,4 @@ CommandsInit() // Forward event to modules. (hook commands) ClassOnCommandsHook(); - DamageOnCommandsHook(); } diff --git a/src/zr/damage.inc b/src/zr/damage.inc index 7e66334..2f8d601 100644 --- a/src/zr/damage.inc +++ b/src/zr/damage.inc @@ -65,9 +65,16 @@ new bool:g_bDamageMotherZombie[MAXPLAYERS + 1]; /** * Hook commands related to damage here. + * Note: This isn't OnCommandsHook because this depends on cvars. */ -DamageOnCommandsHook() +new bool:g_bSuicideCmdsHooked = false; +DamageLoad() { + if (g_bSuicideCmdsHooked) + { + return; + } + // Create command callbacks (intercepts) for listed suicide commands. decl String:suicidecmds[DAMAGE_SUICIDE_MAX_CMDS * DAMAGE_SUICIDE_MAX_LENGTH]; GetConVarString(g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS], suicidecmds, sizeof(suicidecmds)); @@ -88,6 +95,9 @@ DamageOnCommandsHook() // Prepare intercept for this command. RegConsoleCmd(arrayCmds[x], DamageSuicideIntercept); } + + // Important: If ZR can be unloaded some day, make sure to remove the listeners and set this to false. + g_bSuicideCmdsHooked = true; } /**