L L4D2node

CCSPlayer::SetModelFromClass

0x00653440 · 329 bytes · __thiscall

_ZN9CCSPlayer17SetModelFromClassEv

Decompiled

undefined (1 param)

/* CCSPlayer::SetModelFromClass() */

void __thiscall CCSPlayer::SetModelFromClass(CCSPlayer *this)

{
  CBaseEdict *pCVar1;
  int iVar2;
  int iVar3;
  
  iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  if (iVar2 == 2) {
    iVar2 = *(int *)(this + 0x290c) + -1;
    if ((iVar2 < 0) || (DAT_00f78b48 <= iVar2)) {
      iVar2 = RandomInt(0,DAT_00f78b48 + -1);
      if (iVar2 + 1 != *(int *)(this + 0x290c)) {
        if (this[0x6c] == (CCSPlayer)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar3 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
        }
        *(int *)(this + 0x290c) = iVar2 + 1;
      }
    }
    (**(code **)(*(int *)this + 0x70))(this,*(undefined4 *)(TerroristPlayerModels + iVar2 * 4));
    return;
  }
  iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  if (iVar2 != 3) {
    (**(code **)(*(int *)this + 0x70))(this,*CTPlayerModels);
    return;
  }
  iVar2 = *(int *)(this + 0x290c) + -5;
  if ((iVar2 < 0) || (DAT_00f78b5c <= iVar2)) {
    iVar2 = RandomInt(0,DAT_00f78b5c + -1);
    if (iVar2 + 5 != *(int *)(this + 0x290c)) {
      if (this[0x6c] == (CCSPlayer)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar3 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
      }
      *(int *)(this + 0x290c) = iVar2 + 5;
    }
  }
  (**(code **)(*(int *)this + 0x70))(this,CTPlayerModels[iVar2]);
  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)