L L4D2node

UTIL_HumansInGame

0x00435fa0 · 216 bytes · __cdecl

_Z17UTIL_HumansInGameb

Decompiled

undefined (1 param)

/* UTIL_HumansInGame(bool) */

int UTIL_HumansInGame(bool param_1)

{
  char *pcVar1;
  int iVar2;
  CBaseEntity *this;
  int iVar3;
  int iVar4;
  
  if (*(int *)(gpGlobals + 0x14) < 1) {
    iVar4 = 0;
  }
  else {
    iVar3 = 1;
    iVar4 = 0;
    do {
      while (this = (CBaseEntity *)CCSPlayer::Instance(iVar3), this == (CBaseEntity *)0x0) {
LAB_0043603e:
        iVar3 = iVar3 + 1;
        if (*(int *)(gpGlobals + 0x14) < iVar3) {
          return iVar4;
        }
      }
      if ((*(int *)(this + 0x30) != 0) &&
         (*(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0)) {
        pcVar1 = (char *)(**(code **)(*(int *)this + 0xb8))(this);
        if (((pcVar1 == "") ||
            ((iVar2 = _V_stricmp(pcVar1,""), iVar2 == 0 || (((byte)this[0x151] & 1) != 0)))) ||
           ((param_1 &&
            (((iVar2 = CBaseEntity::GetTeamNumber(this), iVar2 != 2 &&
              (iVar2 = CBaseEntity::GetTeamNumber(this), iVar2 != 3)) ||
             (*(int *)(this + 0x23bc) == 3)))))) goto LAB_0043603e;
        iVar4 = iVar4 + 1;
      }
      iVar3 = iVar3 + 1;
    } while (iVar3 <= *(int *)(gpGlobals + 0x14));
  }
  return iVar4;
}

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)