L L4D2node

CBaseServer::GetChallengeNr

0x0010a9f0 · 382 bytes · __thiscall

_ZN11CBaseServer14GetChallengeNrER8netadr_s

Decompiled

undefined (2 params)

/* CBaseServer::GetChallengeNr(netadr_s&) */

undefined4 __thiscall CBaseServer::GetChallengeNr(CBaseServer *this,netadr_s *param_1)

{
  char cVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  int iVar5;
  float fVar6;
  int local_24;
  float local_20;
  
  if (0 < *(int *)(this + 0x138)) {
    iVar2 = *(int *)(this + 300);
    iVar5 = 0;
    local_24 = 0;
    local_20 = 3.4028235e+38;
    do {
      iVar3 = iVar5 * 0x14;
      cVar1 = netadr_s::CompareAdr(param_1,(netadr_s *)(iVar2 + iVar3),true);
      iVar2 = *(int *)(this + 300);
      if (cVar1 != '\0') {
        *(float *)(iVar2 + 0x10 + iVar3) = (float)net_time;
        return *(undefined4 *)(*(int *)(this + 300) + 0xc + iVar3);
      }
      fVar6 = *(float *)(iVar2 + 0x10 + iVar3);
      if (fVar6 < local_20) {
        local_24 = iVar5;
        local_20 = fVar6;
      }
      iVar5 = iVar5 + 1;
    } while (iVar5 < *(int *)(this + 0x138));
    if (0x4000 < *(int *)(this + 0x138)) {
      CUtlVector<challenge_t,CUtlMemory<challenge_t,int>>::FastRemove
                ((CUtlVector<challenge_t,CUtlMemory<challenge_t,int>> *)(this + 300),local_24);
    }
  }
  iVar2 = CUtlVector<challenge_t,CUtlMemory<challenge_t,int>>::InsertBefore
                    ((CUtlVector<challenge_t,CUtlMemory<challenge_t,int>> *)(this + 300),
                     *(int *)(this + 0x138));
  iVar5 = *(int *)(this + 300);
  iVar2 = iVar2 * 0x14;
  iVar3 = RandomInt(0,0xfff);
  uVar4 = RandomInt(0,0xffff);
  *(uint *)(iVar5 + iVar2 + 0xc) = iVar3 << 0x10 | uVar4;
  iVar5 = *(int *)(this + 300);
  *(undefined4 *)(iVar5 + iVar2) = *(undefined4 *)param_1;
  *(undefined4 *)(iVar5 + 4 + iVar2) = *(undefined4 *)(param_1 + 4);
  fVar6 = (float)net_time;
  *(undefined2 *)(iVar5 + 8 + iVar2) = *(undefined2 *)(param_1 + 8);
  *(float *)(*(int *)(this + 300) + 0x10 + iVar2) = fVar6;
  return *(undefined4 *)(*(int *)(this + 300) + 0xc + iVar2);
}

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)