CBaseCombatWeapon::HasAmmo
0x00405f80 · 187 bytes · __thiscall
_ZN17CBaseCombatWeapon7HasAmmoEv
Decompiled
undefined (1 param)
/* CBaseCombatWeapon::HasAmmo() */
bool __thiscall CBaseCombatWeapon::HasAmmo(CBaseCombatWeapon *this)
{
char cVar1;
uint uVar2;
CBaseCombatCharacter *this_00;
int iVar3;
if (*(int *)(this + 0x1418) == -1) {
if (*(int *)(this + 0x141c) == -1) {
return true;
}
uVar2 = (**(code **)(*(int *)this + 0x52c))(this);
}
else {
uVar2 = (**(code **)(*(int *)this + 0x52c))(this);
}
if ((uVar2 & 1) != 0) {
return true;
}
this_00 = (CBaseCombatCharacter *)GetOwner(this);
if ((this_00 == (CBaseCombatCharacter *)0x0) ||
(cVar1 = (**(code **)(*(int *)this_00 + 0x16c))(this_00), cVar1 == '\0')) {
return false;
}
if (0 < *(int *)(this + 0x1420)) {
return (bool)cVar1;
}
iVar3 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x1418));
if (iVar3 == 0) {
if (*(int *)(this + 0x1424) < 1) {
iVar3 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x141c));
return iVar3 != 0;
}
return (bool)cVar1;
}
return (bool)cVar1;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.