L L4D2node

SurvivorBot::SetHumanSpectatorByUserID

0x0093af40 · 538 bytes · __thiscall

_ZN11SurvivorBot25SetHumanSpectatorByUserIDEiPKc

Decompiled

undefined (3 params)

/* SurvivorBot::SetHumanSpectatorByUserID(int, char const*) */

undefined4 __thiscall
SurvivorBot::SetHumanSpectatorByUserID(SurvivorBot *this,int param_1,char *param_2)

{
  undefined4 uVar1;
  CBaseEdict *pCVar2;
  byte bVar3;
  SurvivorBot SVar4;
  int iVar5;
  int iVar6;
  
  if (0 < *(int *)(this + 0x4308)) {
    return 0;
  }
  if (*(int *)(this + 0x4308) != param_1) {
    if (this[0x6c] == (SurvivorBot)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (SurvivorBot)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x4308) = param_1;
  }
  iVar5 = UTIL_PlayerByUserId(param_1);
  if (iVar5 == 0) {
    if (*(int *)(this + 0x430c) == 0) goto LAB_0093b09e;
    if (this[0x6c] == (SurvivorBot)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      SVar4 = (SurvivorBot)0x0;
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
        SVar4 = this[0x6c];
      }
    }
    else {
      this[0x70] = (SurvivorBot)((byte)this[0x70] | 1);
      SVar4 = (SurvivorBot)0x1;
    }
    *(undefined4 *)(this + 0x430c) = 0;
  }
  else {
    if (*(int *)(iVar5 + 0x30) == 0) {
      iVar5 = 0;
    }
    else {
      iVar5 = *(int *)(iVar5 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    }
    if (iVar5 == *(int *)(this + 0x430c)) {
LAB_0093b09e:
      iVar5 = *(int *)(this + 0x4330);
      SVar4 = this[0x6c];
      goto joined_r0x0093b002;
    }
    if (this[0x6c] == (SurvivorBot)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      SVar4 = (SurvivorBot)0x0;
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar6 + 2) = 0;
        SVar4 = this[0x6c];
      }
    }
    else {
      this[0x70] = (SurvivorBot)((byte)this[0x70] | 1);
      SVar4 = (SurvivorBot)0x1;
    }
    *(int *)(this + 0x430c) = iVar5;
  }
  iVar5 = *(int *)(this + 0x4330);
joined_r0x0093b002:
  if (iVar5 == 0) {
    this[0x4335] = (SurvivorBot)0x1;
  }
  else {
    if (SVar4 == (SurvivorBot)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
        SVar4 = this[0x6c];
      }
    }
    else {
      this[0x70] = (SurvivorBot)((byte)this[0x70] | 1);
    }
    this[0x4335] = (SurvivorBot)0x1;
    *(undefined4 *)(this + 0x4330) = 0;
  }
  if (SVar4 == (SurvivorBot)0x0) {
    pCVar2 = *(CBaseEdict **)(this + 0x30);
    if (pCVar2 != (CBaseEdict *)0x0) {
      *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
      iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
      *(undefined2 *)(iVar5 + 2) = 0;
    }
  }
  else {
    this[0x70] = (SurvivorBot)((byte)this[0x70] | 1);
  }
  uVar1 = *(undefined4 *)(gpGlobals + 0xc);
  *(undefined4 *)(this + 0x78) = 0;
  *(undefined4 *)(this + 0x74) = uVar1;
  V_strncpy((char *)(this + 0x4310),param_2,0x20);
  SVar4 = (SurvivorBot)0x0;
  if (0 < param_1) {
    bVar3 = CDirector::IsTransitionScenarioRestart();
    SVar4 = (SurvivorBot)(bVar3 ^ 1);
  }
  this[0x4334] = SVar4;
  return 1;
}

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)