L L4D2node

CTerrorPlayer::ChangeTeam

0x009df840 · 515 bytes · __thiscall

_ZN13CTerrorPlayer10ChangeTeamEi

Decompiled

undefined (2 params)

/* CTerrorPlayer::ChangeTeam(int) */

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

{
  CBaseEdict *this_00;
  char cVar1;
  int iVar2;
  CBaseEntity *this_01;
  int iVar3;
  CTakeDamageInfo local_7c [108];
  
  iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  if (iVar2 != param_1) {
    iVar2 = IsASurvivorTeam(iVar2);
    if (((char)iVar2 != '\0') || (cVar1 = IsASurvivorTeam(iVar2), cVar1 != '\0')) {
      UpdateActiveSet(this,(CNavArea *)0x0,(CNavArea *)0x0);
    }
    this_01 = (CBaseEntity *)ReplaceWithBot(this,false);
    cVar1 = CTerrorGameRules::HasPlayerControlledZombies();
    if ((((cVar1 != '\0') && (this_01 != (CBaseEntity *)0x0)) &&
        (cVar1 = (**(code **)(*(int *)this_01 + 0x778))(this_01), cVar1 != '\0')) &&
       (iVar2 = CBaseEntity::GetTeamNumber(this_01), iVar2 == 3)) {
      iVar2 = (**(code **)(*(int *)this_01 + 0x544))(this_01);
      if (iVar2 == 8) {
        CDirector::TryOfferingTankBot(TheDirector,this_01,false);
      }
      else {
        CTakeDamageInfo::CTakeDamageInfo
                  (local_7c,(CBaseEntity *)this,(CBaseEntity *)this,(float)*(int *)(this_01 + 0x100)
                   ,0,0);
        CBaseEntity::TakeDamage(this_01,local_7c);
      }
    }
  }
  iVar2 = CCSPlayer::ChangeTeam((CCSPlayer *)this,param_1);
  iVar2 = IsASurvivorTeam(iVar2);
  if ((char)iVar2 != '\0') {
    CResponseQueue::RemoveExpresserHost
              ((CResponseQueue *)g_ResponseQueueManager._12_4_,(CBaseEntity *)this);
    iVar2 = CDirectorSessionManager::IsWaitingForTeamReady
                      (*(CDirectorSessionManager **)(TheDirector + 0x634));
    if ((char)iVar2 != '\0') {
      iVar2 = CBasePlayer::DeactivateMovementConstraint((CBasePlayer *)this);
    }
  }
  cVar1 = IsASurvivorTeam(iVar2);
  if (cVar1 != '\0') {
    CResponseQueue::AddExpresserHost
              ((CResponseQueue *)g_ResponseQueueManager._12_4_,(CBaseEntity *)this);
  }
  if ((param_1 - 2U < 2) &&
     (iVar2 = CTerrorGameRules::GetVersusTeamFor(g_pGameRules,param_1),
     iVar2 != *(int *)(this + 0x3fb4))) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      this_00 = *(CBaseEdict **)(this + 0x30);
      if (this_00 != (CBaseEdict *)0x0) {
        *(uint *)this_00 = *(uint *)this_00 | 0x101;
        iVar3 = CBaseEdict::GetChangeAccessor(this_00);
        *(undefined2 *)(iVar3 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x3fb4) = iVar2;
    return;
  }
  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)