L L4D2node

CCSPlayer::ChangeTeam

0x006529b0 · 294 bytes · __thiscall

_ZN9CCSPlayer10ChangeTeamEi

Decompiled

undefined (2 params)

/* CCSPlayer::ChangeTeam(int) */

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

{
  CBaseEdict *this_00;
  int iVar1;
  int iVar2;
  int local_2c;
  int local_28;
  int local_24;
  int local_20 [4];
  
  iVar1 = GetGlobalTeam(param_1);
  if (iVar1 != 0) {
    iVar1 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    if (param_1 != iVar1) {
      (**(code **)(*(int *)this + 0x8b0))(this,0);
      if (param_1 == 1) {
        *(int *)(this + 0x23e8) = iVar1;
      }
      else {
        this[0x23ec] = (CCSPlayer)0x1;
      }
      (**(code **)(*(int *)this + 0x5fc))(this,0);
      (**(code **)(*(int *)this + 0x720))(this,param_1,0,0);
      if (*(int *)(this + 0x290c) != 0) {
        if (this[0x6c] == (CCSPlayer)0x0) {
          this_00 = *(CBaseEdict **)(this + 0x30);
          if (this_00 != (CBaseEdict *)0x0) {
            *(uint *)this_00 = *(uint *)this_00 | 0x101;
            iVar2 = CBaseEdict::GetChangeAccessor(this_00);
            *(undefined2 *)(iVar2 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
        }
        *(undefined4 *)(this + 0x290c) = 0;
      }
      (**(code **)(*(int *)this + 0x83c))(this,iVar1);
      CCSGameRules::InitializePlayerCounts(g_pGameRules,&local_24,local_20,&local_28,&local_2c);
    }
    return;
  }
  Warning("CCSPlayer::ChangeTeam( %d ) - invalid team index.\n",param_1);
  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)