CC_GiveCurrentAmmo
0x007a7410 · 279 bytes · unknown
_Z18CC_GiveCurrentAmmov
Decompiled
undefined (0 params)
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* CC_GiveCurrentAmmo() */
void CC_GiveCurrentAmmo(void)
{
char cVar1;
CBaseCombatCharacter *this;
CBaseCombatWeapon *this_00;
int iVar2;
undefined4 *puVar3;
char *pcVar4;
CAmmoDef *pCVar5;
this = (CBaseCombatCharacter *)UTIL_PlayerByIndex(1);
if (this != (CBaseCombatCharacter *)0x0) {
this_00 = (CBaseCombatWeapon *)CBaseCombatCharacter::GetActiveWeapon(this);
if (this_00 != (CBaseCombatWeapon *)0x0) {
cVar1 = CBaseCombatWeapon::UsesPrimaryAmmo(this_00);
if (cVar1 != '\0') {
iVar2 = (**(code **)(*(int *)this_00 + 0x55c))(this_00);
if (iVar2 != -1) {
puVar3 = (undefined4 *)GetAmmoDef();
pcVar4 = (char *)(**(code **)*puVar3)(puVar3,iVar2,this);
pCVar5 = (CAmmoDef *)GetAmmoDef();
puVar3 = (undefined4 *)CAmmoDef::GetAmmoOfIndex(pCVar5,iVar2);
CBaseCombatCharacter::GiveAmmo((int)this,pcVar4,SUB41(*puVar3,0));
}
}
cVar1 = CBaseCombatWeapon::UsesSecondaryAmmo(this_00);
if (cVar1 != '\0') {
cVar1 = (**(code **)(*(int *)this_00 + 0x414))(this_00);
if (cVar1 != '\0') {
iVar2 = (**(code **)(*(int *)this_00 + 0x560))(this_00);
if (iVar2 != -1) {
puVar3 = (undefined4 *)GetAmmoDef();
pcVar4 = (char *)(**(code **)*puVar3)(puVar3,iVar2,this);
pCVar5 = (CAmmoDef *)GetAmmoDef();
puVar3 = (undefined4 *)CAmmoDef::GetAmmoOfIndex(pCVar5,iVar2);
CBaseCombatCharacter::GiveAmmo((int)this,pcVar4,SUB41(*puVar3,0));
return;
}
}
}
}
}
return;
}
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.