L L4D2node

CDirector::IsHumanSpectatorValid

0x00872da0 · 178 bytes · __thiscall

_ZN9CDirector21IsHumanSpectatorValidEP11SurvivorBot

Decompiled

undefined (2 params)

/* CDirector::IsHumanSpectatorValid(SurvivorBot*) */

undefined4 __thiscall CDirector::IsHumanSpectatorValid(CDirector *this,SurvivorBot *param_1)

{
  int *piVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  undefined4 uVar4;
  
  piVar1 = (int *)UTIL_PlayerByUserId(*(int *)(param_1 + 0x4308));
  if (piVar1 != (int *)0x0) {
    uVar4 = *(undefined4 *)(param_1 + 0x4308);
    uVar2 = (**(code **)(*piVar1 + 0xb8))(piVar1);
    uVar3 = SurvivorCharacterName(*(undefined4 *)(param_1 + 0x2ba0));
    DevMsg(1,"[TAKEOVER]: %s is already spectated by %s (%d)\n",uVar3,uVar2,uVar4);
    return 1;
  }
  uVar4 = SurvivorCharacterName(*(undefined4 *)(param_1 + 0x2ba0));
  DevMsg(1,"[TAKEOVER]: %s is spectated by an invalid userid - clearing spectator id.\n",uVar4);
  RemoveTransitioningPlayerRecord(*(int *)(param_1 + 0x4308));
  SurvivorBot::ResetHumanSpectator(param_1);
  return 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)