L L4D2node

CBasePlayer::ChangeTeam

0x007bfcc0 · 554 bytes · __thiscall

_ZN11CBasePlayer10ChangeTeamEibb

Decompiled

undefined (4 params)

/* CBasePlayer::ChangeTeam(int, bool, bool) */

void __thiscall CBasePlayer::ChangeTeam(CBasePlayer *this,int param_1,bool param_2,bool param_3)

{
  code *pcVar1;
  byte bVar2;
  int iVar3;
  int *piVar4;
  undefined4 uVar5;
  
  iVar3 = GetGlobalTeam(param_1);
  if (iVar3 == 0) {
    Warning();
    return;
  }
  iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  if (param_1 != iVar3) {
    piVar4 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"player_team",0,0);
    if (piVar4 != (int *)0x0) {
      pcVar1 = *(code **)(*piVar4 + 0x30);
      uVar5 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
      (*pcVar1)(piVar4,"userid",uVar5);
      (**(code **)(*piVar4 + 0x30))(piVar4,"team",param_1);
      pcVar1 = *(code **)(*piVar4 + 0x30);
      uVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
      (*pcVar1)(piVar4,"oldteam",uVar5);
      (**(code **)(*piVar4 + 0x30))(piVar4,"disconnect",*(int *)(this + 0x1f6c) == 1);
      (**(code **)(*piVar4 + 0x30))(piVar4,"autoteam",param_2);
      (**(code **)(*piVar4 + 0x30))(piVar4,"silent",param_3);
      iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
      if (iVar3 == 0) {
        pcVar1 = *(code **)(*piVar4 + 0x3c);
        uVar5 = (**(code **)(*(int *)this + 0xb8))(this);
        (*pcVar1)(piVar4,"name",uVar5);
      }
      else {
        (**(code **)(*piVar4 + 0x3c))(piVar4,"name",&DAT_00d539c2);
      }
      pcVar1 = *(code **)(*piVar4 + 0x2c);
      bVar2 = (**(code **)(*(int *)this + 0x170))(this);
      (*pcVar1)(piVar4,"isbot",bVar2 ^ 1);
      (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar4,0);
    }
    iVar3 = CBaseEntity::GetTeam((CBaseEntity *)this);
    if (iVar3 != 0) {
      piVar4 = (int *)CBaseEntity::GetTeam((CBaseEntity *)this);
      (**(code **)(*piVar4 + 0x350))(piVar4,this);
    }
    if (param_1 != 0) {
      piVar4 = (int *)GetGlobalTeam(param_1);
      (**(code **)(*piVar4 + 0x34c))(piVar4,this);
    }
    CBaseCombatCharacter::ChangeTeam((CBaseCombatCharacter *)this,param_1);
    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)