L L4D2node

ForEachTerrorPlayer<IsAllIdleSpectatingPlayer>

0x008be670 · 478 bytes · __cdecl

_Z19ForEachTerrorPlayerI25IsAllIdleSpectatingPlayerEbRT_

Decompiled

bool (1 param)

/* bool ForEachTerrorPlayer<IsAllIdleSpectatingPlayer>(IsAllIdleSpectatingPlayer&) */

bool ForEachTerrorPlayer<IsAllIdleSpectatingPlayer>(IsAllIdleSpectatingPlayer *param_1)

{
  uint uVar1;
  CBaseEntity *this;
  char cVar2;
  CBasePlayer *this_00;
  int iVar3;
  int iVar4;
  int *piVar5;
  undefined *puVar6;
  int iVar7;
  float local_20;
  
  iVar7 = 1;
  if (0 < *(int *)(gpGlobals + 0x14)) {
    do {
      this_00 = (CBasePlayer *)UTIL_PlayerByIndex(iVar7);
      if ((((this_00 != (CBasePlayer *)0x0) && (*(int *)(this_00 + 0x30) != 0)) &&
          (*(int *)(this_00 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0)) &&
         (((cVar2 = (**(code **)(*(int *)this_00 + 0x16c))(this_00), cVar2 != '\0' &&
           (*(int *)(this_00 + 0x1f6c) != 2)) &&
          ((cVar2 = (**(code **)(*(int *)this_00 + 0x778))(this_00), cVar2 == '\0' &&
           (cVar2 = CBasePlayer::IsSplitScreenPlayer(this_00), cVar2 == '\0')))))) {
        iVar3 = UTIL_HumansOnTeam(2,false);
        iVar4 = UTIL_HumansOnTeam(3,false);
        if (((iVar4 == 0) && (iVar3 == 1)) &&
           (iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this_00), iVar3 == 2)) {
          if (*(float *)(gpGlobals + 0xc) - *(float *)(this_00 + 0x2400) <= 300.0) {
LAB_008be80b:
            *param_1 = (IsAllIdleSpectatingPlayer)0x0;
          }
        }
        else {
          iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this_00);
          if (iVar3 != 1) {
            CTerrorPlayer::MarkAsNotSpectating((CTerrorPlayer *)this_00);
          }
          local_20 = *(float *)(this_00 + 0x3fb8);
          piVar5 = (int *)CBasePlayer::GetSplitScreenPlayers(this_00);
          if (0 < piVar5[3]) {
            iVar3 = 0;
            do {
              uVar1 = *(uint *)(*piVar5 + iVar3 * 4);
              if ((((uVar1 != 0xffffffff) &&
                   (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10,
                   puVar6 != (undefined *)0xfffffffc)) && (*(uint *)(puVar6 + 8) == uVar1 >> 0xc))
                 && ((this = *(CBaseEntity **)(puVar6 + 4), this != (CBaseEntity *)0x0 &&
                     (cVar2 = (**(code **)(*(int *)this + 0x16c))(this), cVar2 != '\0')))) {
                iVar4 = CBaseEntity::GetTeamNumber(this);
                if (iVar4 != 1) {
                  CTerrorPlayer::MarkAsNotSpectating((CTerrorPlayer *)this);
                }
                if (local_20 <= *(float *)(this + 0x3fb8)) {
                  local_20 = *(float *)(this + 0x3fb8);
                }
              }
              iVar3 = iVar3 + 1;
            } while (iVar3 < piVar5[3]);
          }
          if (*(float *)(gpGlobals + 0xc) <= local_20 && local_20 != *(float *)(gpGlobals + 0xc))
          goto LAB_008be80b;
        }
      }
      iVar7 = iVar7 + 1;
    } while (iVar7 <= *(int *)(gpGlobals + 0x14));
  }
  return true;
}

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)