L L4D2node

GetNextCommandEntity

0x00642d30 · 303 bytes · __cdecl

_Z20GetNextCommandEntityP11CBasePlayerPKcP11CBaseEntity

Decompiled

undefined (3 params)

/* GetNextCommandEntity(CBasePlayer*, char const*, CBaseEntity*) */

CBaseEntity * GetNextCommandEntity(CBasePlayer *param_1,char *param_2,CBaseEntity *param_3)

{
  byte *pbVar1;
  char cVar2;
  int iVar3;
  uint uVar4;
  CBaseEntity *pCVar5;
  byte *pbVar6;
  
  if (param_1 == (CBasePlayer *)0x0) {
    return (CBaseEntity *)0x0;
  }
  if ((param_2 == "") || (iVar3 = _V_stricmp(param_2,""), iVar3 == 0)) {
    if (param_3 != (CBaseEntity *)0x0) {
      return (CBaseEntity *)0x0;
    }
    pCVar5 = (CBaseEntity *)FindPickerEntity(param_1);
    return pCVar5;
  }
  uVar4 = strtol(param_2,(char **)0x0,10);
  if (uVar4 == 0) {
    do {
      param_3 = (CBaseEntity *)CGlobalEntityList::NextEnt((CGlobalEntityList *)gEntList,param_3);
      if (param_3 == (CBaseEntity *)0x0) {
        return (CBaseEntity *)0x0;
      }
    } while (((*(char **)(param_3 + 0x154) == (char *)0x0) ||
             ((param_2 != *(char **)(param_3 + 0x154) &&
              (cVar2 = CBaseEntity::NameMatchesComplex(param_3,param_2), cVar2 == '\0')))) &&
            ((*(char **)(param_3 + 0x7c) == (char *)0x0 ||
             ((param_2 != *(char **)(param_3 + 0x7c) &&
              (cVar2 = CBaseEntity::ClassMatchesComplex(param_3,param_2), cVar2 == '\0'))))));
    return param_3;
  }
  if (param_3 != (CBaseEntity *)0x0) {
    return (CBaseEntity *)0x0;
  }
  if (uVar4 < 0x800) {
    pbVar1 = *(byte **)(gpGlobals + 0x58);
    if (pbVar1 == (byte *)0x0) {
      return (CBaseEntity *)0x0;
    }
    pbVar6 = pbVar1 + uVar4 * 0x10;
    if ((*pbVar6 & 2) == 0) goto LAB_00642e3a;
  }
  else {
    pbVar1 = *(byte **)(gpGlobals + 0x58);
    if (*(byte **)(gpGlobals + 0x58) == (byte *)0x0) {
      return (CBaseEntity *)0x0;
    }
  }
  pbVar6 = pbVar1;
  if ((*pbVar6 & 2) != 0) {
    return (CBaseEntity *)0x0;
  }
LAB_00642e3a:
  if (*(int **)(pbVar6 + 0xc) == (int *)0x0) {
    return (CBaseEntity *)0x0;
  }
                    /* WARNING: Could not recover jumptable at 0x00642e54. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  pCVar5 = (CBaseEntity *)(**(code **)(**(int **)(pbVar6 + 0xc) + 0x18))();
  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)