Skip to content

Commit f8d8cf6

Browse files
authored
Merge pull request #279 from samisalreadytaken/fix-weapon_custom_scripted
weapon_custom_scripted fixes
2 parents 02f8109 + a02f3db commit f8d8cf6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sp/src/game/shared/mapbase/weapon_custom_scripted.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,15 @@ bool CWeaponCustomScripted::RunWeaponHook( ScriptHook_t &hook, HSCRIPT &cached,
180180
{
181181
if ( !cached )
182182
{
183-
if ( hook.CanRunInScope( m_ScriptScope ) )
183+
if ( m_ScriptScope.IsInitialized() && hook.CanRunInScope( m_ScriptScope ) )
184184
{
185185
cached = hook.m_hFunc;
186186
}
187187
}
188188

189189
if (cached)
190190
{
191+
hook.m_hFunc = cached;
191192
return hook.Call( m_ScriptScope, retVal, pArgs, false );
192193
}
193194

@@ -328,7 +329,7 @@ void CWeaponCustomScripted::ItemPreFrame( void )
328329
{
329330
SIMPLE_VOID_OVERRIDE( ItemPreFrame, NULL );
330331

331-
BaseClass::ItemPostFrame();
332+
BaseClass::ItemPreFrame();
332333
}
333334

334335
void CWeaponCustomScripted::ItemPostFrame( void )

0 commit comments

Comments
 (0)