L L4D2node

ScriptPreInstanceSpawn

0x007df8c0 · 338 bytes · __cdecl

_Z22ScriptPreInstanceSpawnP13CScriptScopeTI19CDefScriptScopeBaseEP11CBaseEntity8string_t

Decompiled

undefined (3 params)

/* ScriptPreInstanceSpawn(CScriptScopeT<CDefScriptScopeBase>*, CBaseEntity*, string_t) */

uint ScriptPreInstanceSpawn(int *param_1,CBaseEntity *param_2)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  void *local_34 [2];
  short local_2c;
  ushort local_2a;
  void *local_28;
  undefined4 local_24;
  undefined2 local_20;
  ushort local_1e;
  
  iVar1 = *param_1;
  if (iVar1 != -1) {
    local_2c = 0;
    local_2a = 0;
    local_34[0] = (void *)0x0;
    if (param_2 == (CBaseEntity *)0x0) {
      local_28 = (void *)0x0;
    }
    else {
                    /* try { // try from 007df8f8 to 007df8fc has its CatchHandler @ 007dfa41 */
      local_28 = (void *)CBaseEntity::GetScriptInstance(param_2);
      iVar1 = *param_1;
    }
    local_1e = 0;
    local_24 = 0;
    local_20 = 0x20;
                    /* try { // try from 007df93f to 007df997 has its CatchHandler @ 007dfa27 */
    iVar1 = (**(code **)(*g_pScriptVM + 0x48))(g_pScriptVM,"__ExecutePreSpawn",iVar1,0);
    if (iVar1 == 0) {
      iVar2 = -1;
    }
    else {
      iVar2 = (**(code **)(*g_pScriptVM + 0x50))(g_pScriptVM,iVar1,&local_28,1,local_34,*param_1,1);
      (**(code **)(*g_pScriptVM + 0x4c))(g_pScriptVM,iVar1);
    }
    if ((local_1e & 1) != 0) {
      free(local_28);
    }
    uVar3 = 1;
    if (iVar2 == 0) {
      if (local_2c == 6) {
        uVar3 = (uint)local_34[0] & 0xff;
      }
      else if (local_2c == 5) {
        uVar3 = (uint)(local_34[0] != (void *)0x0);
      }
    }
    if ((local_2a & 1) != 0) {
      free(local_34[0]);
    }
    return uVar3;
  }
  return 1;
}

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)