L L4D2node

CTerrorPlayer::OnTeamChanged

0x009b2ac0 · 314 bytes · __thiscall

_ZN13CTerrorPlayer13OnTeamChangedEi

Decompiled

undefined (2 params)

/* CTerrorPlayer::OnTeamChanged(int) */

void __thiscall CTerrorPlayer::OnTeamChanged(CTerrorPlayer *this,int param_1)

{
  char cVar1;
  int iVar2;
  undefined4 local_10;
  
  if (param_1 == 3) {
    iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    gm_bChangingTeamFromZombie = iVar2 != 3;
    PlayerReporter::CreateAwardTemplatesForPlayer(ThePlayerReporter,this);
    if ((*(int *)(this + 0x2ba4) == 8) &&
       ((cVar1 = CTerrorGameRules::HasPlayerControlledZombies(), cVar1 == '\0' ||
        (cVar1 = CDirector::IsFinale((CDirector *)TheDirector), cVar1 == '\0')))) {
      local_10 = 8;
      ForEachTerrorPlayer<BossKilledMusic>((BossKilledMusic *)&local_10);
    }
  }
  else {
    gm_bChangingTeamFromZombie = 0;
    PlayerReporter::CreateAwardTemplatesForPlayer(ThePlayerReporter,this);
  }
  this[0x3ab0] = (CTerrorPlayer)0x0;
  iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  cVar1 = IsASurvivorTeam(iVar2);
  if ((cVar1 == '\0') ||
     (cVar1 = (**(code **)(*g_pGameRules + 0x118))(g_pGameRules,this), cVar1 == '\0')) {
    CCSPlayer::State_Transition((CCSPlayer *)this,6);
    cVar1 = CTerrorGameRules::HasPlayerControlledZombies();
  }
  else {
    (**(code **)(*(int *)this + 100))(this);
    cVar1 = CTerrorGameRules::HasPlayerControlledZombies();
  }
  if ((cVar1 != '\0') && (iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), iVar2 == 3)) {
    Music::Reset((Music *)(this + 0x3ab4));
  }
  CDirector::OnTeamChanged(TheDirector,(int)this);
  gm_bChangingTeamFromZombie = 0;
  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)