L L4D2node

CBaseServer::CreateFakeClient

0x0010b4d0 · 751 bytes · __thiscall

_ZN11CBaseServer16CreateFakeClientEPKc

Decompiled

undefined (2 params)

/* CBaseServer::CreateFakeClient(char const*) */

int * __thiscall CBaseServer::CreateFakeClient(CBaseServer *this,char *param_1)

{
  int *piVar1;
  undefined4 uVar2;
  char *pcVar3;
  undefined4 uVar4;
  int in_GS_OFFSET;
  netadr_s local_38 [12];
  netadr_s local_2c [12];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  netadr_s::SetIP(local_38,0);
  netadr_s::SetPort(local_38,0);
  netadr_s::SetType(local_38,3);
  piVar1 = (int *)GetFreeClientInternal(this,local_38);
  if (piVar1 == (int *)0x0) {
    piVar1 = (int *)0x0;
  }
  else {
    uVar4 = 0;
    if (*(int *)(sv_stressbots._28_4_ + 0x30) != 0) {
      netadr_s::SetIP(local_2c,0);
      netadr_s::SetPort(local_2c,0);
      netadr_s::SetType(local_2c,3);
      pcVar3 = (char *)netadr_s::ToString(local_2c,false);
      uVar4 = NET_CreateNetChannel
                        (*(int *)(this + 8),local_2c,pcVar3,(INetChannelHandler *)(piVar1 + 1),true)
      ;
    }
    uVar2 = GetNextUserID(this);
    *(undefined4 *)(this + 0x100) = uVar2;
    (**(code **)(*piVar1 + 0x30))(piVar1,param_1,uVar2,uVar4,1,0);
    (**(code **)(*piVar1 + 0xfc))(piVar1,"rate","30000");
    (**(code **)(*piVar1 + 0xfc))(piVar1,"cl_updaterate",&DAT_002a3b8e);
    (**(code **)(*piVar1 + 0xfc))(piVar1,"cl_interp_ratio",&DAT_002b6471);
    (**(code **)(*piVar1 + 0xfc))(piVar1,"cl_interp",&DAT_002bbd71);
    (**(code **)(*piVar1 + 0xfc))(piVar1,"cl_interpolate",&DAT_002c3f3c);
    (**(code **)(*piVar1 + 0xfc))(piVar1,"cl_predict","1");
    (**(code **)(*piVar1 + 0xfc))(piVar1,"cl_predictweapons","1");
    (**(code **)(*piVar1 + 0xfc))(piVar1,"cl_lagcompensation","1");
    (**(code **)(*piVar1 + 0xfc))(piVar1,"closecaption",&DAT_002c3f3c);
    (**(code **)(*piVar1 + 0xfc))(piVar1,"english","1");
    (**(code **)(*piVar1 + 0xfc))(piVar1,"cl_team",&DAT_002a84b3);
    (**(code **)(*piVar1 + 0xfc))(piVar1,"hud_classautokill","1");
    (**(code **)(*piVar1 + 0xfc))(piVar1,"tf_medigun_autoheal",&DAT_002c3f3c);
    (**(code **)(*piVar1 + 0xfc))(piVar1,"cl_autorezoom","1");
    (**(code **)(*piVar1 + 0xfc))(piVar1,"fov_desired",&DAT_002a2ccd);
    (**(code **)(*piVar1 + 0xf4))(piVar1);
    piVar1[0x3e] = *(int *)(this + 0xc);
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return piVar1;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)