L L4D2node

CTerrorPlayer::OnWeaponPickedUp

0x009a0770 · 760 bytes · __thiscall

_ZN13CTerrorPlayer16OnWeaponPickedUpEP17CBaseCombatWeapon

Decompiled

undefined (2 params)

/* CTerrorPlayer::OnWeaponPickedUp(CBaseCombatWeapon*) */

void __thiscall CTerrorPlayer::OnWeaponPickedUp(CTerrorPlayer *this,CBaseCombatWeapon *param_1)

{
  undefined **ppuVar1;
  code *pcVar2;
  char cVar3;
  int *piVar4;
  char *pcVar5;
  undefined **ppuVar6;
  int iVar7;
  undefined4 *puVar8;
  int in_GS_OFFSET;
  byte bVar9;
  longdouble lVar10;
  CTerrorPlayer *pCVar11;
  CAI_Concept local_128 [8];
  char local_120 [4];
  undefined4 local_11c [63];
  int local_20;
  
  bVar9 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (0.0 < *(float *)(this + 0x23c4)) {
    pCVar11 = this + 0x23c0;
    lVar10 = (longdouble)IntervalTimer::Now();
    if ((float)lVar10 - *(float *)(this + 0x23c4) < 1.0) goto LAB_009a07ca;
  }
  piVar4 = (int *)(**(code **)(*(int *)param_1 + 0x5e0))(param_1);
  if ((piVar4 == (int *)0x0) || (cVar3 = (**(code **)(*piVar4 + 0x16c))(piVar4), cVar3 == '\0')) {
    puVar8 = local_11c;
    for (iVar7 = 0x3f; iVar7 != 0; iVar7 = iVar7 + -1) {
      *puVar8 = 0;
      puVar8 = puVar8 + (uint)bVar9 * -2 + 1;
    }
    local_120[0] = '\0';
    local_120[1] = '\0';
    local_120[2] = '\0';
    local_120[3] = '\0';
  }
  else {
    puVar8 = local_11c;
    for (iVar7 = 0x3f; iVar7 != 0; iVar7 = iVar7 + -1) {
      *puVar8 = 0;
      puVar8 = puVar8 + (uint)bVar9 * -2 + 1;
    }
    local_120[0] = '\0';
    local_120[1] = '\0';
    local_120[2] = '\0';
    local_120[3] = '\0';
    V_strncat(local_120,"ItemDonor:",0x100,-1);
    pcVar5 = (char *)SurvivorCharacterName(piVar4[0xae8]);
    V_strncat(local_120,pcVar5,0x100,-1);
    V_strncat(local_120,",",0x100,-1);
  }
  V_strncat(local_120,"ItemPickedUp:",0x100,-1);
  pcVar5 = (char *)(**(code **)(*(int *)param_1 + 0x6c8))(param_1);
  V_strncat(local_120,pcVar5,0x100,-1);
  iVar7 = CWeaponCSBase::GetCSWpnData((CWeaponCSBase *)param_1);
  pcVar5 = "pistol";
  if (*(undefined **)(iVar7 + 0x894) != (undefined *)0x0) {
    ppuVar6 = &s_weaponTypeInfo;
    do {
      pcVar5 = ppuVar6[2];
      if (pcVar5 == (char *)0x0) {
        pcVar5 = tokenset_t<CSWeaponType>::GetNameByToken(CSWeaponType)::unknown;
        if (tokenset_t<CSWeaponType>::GetNameByToken(CSWeaponType)::unknown == (undefined *)0x0)
        goto LAB_009a0900;
        break;
      }
      ppuVar1 = ppuVar6 + 3;
      ppuVar6 = ppuVar6 + 2;
    } while (*(undefined **)(iVar7 + 0x894) != *ppuVar1);
  }
  V_strncat(local_120,",ItemType:",0x100,-1);
  V_strncat(local_120,pcVar5,0x100,-1);
LAB_009a0900:
  iVar7 = (**(code **)(*(int *)param_1 + 0x638))(param_1);
  if ((iVar7 != 1) ||
     (pCVar11 = (CTerrorPlayer *)param_1, cVar3 = (**(code **)(*(int *)param_1 + 0x674))(param_1),
     cVar3 != '\0')) {
    pcVar2 = *(code **)(*(int *)this + 0x7b4);
    CAI_Concept::CAI_Concept(local_128,"PlayerPickup");
    (*pcVar2)(this,local_128,3,local_120,0,0,0);
    CDirectorItemManager::RemoveItemFromScavengeCache
              (*(CDirectorItemManager **)(TheDirector + 0x62c),(CBaseEntity *)param_1);
    CBasePlayer::RumbleEffect((CBasePlayer *)this,'\"','\0','\x04');
    pCVar11 = this;
  }
LAB_009a07ca:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail(pCVar11);
}

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)