L L4D2node

NextBotCreatePlayerBot<Smoker>

0x009e9b40 · 277 bytes · __cdecl

_Z22NextBotCreatePlayerBotI6SmokerEPT_PKc

Decompiled

Smoker * (1 param)

/* Smoker* NextBotCreatePlayerBot<Smoker>(char const*) */

Smoker * NextBotCreatePlayerBot<Smoker>(char *param_1)

{
  int *piVar1;
  int iVar2;
  Smoker *this;
  int in_GS_OFFSET;
  undefined4 local_40 [4];
  char local_30 [32];
  int local_10;
  
  local_10 = *(int *)(in_GS_OFFSET + 0x14);
  ClientPutInServerOverride(Smoker::AllocatePlayerEntity);
  iVar2 = (**(code **)(*engine + 0xdc))(engine,param_1);
  ClientPutInServerOverride((_func_CBasePlayer_ptr_edict_t_ptr_char_ptr *)0x0);
  if (iVar2 == 0) {
    Msg("CreatePlayerBot: Unable to create bot %s - CreateFakeClient() returned NULL.\n",param_1);
    this = (Smoker *)0x0;
  }
  else {
    piVar1 = *(int **)(iVar2 + 0xc);
    if (piVar1 != (int *)0x0) {
      iVar2 = (**(code **)(*piVar1 + 0x18))(piVar1);
      if (iVar2 != 0) {
        this = (Smoker *)__dynamic_cast(iVar2,&CBaseEntity::typeinfo,&Smoker::typeinfo,0);
        if (this != (Smoker *)0x0) {
          V_strncpy(local_30,param_1,0x20);
          AllocPooledString((char *)local_40);
          *(undefined4 *)(this + 0x1c90) = local_40[0];
          CBaseEntity::ClearFlags((CBaseEntity *)this);
          CBaseEntity::AddFlag((CBaseEntity *)this,0x180);
          goto LAB_009e9c19;
        }
      }
    }
    Error("CreatePlayerBot: Could not Instance() from the bot edict.\n");
    this = (Smoker *)0x0;
  }
LAB_009e9c19:
  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {
    return this;
  }
                    /* 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)