diff --git a/sp/src/game/shared/mapbase/weapon_custom_scripted.cpp b/sp/src/game/shared/mapbase/weapon_custom_scripted.cpp index 4d5c744d334..33cf395958b 100644 --- a/sp/src/game/shared/mapbase/weapon_custom_scripted.cpp +++ b/sp/src/game/shared/mapbase/weapon_custom_scripted.cpp @@ -179,7 +179,7 @@ bool CWeaponCustomScripted::RunWeaponHook( ScriptHook_t &hook, HSCRIPT &cached, { if ( !cached ) { - if ( hook.CanRunInScope( m_ScriptScope ) ) + if ( m_ScriptScope.IsInitialized() && hook.CanRunInScope( m_ScriptScope ) ) { cached = hook.m_hFunc; } @@ -187,6 +187,7 @@ bool CWeaponCustomScripted::RunWeaponHook( ScriptHook_t &hook, HSCRIPT &cached, if (cached) { + hook.m_hFunc = cached; return hook.Call( m_ScriptScope, retVal, pArgs, false ); } @@ -334,7 +335,7 @@ void CWeaponCustomScripted::ItemPreFrame( void ) { SIMPLE_VOID_OVERRIDE( ItemPreFrame, NULL ); - BaseClass::ItemPostFrame(); + BaseClass::ItemPreFrame(); } void CWeaponCustomScripted::ItemPostFrame( void )