L L4D2node

CCSPlayer::SwitchTeam

0x0065afa0 · 729 bytes · __thiscall

_ZN9CCSPlayer10SwitchTeamEi

Decompiled

undefined (2 params)

/* CCSPlayer::SwitchTeam(int) */

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

{
  CBaseEdict *pCVar1;
  int iVar2;
  int local_1c;
  int local_18;
  int local_14;
  int local_10;
  
  iVar2 = GetGlobalTeam(param_1);
  if ((iVar2 == 0) || (1 < param_1 - 2U)) {
    Warning("CCSPlayer::SwitchTeam( %d ) - invalid team index.\n",param_1);
  }
  else {
    iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    if (param_1 != iVar2) {
      this[0x23ec] = (CCSPlayer)0x1;
      (**(code **)(*(int *)this + 0x5fc))(this,0);
      (**(code **)(*(int *)this + 0x720))(this,param_1,0,0);
      if (this[0x2428] != (CCSPlayer)0x0) {
        if (this[0x6c] == (CCSPlayer)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar2 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
        }
        this[0x2428] = (CCSPlayer)0x0;
      }
      switch(*(undefined4 *)(this + 0x290c)) {
      case 1:
        if (this[0x6c] == (CCSPlayer)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar2 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
        }
        *(undefined4 *)(this + 0x290c) = 5;
        break;
      case 2:
        if (this[0x6c] == (CCSPlayer)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar2 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
        }
        *(undefined4 *)(this + 0x290c) = 6;
        break;
      case 3:
        if (this[0x6c] == (CCSPlayer)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar2 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
        }
        *(undefined4 *)(this + 0x290c) = 7;
        break;
      case 4:
        if (this[0x6c] == (CCSPlayer)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar2 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
        }
        *(undefined4 *)(this + 0x290c) = 8;
        break;
      case 5:
        if (this[0x6c] == (CCSPlayer)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar2 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
        }
        *(undefined4 *)(this + 0x290c) = 1;
        break;
      case 6:
        if (this[0x6c] == (CCSPlayer)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar2 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
        }
        *(undefined4 *)(this + 0x290c) = 2;
        break;
      case 7:
        if (this[0x6c] == (CCSPlayer)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar2 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
        }
        *(undefined4 *)(this + 0x290c) = 3;
        break;
      case 8:
        if (this[0x6c] == (CCSPlayer)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar2 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
        }
        *(undefined4 *)(this + 0x290c) = 4;
      }
      CCSGameRules::InitializePlayerCounts(g_pGameRules,&local_14,&local_10,&local_18,&local_1c);
      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)