L L4D2node

WeaponManager_AmmoMod

0x006d1890 · 219 bytes · __cdecl

_Z21WeaponManager_AmmoModP17CBaseCombatWeapon

Decompiled

undefined (1 param)

/* WeaponManager_AmmoMod(CBaseCombatWeapon*) */

void WeaponManager_AmmoMod(CBaseCombatWeapon *param_1)

{
  float fVar1;
  int iVar2;
  CBaseEdict *this;
  int iVar3;
  int iVar4;
  int iVar5;
  
  iVar5 = 0;
  if (0 < DAT_00fe3594) {
    do {
      iVar4 = *(int *)(g_Managers + iVar5 * 4);
      if (*(int *)(iVar4 + 0x440) == *(int *)(param_1 + 0x7c)) {
        iVar2 = *(int *)(param_1 + 0x1420);
        fVar1 = *(float *)(iVar4 + 0x448);
        iVar3 = RandomInt(0xfffffffe,2);
        iVar3 = (int)((float)iVar2 * fVar1) + iVar3;
        iVar4 = (**(code **)(*(int *)param_1 + 0x510))(param_1);
        if (iVar4 < iVar3) {
          iVar3 = (**(code **)(*(int *)param_1 + 0x510))(param_1);
        }
        else if (iVar3 < 1) {
          iVar3 = 1;
        }
        if (iVar3 != *(int *)(param_1 + 0x1420)) {
          if (param_1[0x6c] == (CBaseCombatWeapon)0x0) {
            this = *(CBaseEdict **)(param_1 + 0x30);
            if (this != (CBaseEdict *)0x0) {
              *(uint *)this = *(uint *)this | 0x101;
              iVar4 = CBaseEdict::GetChangeAccessor(this);
              *(undefined2 *)(iVar4 + 2) = 0;
            }
            *(int *)(param_1 + 0x1420) = iVar3;
          }
          else {
            param_1[0x70] = (CBaseCombatWeapon)((byte)param_1[0x70] | 1);
            *(int *)(param_1 + 0x1420) = iVar3;
          }
        }
      }
      iVar5 = iVar5 + 1;
    } while (iVar5 < DAT_00fe3594);
  }
  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)