L L4D2node

CSceneEntity::FindNamedTarget

0x00812450 · 350 bytes · __thiscall

_ZN12CSceneEntity15FindNamedTargetE8string_tb

Decompiled

undefined (3 params)

/* CSceneEntity::FindNamedTarget(string_t, bool) */

CBaseEntity * __thiscall
CSceneEntity::FindNamedTarget(CSceneEntity *this,char *param_2,char param_3)

{
  uint uVar1;
  int iVar2;
  char *pcVar3;
  undefined *puVar4;
  CBaseEntity *pCVar5;
  
  if (param_2 == (char *)0x0) {
    param_2 = "";
    iVar2 = _V_stricmp("","!activator");
    if (iVar2 == 0) goto LAB_00812571;
  }
  else {
    iVar2 = _V_stricmp(param_2,"!activator");
    if (iVar2 == 0) {
LAB_00812571:
      uVar1 = *(uint *)(this + 0x704);
      if (((uVar1 != 0xffffffff) &&
          (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
        return *(CBaseEntity **)(puVar4 + 4);
      }
      return (CBaseEntity *)0x0;
    }
    pcVar3 = strchr(param_2,0x2a);
    if (pcVar3 != (char *)0x0) {
      pCVar5 = (CBaseEntity *)0x0;
      while( true ) {
        pCVar5 = (CBaseEntity *)
                 CGlobalEntityList::FindEntityByName
                           ((CGlobalEntityList *)gEntList,pCVar5,param_2,(CBaseEntity *)0x0,
                            (CBaseEntity *)0x0,(CBaseEntity *)0x0,(IEntityFindFilter *)0x0);
        if (pCVar5 == (CBaseEntity *)0x0) {
          return (CBaseEntity *)0x0;
        }
        if (param_3 == '\0') break;
        iVar2 = __dynamic_cast(pCVar5,&CBaseEntity::typeinfo,&CBaseFlex::typeinfo,0);
        if (iVar2 != 0) {
          return pCVar5;
        }
      }
      return pCVar5;
    }
  }
  pCVar5 = (CBaseEntity *)
           CGlobalEntityList::FindEntityByName
                     ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,param_2,(CBaseEntity *)0x0,
                      (CBaseEntity *)0x0,(CBaseEntity *)0x0,(IEntityFindFilter *)0x0);
  return pCVar5;
}

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)