L L4D2node

CBasePlayer::HasAnyAmmoOfType

0x007b8200 · 263 bytes · __thiscall

_ZN11CBasePlayer16HasAnyAmmoOfTypeEi

Decompiled

undefined (2 params)

/* CBasePlayer::HasAnyAmmoOfType(int) */

undefined4 __thiscall CBasePlayer::HasAnyAmmoOfType(CBasePlayer *this,int param_1)

{
  int *piVar1;
  uint uVar2;
  char cVar3;
  int iVar4;
  undefined *puVar5;
  int iVar6;
  
  if (param_1 < 0) {
    return 0;
  }
  iVar6 = 0;
  iVar4 = CBaseCombatCharacter::GetAmmoCount((CBaseCombatCharacter *)this,param_1);
  if (iVar4 != 0) {
    return 1;
  }
  do {
    while ((uVar2 = *(uint *)(this + iVar6 * 4 + 0x18f4), uVar2 == 0xffffffff ||
           (puVar5 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc))) {
LAB_007b8290:
      iVar6 = iVar6 + 1;
      if (iVar6 == 0x38) {
        return 0;
      }
    }
    if (*(uint *)(puVar5 + 8) == uVar2 >> 0xc) {
      piVar1 = *(int **)(puVar5 + 4);
      if (piVar1 != (int *)0x0) {
        cVar3 = (**(code **)(*piVar1 + 0x548))(piVar1);
        if (((cVar3 != '\0') && (iVar4 = (**(code **)(*piVar1 + 0x55c))(piVar1), param_1 == iVar4))
           && (cVar3 = (**(code **)(*piVar1 + 0x410))(piVar1), cVar3 != '\0')) {
          return 1;
        }
        cVar3 = (**(code **)(*piVar1 + 0x54c))(piVar1);
        if (((cVar3 != '\0') && (iVar4 = (**(code **)(*piVar1 + 0x560))(piVar1), param_1 == iVar4))
           && (cVar3 = (**(code **)(*piVar1 + 0x414))(piVar1), cVar3 != '\0')) {
          return 1;
        }
      }
      goto LAB_007b8290;
    }
    iVar6 = iVar6 + 1;
    if (iVar6 == 0x38) {
      return 0;
    }
  } while( true );
}

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)