L L4D2node

OnAmmoUpgradeRemoved

0x0051ecc0 · 251 bytes · __cdecl

_Z20OnAmmoUpgradeRemovedP13CTerrorWeapon

Decompiled

undefined (1 param)

/* OnAmmoUpgradeRemoved(CTerrorWeapon*) */

void OnAmmoUpgradeRemoved(CTerrorWeapon *param_1)

{
  CBaseEdict *pCVar1;
  CTerrorWeapon CVar2;
  int iVar3;
  int iVar4;
  
  iVar3 = (**(code **)(*(int *)param_1 + 0x638))(param_1);
  if (iVar3 == 0x25) {
    CVar2 = param_1[0x1790];
    if ((uint)(byte)CVar2 != *(uint *)(param_1 + 0x1420)) {
      if (param_1[0x6c] == (CTerrorWeapon)0x0) {
        pCVar1 = *(CBaseEdict **)(param_1 + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar3 + 2) = 0;
        }
      }
      else {
        param_1[0x70] = (CTerrorWeapon)((byte)param_1[0x70] | 1);
      }
      *(uint *)(param_1 + 0x1420) = (uint)(byte)CVar2;
      return;
    }
  }
  else {
    CVar2 = param_1[0x1790];
    iVar3 = *(int *)(param_1 + 0x1420) - (uint)(byte)CVar2;
    if (*(int *)(param_1 + 0x1420) != iVar3) {
      if (param_1[0x6c] == (CTerrorWeapon)0x0) {
        pCVar1 = *(CBaseEdict **)(param_1 + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar4 + 2) = 0;
          CVar2 = param_1[0x1790];
        }
        *(int *)(param_1 + 0x1420) = iVar3;
      }
      else {
        param_1[0x70] = (CTerrorWeapon)((byte)param_1[0x70] | 1);
        *(int *)(param_1 + 0x1420) = iVar3;
      }
    }
    if (CVar2 != (CTerrorWeapon)0x0) {
      if (param_1[0x6c] == (CTerrorWeapon)0x0) {
        pCVar1 = *(CBaseEdict **)(param_1 + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar3 + 2) = 0;
        }
      }
      else {
        param_1[0x70] = (CTerrorWeapon)((byte)param_1[0x70] | 1);
      }
      param_1[0x1790] = (CTerrorWeapon)0x0;
      return;
    }
  }
  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)