I was wondering if anyone knows a property or method for setting the maximum ammo of a sentry gun. Currently, I'm setting the ammo of a sentry gun just fine using "m_iAmmoShells", but I can't find a similar property for maximum ammo. Although I've noticed "m_iMaxAmmoShells" does exist in the game's source, I get the "can't find property" exception when trying to set it.
Currently I've implemented a hacky work around where I'm constantly checking to make sure the sentry's ammo doesn't go over the max, but I'm just wondering if anyone has a better solution. Here's what it looks like:
Code:
static Action CheckApplyMiniLowAmmo(Handle timer, DataPack pack)
{
pack.Reset();
int client = pack.ReadCell();
int sent = pack.ReadCell();
int ammoAmount = pack.ReadCell();
int state = GetEntProp(sent, Prop_Send, "m_iState");
if (state != 0 && GetEntProp(sent, Prop_Send, "m_iAmmoShells") > ammoAmount)
{
if (GetEntProp(sent, Prop_Send, "m_iHealth") >= 100 && GetEntProp(sent, Prop_Send, "m_iAmmoShells") >= ammoAmount)
{
int currMetal = GetEntProp(client, Prop_Data, "m_iAmmo", 4, 3);
SetEntProp(client, Prop_Data, "m_iAmmo", currMetal + 40, 4, 3);
}
SetEntProp(sent, Prop_Send, "m_iAmmoShells", ammoAmount);
}
ReduceSentryAmmo(client, sent, ammoAmount);
}