Hello,
I have a gripe with how I'm getting reserve ammo to any primary weapon. I currently have
PHP Code:
int _GetReserve(int ent) {
static client, type;
client = GetEntPropEnt(ent, Prop_Send, "m_hOwnerEntity");
if (IsClientValid(client, 2)) {
type = GetEntProp(ent, Prop_Send, "m_iPrimaryAmmoType");
return GetEntProp(client, Prop_Send, "m_iAmmo", 4, type);
}
return -1;
}
This works perfectly if the weapon is being held by a player. If the weapon is on the ground, it's f*****. I was
equipping the weapon onto a player just to get the reserve and then removing it but it feels hackish and if I remember correctly the player could potentially end up with 2 weapons in their primary slot. I was thinking about creating one fake client and hiding them off the map but again, it feels so damn hackish. I'm thinking there has to be a way to look at any weapon and without anyone holding it, get the reserve ammo?
I'm thinking maybe SetEntProp on the m_hOwnerEntity to the client requesting the reserve? If you know a better approach, can you please share? Thanks!