L L4D2node

CTerrorPlayer::RemoveAmmo

0x00996c90 · 248 bytes · __thiscall

_ZN13CTerrorPlayer10RemoveAmmoEii

Decompiled

undefined (3 params)

/* CTerrorPlayer::RemoveAmmo(int, int) */

void __thiscall CTerrorPlayer::RemoveAmmo(CTerrorPlayer *this,int param_1,int param_2)

{
  int iVar1;
  code *pcVar2;
  undefined4 *puVar3;
  int iVar4;
  int *piVar5;
  undefined4 uVar6;
  
  if (-1 < param_2) {
    iVar1 = *(int *)(this + param_2 * 4 + 0x1874);
    CBaseCombatCharacter::RemoveAmmo((CBaseCombatCharacter *)this,param_1,param_2);
    puVar3 = (undefined4 *)GetAmmoDef();
    iVar4 = (**(code **)*puVar3)(puVar3,param_2,this);
    if ((((iVar4 != 1) && (iVar4 != -2)) &&
        ((float)*(int *)(this + param_2 * 4 + 0x1874) / (float)iVar4 < 0.4)) &&
       (0.4 <= (float)iVar1 / (float)iVar4)) {
      piVar5 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                (gameeventmanager,"total_ammo_below_40",0,0);
      if (piVar5 != (int *)0x0) {
        pcVar2 = *(code **)(*piVar5 + 0x30);
        uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
        (*pcVar2)(piVar5,"userid",uVar6);
                    /* WARNING: Could not recover jumptable at 0x00996d8d. Too many branches */
                    /* WARNING: Treating indirect jump as call */
        (**(code **)(*gameeventmanager + 0x20))();
        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)