From 4ef0e30c2884ccb61894760dc986fb9f6d60b234 Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Mon, 6 Jan 2020 20:18:49 +0100 Subject: [PATCH] Effect hooks bug fix --- gamemode/engine/lib/sh_effects.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gamemode/engine/lib/sh_effects.lua b/gamemode/engine/lib/sh_effects.lua index 39092e6..6c0843f 100644 --- a/gamemode/engine/lib/sh_effects.lua +++ b/gamemode/engine/lib/sh_effects.lua @@ -51,9 +51,14 @@ if SERVER then -- server only functions function Quantum.Effect.RemoveRuntimeFunction( pl, effectid, hookID ) hookID = hookID || "Quantum_Effects_RunTime_" .. tostring(pl:SteamID64()) .. "_" .. tostring(effectid) - Quantum.Debug( "Removing runtime effect hook: " .. hookID ) + --Quantum.Debug( "Removing runtime effect hook: " .. hookID ) - pl.effecthooks[hookID] = nil + if( pl.effecthooks != nil ) then + PrintTable( pl.effecthooks ) + if( pl.effecthooks[hookID] != nil ) then + pl.effecthooks[hookID] = nil + end + end hook.Remove( "Think", hookID ) end @@ -63,6 +68,9 @@ if SERVER then -- server only functions for n, hookid in pairs( pl.effecthooks ) do Quantum.Effect.RemoveRuntimeFunction( pl, nil, hookid ) end + pl.effecthooks = {} + else + return end end