L L4D2node

CBaseEntity::ValidateScriptScope

0x0060eee0 · 342 bytes · __thiscall

_ZN11CBaseEntity19ValidateScriptScopeEv

Decompiled

undefined (1 param)

/* CBaseEntity::ValidateScriptScope() */

undefined4 __thiscall CBaseEntity::ValidateScriptScope(CBaseEntity *this)

{
  code *pcVar1;
  undefined1 *puVar2;
  int iVar3;
  undefined4 uVar4;
  void *local_18 [2];
  undefined2 local_10;
  ushort local_e;
  
  if (*(int *)(this + 1000) != -1) {
    return 1;
  }
  if (scriptmanager == 0) {
    if (ValidateScriptScope()::__executeCount < 1) {
      ValidateScriptScope()::__executeCount = ValidateScriptScope()::__executeCount + 1;
      DevMsg("Cannot execute script because scripting is disabled (-scripting)\n");
    }
  }
  else if (g_pScriptVM == (int *)0x0) {
    if (ValidateScriptScope()::__executeCount < 1) {
      ValidateScriptScope()::__executeCount = ValidateScriptScope()::__executeCount + 1;
      DevMsg(" Cannot execute script because there is no available VM\n");
    }
  }
  else {
    GetScriptInstance(this);
    (**(code **)(*(int *)this + 0xc))(this);
    puVar2 = &DAT_00d539c2;
    if (*(undefined1 **)(this + 0x3f8) != (undefined1 *)0x0) {
      puVar2 = *(undefined1 **)(this + 0x3f8);
    }
    iVar3 = (**(code **)(*g_pScriptVM + 0x3c))(g_pScriptVM,puVar2,0);
    *(int *)(this + 1000) = iVar3;
    if (iVar3 != 0) {
      pcVar1 = *(code **)(*g_pScriptVM + 0x78);
      local_18[0] = (void *)GetScriptInstance(this);
      local_10 = 0x20;
      local_e = 0;
      iVar3 = 0;
      if (*(int *)(this + 1000) != -1) {
        iVar3 = *(int *)(this + 1000);
      }
                    /* try { // try from 0060efb0 to 0060efb1 has its CatchHandler @ 0060f044 */
      (*pcVar1)(g_pScriptVM,iVar3,"self",local_18);
      if ((local_e & 1) != 0) {
        free(local_18[0]);
      }
      return 1;
    }
    uVar4 = GetDebugName(this);
    DevMsg("%s couldn\'t create ScriptScope!\n",uVar4);
  }
  return 0;
}

SourceMod gamedata

paste into addons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)

Just a Signatures{} block, ready to drop into a gamedata file. Wire it up in your plugin however you like - SDKCall, DHooks, raw memory ops, or anything else.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)