L L4D2node

CBaseServer::GetFreeClientInternal

0x0010ab90 · 452 bytes · __thiscall

_ZN11CBaseServer21GetFreeClientInternalER8netadr_s

Decompiled

undefined (2 params)

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

int * __thiscall CBaseServer::GetFreeClientInternal(CBaseServer *this,netadr_s *param_1)

{
  CBaseClient *pCVar1;
  char cVar2;
  netadr_s *pnVar3;
  undefined4 uVar4;
  int iVar5;
  int iVar6;
  CBaseClient *local_20 [4];
  
  local_20[0] = (CBaseClient *)0x0;
  iVar6 = *(int *)(this + 0x120);
  if (0 < iVar6) {
    iVar5 = 0;
    do {
      while( true ) {
        pCVar1 = *(CBaseClient **)(*(int *)(this + 0x114) + iVar5 * 4);
        cVar2 = (**(code **)(*(int *)pCVar1 + 0x78))(pCVar1);
        if (cVar2 == '\0') break;
LAB_0010abb8:
        iVar6 = *(int *)(this + 0x120);
        iVar5 = iVar5 + 1;
        if (iVar6 <= iVar5) goto LAB_0010ac00;
      }
      cVar2 = (**(code **)(*(int *)pCVar1 + 0x6c))(pCVar1);
      if (cVar2 != '\0') {
        pnVar3 = (netadr_s *)
                 (**(code **)(**(int **)(pCVar1 + 0xe8) + 200))(*(int **)(pCVar1 + 0xe8));
        cVar2 = netadr_s::CompareAdr(param_1,pnVar3,false);
        if (cVar2 != '\0') {
          uVar4 = netadr_s::ToString(param_1,false);
          ConMsg("%s:reconnect\n",uVar4);
          for (iVar6 = DAT_003a1734; 1 < iVar6; iVar6 = iVar6 + -1) {
            if (*(int *)(pCVar1 + iVar6 * 4 + 0x14) != 0) {
              (**(code **)(*(int *)this + 0xb4))(this,*(int *)(pCVar1 + iVar6 * 4 + 0x14));
              (**(code **)(**(int **)(*(int *)(pCVar1 + iVar6 * 4 + 0x14) + 0xe8) + 0x98))
                        (*(int **)(*(int *)(pCVar1 + iVar6 * 4 + 0x14) + 0xe8),0);
              *(undefined4 *)(*(int *)(pCVar1 + iVar6 * 4 + 0x14) + 0xe8) = 0;
              (**(code **)(**(int **)(pCVar1 + iVar6 * 4 + 0x14) + 0x54))
                        (*(int **)(pCVar1 + iVar6 * 4 + 0x14));
              *(undefined4 *)(pCVar1 + iVar6 * 4 + 0x14) = 0;
            }
          }
          (**(code **)(*(int *)this + 0xb4))(this,pCVar1);
          (**(code **)(**(int **)(pCVar1 + 0xe8) + 0x98))(*(int **)(pCVar1 + 0xe8),0);
          *(int *)(pCVar1 + 0xe8) = 0;
          (**(code **)(*(int *)pCVar1 + 0x54))(pCVar1);
          return (int *)pCVar1;
        }
        goto LAB_0010abb8;
      }
      if (local_20[0] != (CBaseClient *)0x0) goto LAB_0010abb8;
      iVar6 = *(int *)(this + 0x120);
      iVar5 = iVar5 + 1;
      local_20[0] = pCVar1;
    } while (iVar5 < iVar6);
LAB_0010ac00:
    if (local_20[0] != (CBaseClient *)0x0) {
      return (int *)local_20[0];
    }
  }
  if (*(int *)(this + 0x104) <= iVar6) {
    return (int *)0x0;
  }
  local_20[0] = (CBaseClient *)(**(code **)(*(int *)this + 0xd0))(this,iVar6);
  CUtlVector<CBaseClient*,CUtlMemory<CBaseClient*,int>>::InsertBefore
            ((CUtlVector<CBaseClient*,CUtlMemory<CBaseClient*,int>> *)(this + 0x114),
             *(int *)(this + 0x120),local_20);
  return (int *)local_20[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)