Fix weapon_custom_scripted hook calls

This commit is contained in:
samisalreadytaken 2024-01-26 23:36:39 +03:00
parent 19702d067d
commit a02f3db05b

View File

@ -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 );
}