L L4D2node

CWeaponCSBase::OnPickedUp

0x00441c90 · 360 bytes · __thiscall

_ZN13CWeaponCSBase10OnPickedUpEP20CBaseCombatCharacter

Decompiled

undefined (2 params)

/* CWeaponCSBase::OnPickedUp(CBaseCombatCharacter*) */

void __thiscall CWeaponCSBase::OnPickedUp(CWeaponCSBase *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] == (CWeaponCSBase)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] = (CWeaponCSBase)((byte)this[0x70] | 1);
    }
    *(uint *)(this + 0xd4) = uVar5;
  }
  cVar1 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
  if ((cVar1 == '\0') || (cVar1 = (**(code **)(*(int *)param_1 + 300))(param_1), cVar1 == '\0')) {
    this[0x1458] = (CWeaponCSBase)0x0;
    return;
  }
  iVar2 = 0;
  CRecipientFilter::CRecipientFilter(local_3c);
  while (iVar2 < *(int *)(gpGlobals + 0x14)) {
    while( true ) {
      iVar2 = iVar2 + 1;
                    /* try { // try from 00441d48 to 00441de3 has its CatchHandler @ 00441e0c */
      pCVar3 = (CBasePlayer *)UTIL_PlayerByIndex(iVar2);
      if (((pCVar3 == (CBasePlayer *)0x0) ||
          (cVar1 = (**(code **)(*(int *)pCVar3 + 300))(pCVar3), cVar1 != '\0')) ||
         (iVar4 = (**(code **)(*(int *)pCVar3 + 0x648))(pCVar3), iVar4 != 4)) break;
      CRecipientFilter::AddRecipient(local_3c,pCVar3);
      if (*(int *)(gpGlobals + 0x14) <= iVar2) goto LAB_00441d90;
    }
  }
LAB_00441d90:
  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] = (CWeaponCSBase)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)