L L4D2node

CCSPlayer::DropWeapons

0x00658ca0 · 966 bytes · __thiscall

_ZN9CCSPlayer11DropWeaponsEb

Decompiled

undefined (2 params)

/* CCSPlayer::DropWeapons(bool) */

void __thiscall CCSPlayer::DropWeapons(CCSPlayer *this,bool param_1)

{
  float fVar1;
  CBaseEdict *this_00;
  char cVar2;
  CBaseCombatWeapon *pCVar3;
  Vector *pVVar4;
  CBaseEntity *this_01;
  int iVar5;
  CBaseCSGrenade *this_02;
  longdouble lVar6;
  float local_40;
  float local_3c;
  float local_38;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  pCVar3 = (CBaseCombatWeapon *)
           CBaseCombatCharacter::Weapon_OwnsThisType((CBaseCombatCharacter *)this,"weapon_c4",0);
  if (pCVar3 != (CBaseCombatWeapon *)0x0) {
    CSWeaponDrop(this,pCVar3,false,true,(Vector *)0x0);
  }
  if (this[0x2428] != (CCSPlayer)0x0) {
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    AngleVectors((QAngle *)(this + 0x37c),(Vector *)&local_40,(Vector *)&local_34,(Vector *)0x0);
    pVVar4 = (Vector *)(**(code **)(*(int *)this + 0x288))(this);
    this_01 = (CBaseEntity *)
              CBaseEntity::Create("item_defuser",pVVar4,(QAngle *)(this + 0x3a8),(CBaseEntity *)this
                                 );
    lVar6 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xc2480000,0x42480000);
    fVar1 = (float)lVar6;
    local_24 = local_30 * fVar1 + local_3c * 200.0;
    local_20 = local_2c * fVar1 + local_38 * 200.0;
    local_28 = fVar1 * local_34 + local_40 * 200.0;
    CBaseEntity::ApplyAbsVelocityImpulse(this_01,(Vector *)&local_28);
    if (this[0x2428] != (CCSPlayer)0x0) {
      if (this[0x6c] == (CCSPlayer)0x0) {
        this_00 = *(CBaseEdict **)(this + 0x30);
        if (this_00 != (CBaseEdict *)0x0) {
          *(uint *)this_00 = *(uint *)this_00 | 0x101;
          iVar5 = CBaseEdict::GetChangeAccessor(this_00);
          *(undefined2 *)(iVar5 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
      }
      this[0x2428] = (CCSPlayer)0x0;
    }
  }
  cVar2 = DropWeaponInSlot(this,0);
  if ((cVar2 == '\0') && (param_1)) {
    DropWeaponInSlot(this,1);
  }
  iVar5 = CBaseCombatCharacter::Weapon_OwnsThisType
                    ((CBaseCombatCharacter *)this,"weapon_hegrenade",0);
  if (((((iVar5 != 0) &&
        (this_02 = (CBaseCSGrenade *)
                   __dynamic_cast(iVar5,&CBaseCombatWeapon::typeinfo,&CBaseCSGrenade::typeinfo,0),
        this_02 != (CBaseCSGrenade *)0x0)) &&
       ((this_02[0x17dd] != (CBaseCSGrenade)0x0 || (0.0 < *(float *)(this_02 + 0x17e0))))) ||
      (((iVar5 = CBaseCombatCharacter::Weapon_OwnsThisType
                           ((CBaseCombatCharacter *)this,"weapon_flashbang",0), iVar5 != 0 &&
        (this_02 = (CBaseCSGrenade *)
                   __dynamic_cast(iVar5,&CBaseCombatWeapon::typeinfo,&CBaseCSGrenade::typeinfo,0),
        this_02 != (CBaseCSGrenade *)0x0)) &&
       ((this_02[0x17dd] != (CBaseCSGrenade)0x0 || (0.0 < *(float *)(this_02 + 0x17e0))))))) ||
     (((iVar5 = CBaseCombatCharacter::Weapon_OwnsThisType
                          ((CBaseCombatCharacter *)this,"weapon_smokegrenade",0), iVar5 != 0 &&
       (this_02 = (CBaseCSGrenade *)
                  __dynamic_cast(iVar5,&CBaseCombatWeapon::typeinfo,&CBaseCSGrenade::typeinfo,0),
       this_02 != (CBaseCSGrenade *)0x0)) &&
      ((this_02[0x17dd] != (CBaseCSGrenade)0x0 || (0.0 < *(float *)(this_02 + 0x17e0))))))) {
    (**(code **)(*(int *)this_02 + 0x710))(this_02);
    CBaseCSGrenade::DecrementAmmo(this_02,(CBaseCombatCharacter *)this);
  }
  pCVar3 = (CBaseCombatWeapon *)
           CBaseCombatCharacter::Weapon_OwnsThisType
                     ((CBaseCombatCharacter *)this,"weapon_hegrenade",0);
  if (((pCVar3 == (CBaseCombatWeapon *)0x0) ||
      (cVar2 = (**(code **)(*(int *)pCVar3 + 0x3c8))(pCVar3), cVar2 == '\0')) &&
     ((pCVar3 = (CBaseCombatWeapon *)
                CBaseCombatCharacter::Weapon_OwnsThisType
                          ((CBaseCombatCharacter *)this,"weapon_flashbang",0),
      pCVar3 == (CBaseCombatWeapon *)0x0 ||
      (cVar2 = (**(code **)(*(int *)pCVar3 + 0x3c8))(pCVar3), cVar2 == '\0')))) {
    pCVar3 = (CBaseCombatWeapon *)
             CBaseCombatCharacter::Weapon_OwnsThisType
                       ((CBaseCombatCharacter *)this,"weapon_smokegrenade",0);
    if (pCVar3 == (CBaseCombatWeapon *)0x0) {
      return;
    }
    cVar2 = (**(code **)(*(int *)pCVar3 + 0x3c8))(pCVar3);
    if (cVar2 == '\0') {
      return;
    }
  }
  CSWeaponDrop(this,pCVar3,false,false,(Vector *)0x0);
  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)