L L4D2node

CBasePlayer::GetAvailableSteadyStateSlots

0x007a97e0 · 282 bytes · __thiscall

_ZN11CBasePlayer28GetAvailableSteadyStateSlotsEv

Decompiled

undefined (1 param)

/* CBasePlayer::GetAvailableSteadyStateSlots() */

int __thiscall CBasePlayer::GetAvailableSteadyStateSlots(CBasePlayer *this)

{
  char cVar1;
  int iVar2;
  char *__nptr;
  long lVar3;
  int iVar4;
  float fVar5;
  
  iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  if ((iVar2 != 0) && (cVar1 = (**(code **)(*(int *)this + 0x778))(this), cVar1 == '\0')) {
    fVar5 = *(float *)(ent_steadystate_interval._28_4_ + 0x2c) + *(float *)(this + 0x233c);
    if (*(float *)(gpGlobals + 0xc) <= fVar5 && fVar5 != *(float *)(gpGlobals + 0xc)) {
      return *(int *)(this + 0x2340);
    }
    if (*(int *)(this + 0x30) == 0) {
      iVar2 = 0;
    }
    else {
      iVar2 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    }
    __nptr = (char *)(**(code **)(*engine + 0xe0))(engine,iVar2,"rate");
    if ((__nptr == (char *)0x0) || (lVar3 = strtol(__nptr,(char **)0x0,10), lVar3 < 5000)) {
      iVar4 = 1;
    }
    else {
      iVar2 = 0;
      if (-1 < *(int *)(ent_steadystate_batchsize._28_4_ + 0x30)) {
        iVar2 = *(int *)(ent_steadystate_batchsize._28_4_ + 0x30);
      }
      iVar4 = 100;
      if (iVar2 < 0x65) {
        iVar4 = iVar2;
      }
      if (lVar3 < 20000) {
        iVar4 = (int)((float)(iVar4 + -1) * 6.666667e-05 * ((float)lVar3 + -5000.0) + 0.5) + 1;
      }
    }
    *(int *)(this + 0x2340) = iVar4;
    return iVar4;
  }
  return 0;
}

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)