L L4D2node

COuttroStats::CalcPZStats

0x00686b80 · 631 bytes · __thiscall

_ZN12COuttroStats11CalcPZStatsER17SEndGameVoteStats

Decompiled

undefined (2 params)

/* COuttroStats::CalcPZStats(SEndGameVoteStats&) */

void __thiscall COuttroStats::CalcPZStats(COuttroStats *this,SEndGameVoteStats *param_1)

{
  COuttroStats *pCVar1;
  bool bVar2;
  char cVar3;
  CBaseEntity *this_00;
  int iVar4;
  uint uVar5;
  char *pcVar6;
  COuttroStats CVar7;
  int iVar8;
  COuttroStats *pCVar10;
  SEndGameVoteStats *pSVar11;
  longdouble lVar12;
  int iVar9;
  
  pSVar11 = param_1;
  for (iVar8 = 8; iVar8 != 0; iVar8 = iVar8 + -1) {
    *(undefined4 *)pSVar11 = 0;
    pSVar11 = pSVar11 + 4;
  }
  if (0 < *(int *)(gpGlobals + 0x14)) {
    iVar8 = 1;
    pCVar10 = this;
    do {
      while (((((this_00 = (CBaseEntity *)UTIL_PlayerByIndex(iVar8), this_00 == (CBaseEntity *)0x0
                || (cVar3 = (**(code **)(*(int *)this_00 + 0x16c))(this_00), cVar3 == '\0')) ||
               (*(int *)(this_00 + 0x1f6c) == 2)) ||
              (cVar3 = (**(code **)(*(int *)this_00 + 0x778))(this_00), cVar3 != '\0')) ||
             ((iVar4 = CBaseEntity::GetTeamNumber(this_00), iVar4 != 2 &&
              (iVar4 = CBaseEntity::GetTeamNumber(this_00), iVar4 != 3))))) {
LAB_00686bc0:
        iVar8 = iVar8 + 1;
        pCVar10 = pCVar10 + 2;
        if (*(int *)(gpGlobals + 0x14) < iVar8) goto LAB_00686cb0;
      }
      iVar4 = CBaseEntity::GetTeamNumber(this_00);
      uVar5 = (uint)(iVar4 != 2);
      *(int *)(param_1 + uVar5 * 4) = *(int *)(param_1 + uVar5 * 4) + 1;
      CVar7 = pCVar10[0x473];
      if (CVar7 == (COuttroStats)0x0) {
        iVar9 = *(int *)(this_00 + 0x3fc4);
        if (iVar9 == 0) goto LAB_00686bc0;
LAB_00686c5b:
        CVar7 = SUB41(iVar9,0);
        pCVar10[0x473] = CVar7;
        pCVar10[0x472] = (COuttroStats)(iVar4 != 2);
      }
      else if ((byte)pCVar10[0x472] != uVar5) {
        iVar9 = *(int *)(this_00 + 0x3fc4);
        goto LAB_00686c5b;
      }
      if (CVar7 == (COuttroStats)0x1) {
        *(int *)(param_1 + (uint)(byte)pCVar10[0x472] * 4 + 8) =
             *(int *)(param_1 + (uint)(byte)pCVar10[0x472] * 4 + 8) + 1;
        CVar7 = pCVar10[0x473];
      }
      if (CVar7 != (COuttroStats)0x2) goto LAB_00686bc0;
      pCVar1 = pCVar10 + 0x472;
      iVar8 = iVar8 + 1;
      pCVar10 = pCVar10 + 2;
      *(int *)(param_1 + (uint)(byte)*pCVar1 * 4 + 0x10) =
           *(int *)(param_1 + (uint)(byte)*pCVar1 * 4 + 0x10) + 1;
    } while (iVar8 <= *(int *)(gpGlobals + 0x14));
  }
LAB_00686cb0:
  iVar8 = 0;
  bVar2 = false;
  pSVar11 = param_1;
  do {
    lVar12 = (longdouble)CountdownTimer::Now();
    if ((*(float *)(this + 0x460) <= (float)lVar12) ||
       (*(int *)(pSVar11 + 8) + *(int *)(pSVar11 + 0x10) == *(int *)pSVar11)) {
      *(int *)(pSVar11 + 0x18) = 1;
      lVar12 = (longdouble)CountdownTimer::Now();
      if (((float)lVar12 < *(float *)(this + 0x460)) &&
         (*(int *)(pSVar11 + 8) <= *(int *)(pSVar11 + 0x10))) {
        bVar2 = true;
      }
    }
    iVar8 = iVar8 + 1;
    pSVar11 = pSVar11 + 4;
  } while (iVar8 != 2);
  if (bVar2) {
    *(undefined4 *)(param_1 + 0x18) = 1;
    *(undefined4 *)(param_1 + 0x1c) = 1;
  }
  Msg(">>>REMATCH Stats START\n");
  iVar8 = 0;
  do {
    pcVar6 = "Finished";
    if (*(int *)(param_1 + 0x18) == 0) {
      pcVar6 = "Still voting";
    }
    iVar4 = iVar8 + 1;
    Msg("Team %d: %s\n",iVar8,pcVar6);
    Msg("    %d players\n",*(undefined4 *)param_1);
    Msg("    %d yes\n",*(undefined4 *)(param_1 + 8));
    Msg("    %d no\n",*(undefined4 *)(param_1 + 0x10));
    param_1 = param_1 + 4;
    iVar8 = iVar4;
  } while (iVar4 != 2);
  Msg();
  return;
}

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)