L L4D2node

CTeamplayRoundBasedRules::AreTeamsUnbalanced

0x004ccfb0 · 239 bytes · __thiscall

_ZN24CTeamplayRoundBasedRules18AreTeamsUnbalancedERiS0_

Decompiled

undefined (3 params)

/* CTeamplayRoundBasedRules::AreTeamsUnbalanced(int&, int&) */

bool __thiscall
CTeamplayRoundBasedRules::AreTeamsUnbalanced
          (CTeamplayRoundBasedRules *this,int *param_1,int *param_2)

{
  char cVar1;
  int *piVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  
  cVar1 = (**(code **)(*(int *)this + 0x29c))(this);
  if (((cVar1 == '\0') &&
      ((*(int *)(mp_teams_unbalance_limit._28_4_ + 0x30) < 1 ||
       (*(int *)(mp_tournament._28_4_ + 0x30) != 0)))) ||
     (cVar1 = IsInCommentaryMode(), cVar1 != '\0')) {
    return false;
  }
  piVar2 = (int *)GetGlobalTeam(2);
  if (piVar2 == (int *)0x0) {
    iVar6 = 0x21;
    iVar5 = 0;
  }
  else {
    iVar4 = 2;
    iVar6 = 0x21;
    iVar5 = 0;
    do {
      iVar3 = (**(code **)(*piVar2 + 0x354))(piVar2);
      if (iVar3 < iVar6) {
        *param_2 = iVar4;
        iVar6 = iVar3;
      }
      if (iVar5 < iVar3) {
        *param_1 = iVar4;
        iVar5 = iVar3;
      }
      iVar4 = iVar4 + 1;
      piVar2 = (int *)GetGlobalTeam(iVar4);
    } while (piVar2 != (int *)0x0);
  }
  cVar1 = (**(code **)(*(int *)this + 0x29c))(this);
  if (cVar1 != '\0') {
    if (iVar5 == 0 && iVar5 == iVar6) {
      return iVar5 == 0 && iVar5 == iVar6;
    }
    return iVar5 != iVar6;
  }
  return *(int *)(mp_teams_unbalance_limit._28_4_ + 0x30) < iVar5 - iVar6;
}

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)