public override void onInventory(ShapeBase user, int value) { //Player can be either a player object or a aiturret... GameConnection client = user["client"]; for (int i = 0; i < 8; i++) { if (user.GetType() == typeof (Player)) { ShapeBaseImageData image = (user).getMountedImage(i); if (image <= 0) continue; if (!image["ammo"].isObject()) continue; if (((SimObject) image["ammo"]).getId() != this.getId()) continue; (user).setImageAmmo(i, value != 0); } else if (user.GetType() == typeof (AITurretShape)) { ShapeBaseImageData image = (user).getMountedImage(i); if (image <= 0) continue; if (!image["ammo"].isObject()) continue; if (((SimObject) image["ammo"]).getId() != getId()) continue; (user).setImageAmmo(i, value != 0); } int currentammo = user.getInventory(this); // ShapeBaseShapeBaseGetInventory(player, thisobj); if (user.getClassName() != "Player") continue; int amountInClips; if (this["clip"].isObject()) { amountInClips = user.getInventory(this["clip"]); // ShapeBaseShapeBaseGetInventory(player, thisobj["clip"]); amountInClips *= this["maxInventory"].AsInt(); amountInClips += user["remaining" + getName()].AsInt(); } else { amountInClips = currentammo; currentammo = 1; } if (user["client"] != string.Empty && !user["isAiControlled"].AsBool()) client.setAmmoAmountHud(currentammo, amountInClips); } }