Imported fix from dev: 661:dbb2ad84eb58 - Fixed a bug where zr_suicide_cmds was being ignored and only the default value was being used.

This commit is contained in:
Richard Helgeby 2010-02-14 17:26:28 +01:00
parent 04a8fef584
commit 950a8f9e41
3 changed files with 12 additions and 2 deletions

View File

@ -211,6 +211,7 @@ public OnConfigsExecuted()
WeaponsLoad(); WeaponsLoad();
HitgroupsLoad(); HitgroupsLoad();
InfectLoad(); InfectLoad();
DamageLoad();
VEffectsLoad(); VEffectsLoad();
SEffectsLoad(); SEffectsLoad();
AntiStickLoad(); AntiStickLoad();

View File

@ -54,5 +54,4 @@ CommandsInit()
// Forward event to modules. (hook commands) // Forward event to modules. (hook commands)
ClassOnCommandsHook(); ClassOnCommandsHook();
DamageOnCommandsHook();
} }

View File

@ -65,9 +65,16 @@ new bool:g_bDamageMotherZombie[MAXPLAYERS + 1];
/** /**
* Hook commands related to damage here. * 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. // Create command callbacks (intercepts) for listed suicide commands.
decl String:suicidecmds[DAMAGE_SUICIDE_MAX_CMDS * DAMAGE_SUICIDE_MAX_LENGTH]; decl String:suicidecmds[DAMAGE_SUICIDE_MAX_CMDS * DAMAGE_SUICIDE_MAX_LENGTH];
GetConVarString(g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS], suicidecmds, sizeof(suicidecmds)); GetConVarString(g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS], suicidecmds, sizeof(suicidecmds));
@ -88,6 +95,9 @@ DamageOnCommandsHook()
// Prepare intercept for this command. // Prepare intercept for this command.
RegConsoleCmd(arrayCmds[x], DamageSuicideIntercept); 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;
} }
/** /**