L L4D2node

CRestore::EntityFromIndex

0x004aa0a0 · 119 bytes · __thiscall

_ZN8CRestore15EntityFromIndexEi

Decompiled

undefined (2 params)

/* CRestore::EntityFromIndex(int) */

undefined4 __thiscall CRestore::EntityFromIndex(CRestore *this,int param_1)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  int *piVar4;
  int iVar5;
  undefined *puVar6;
  
  iVar1 = *(int *)(this + 0x1c);
  if (((iVar1 != 0) && (-1 < param_1)) && (0 < *(int *)(iVar1 + 0x55c))) {
    piVar4 = *(int **)(iVar1 + 0x560);
    iVar5 = 0;
    iVar2 = *piVar4;
    while (iVar2 != param_1) {
      piVar4 = piVar4 + 0xe;
      iVar5 = iVar5 + 1;
      if (iVar5 == *(int *)(iVar1 + 0x55c)) {
        return 0;
      }
      iVar2 = *piVar4;
    }
    uVar3 = piVar4[4];
    if (((uVar3 != 0xffffffff) &&
        (puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar6 + 8) == uVar3 >> 0xc)) {
      return *(undefined4 *)(puVar6 + 4);
    }
  }
  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)