Quote:
Originally Posted by Powerlord
To be honest, after doing a bit of research, it's a bit of a pain to check ammo levels using methods. Hell, you'd need a signature to call CAmmDef::MaxCarry as it has no entity.
Incidentally, why would you need a TF2Items callback to get accurate numbers? Doesn't the post_inventory_application event fire after a player is given a new inventory? You could just iterate over their item slots then.
|
Hm, I used to use post_inventory_application but had problems. I ought to test it again.
and isvalident is something I mostly use privately, usually I edit that out of public things, dunno why I didn't here
So...
PHP Code:
stock GetWeaponAmmo(weapon)
{
new owner = GetEntPropEnt(weapon, Prop_Send, "m_hOwnerEntity");
if (owner == -1) return 0;
if (IsValidEntity(weapon))
{
new iOffset = GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType", 1);
return GetEntProp(owner, Prop_Send, "m_iAmmo", _, iOffset);
}
return 0;
}]
I'd make an sdkcall but i'm too lazy.
Quote:
Originally Posted by Powerlord
The 4 doesn't even need to be set as GetEntProp can figure it out on its own.
|
What exactly does "GetEntProp" do to "figure it out"? I see it has a default value of 4 for the size, but I don't see anything like sizeof(int) or something.
__________________