L L4D2node

CTerrorPlayer::OnFirstSpawnForMission

0x009aa1c0 · 570 bytes · __thiscall

_ZN13CTerrorPlayer22OnFirstSpawnForMissionEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::OnFirstSpawnForMission() */

void __thiscall CTerrorPlayer::OnFirstSpawnForMission(CTerrorPlayer *this)

{
  code *pcVar1;
  CBaseEdict *pCVar2;
  undefined1 uVar3;
  char cVar4;
  int *piVar5;
  undefined4 uVar6;
  undefined1 *puVar7;
  int iVar8;
  CTerrorPlayer *pCVar9;
  CTerrorPlayer *pCVar10;
  undefined4 local_20 [4];
  
  piVar5 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"player_first_spawn",0,0)
  ;
  if (piVar5 != (int *)0x0) {
    pcVar1 = *(code **)(*piVar5 + 0x30);
    uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
    (*pcVar1)(piVar5,"userid",uVar6);
    puVar7 = &DAT_00d539c2;
    if (*(undefined1 **)(gpGlobals + 0x3c) != (undefined1 *)0x0) {
      puVar7 = *(undefined1 **)(gpGlobals + 0x3c);
    }
    (**(code **)(*piVar5 + 0x3c))(piVar5,"map_name",puVar7);
    pcVar1 = *(code **)(*piVar5 + 0x2c);
    uVar3 = (**(code **)(*(int *)this + 0x778))(this);
    (*pcVar1)(piVar5,"isbot",uVar3);
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar5,0);
  }
  pCVar10 = this + 0x3664;
  do {
    while( true ) {
      local_20[0] = 0;
      iVar8 = memcmp(pCVar10,local_20,4);
      if (iVar8 == 0) break;
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar8 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar8 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      pCVar9 = pCVar10 + 4;
      *(undefined4 *)pCVar10 = 0;
      pCVar10 = pCVar9;
      if (pCVar9 == this + 0x38b8) goto LAB_009aa30e;
    }
    pCVar10 = pCVar10 + 4;
  } while (pCVar10 != this + 0x38b8);
LAB_009aa30e:
  pCVar10 = this + 0x38dc;
  do {
    while( true ) {
      local_20[0] = 0;
      iVar8 = memcmp(pCVar10,local_20,4);
      if (iVar8 == 0) break;
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar8 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar8 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      pCVar9 = pCVar10 + 4;
      *(undefined4 *)pCVar10 = 0;
      pCVar10 = pCVar9;
      if (pCVar9 == this + 0x3900) goto LAB_009aa38e;
    }
    pCVar10 = pCVar10 + 4;
  } while (pCVar10 != this + 0x3900);
LAB_009aa38e:
  cVar4 = CTerrorGameRules::IsVersusMode();
  if (cVar4 == '\0') {
    ResetCheckpointStats(this);
  }
  cVar4 = CTerrorGameRules::IsSurvivalMode();
  if (cVar4 == '\0') {
    *(undefined4 *)(this + 0x3f90) = 0;
    *(undefined4 *)(this + 0x3f98) = 1;
  }
  pCVar10 = ThePlayerReporter;
  this[0x3f9c] = (CTerrorPlayer)0x0;
  *(undefined4 *)(this + 0x3f94) = 0;
  this[0x3377] = (CTerrorPlayer)0x0;
  PlayerReporter::OnFirstSpawnForMission(pCVar10);
  return;
}

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)