L L4D2node

CBaseCombatWeapon::OnPickedUp

0x0040b670 · 423 bytes · __thiscall

_ZN17CBaseCombatWeapon10OnPickedUpEP20CBaseCombatCharacter

Decompiled

undefined (2 params)

/* CBaseCombatWeapon::OnPickedUp(CBaseCombatCharacter*) */

void __thiscall CBaseCombatWeapon::OnPickedUp(CBaseCombatWeapon *this,CBaseCombatCharacter *param_1)

{
  CBaseEdict *this_00;
  char cVar1;
  int iVar2;
  CBasePlayer *pCVar3;
  int iVar4;
  uint uVar5;
  CRecipientFilter local_3c [44];
  
  uVar5 = *(uint *)(this + 0xd4) & 0xfffffeff;
  if (*(uint *)(this + 0xd4) != uVar5) {
    if (this[0x6c] == (CBaseCombatWeapon)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] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
    }
    *(uint *)(this + 0xd4) = uVar5;
  }
  cVar1 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
  if (cVar1 == '\0') {
    COutputEvent::FireOutput
              ((COutputEvent *)(this + 0x14c0),(CBaseEntity *)param_1,(CBaseEntity *)this,0.0);
    this[0x1458] = (CBaseCombatWeapon)0x0;
    return;
  }
  COutputEvent::FireOutput
            ((COutputEvent *)(this + 0x14a8),(CBaseEntity *)param_1,(CBaseEntity *)this,0.0);
  CRecipientFilter::CRecipientFilter(local_3c);
  if (0 < *(int *)(gpGlobals + 0x14)) {
    iVar2 = 1;
    do {
                    /* try { // try from 0040b720 to 0040b7c7 has its CatchHandler @ 0040b81d */
      while (((pCVar3 = (CBasePlayer *)UTIL_PlayerByIndex(iVar2), pCVar3 == (CBasePlayer *)0x0 ||
              (cVar1 = (**(code **)(*(int *)pCVar3 + 300))(pCVar3), cVar1 != '\0')) ||
             (iVar4 = (**(code **)(*(int *)pCVar3 + 0x648))(pCVar3), iVar4 != 4))) {
        iVar2 = iVar2 + 1;
        if (*(int *)(gpGlobals + 0x14) < iVar2) goto LAB_0040b770;
      }
      CRecipientFilter::AddRecipient(local_3c,pCVar3);
      iVar2 = iVar2 + 1;
    } while (iVar2 <= *(int *)(gpGlobals + 0x14));
  }
LAB_0040b770:
  iVar2 = CRecipientFilter::GetRecipientCount(local_3c);
  if (iVar2 != 0) {
    if (*(int *)(param_1 + 0x30) == 0) {
      iVar2 = 0;
    }
    else {
      iVar2 = *(int *)(param_1 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    }
    CBaseEntity::EmitSound
              ((IRecipientFilter *)local_3c,iVar2,"Player.PickupWeapon",(Vector *)0x0,0.0,
               (float *)0x0);
  }
  *(undefined4 *)(this + 0x154) = 0;
  CRecipientFilter::~CRecipientFilter(local_3c);
  this[0x1458] = (CBaseCombatWeapon)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)