L L4D2node

CreateEntityByName

0x006efee0 · 156 bytes · __cdecl

_Z18CreateEntityByNamePKcib

Decompiled

undefined (3 params)

/* CreateEntityByName(char const*, int, bool) */

CBaseEntity * CreateEntityByName(char *param_1,int param_2,bool param_3)

{
  int *piVar1;
  CBaseEntity *pCVar2;
  
  if (param_2 != -1) {
    g_pForceAttachEdict = (**(code **)(*engine + 0x58))(engine,param_2);
    if (g_pForceAttachEdict == 0) {
      Error("CreateEntityByName( %s, %d ) - CreateEdict failed.",param_1,param_2);
    }
  }
  piVar1 = (int *)EntityFactoryDictionary();
  piVar1 = (int *)(**(code **)(*piVar1 + 4))(piVar1,param_1);
  g_pForceAttachEdict = 0;
  if (piVar1 == (int *)0x0) {
    pCVar2 = (CBaseEntity *)0x0;
  }
  else {
    pCVar2 = (CBaseEntity *)(**(code **)(*piVar1 + 0x1c))(piVar1);
    if (param_3) {
      CGlobalEntityList::NotifyCreateEntity((CGlobalEntityList *)gEntList,pCVar2);
      return pCVar2;
    }
  }
  return pCVar2;
}

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)