You are awesome, thanks again for your help it works!
I am glad to hear that
Too bad that the "ammo" command don't work with hand guns, I noticed that corrected the infinite ammo when switching adding/removing the supressor, specially when we've got 0 rounds and magazines, and by magic we've got another magazine.
I would like to point that
"ammo" command works with every weapon and handguns are also supported. You may check it, just for fun, by using a radio trigger with following line in the activation field and comparing what you read in the box with what you read in the top left of corner showing ammo and magazines left:
hint format ["%1", player ammo "GlockSMag"]
Problem is that "ammo" command only shows (technically "returns") how many ammo are left in the current magazine and don't let you add single ammo like you can do it with single magazine (which make it pretty useless). If you want to know how many ammo remain in your pistol, then you may want to consider eating a bit of math and think about TA = {[(TM - 1) * FA] - CA}
- where "TA" is number of total ammo left in your pistol
- where "TM" is number of total magazine you can determine with the code provided in the previous script
- where "1" refers to the magazine you are using which has limited ammo that you will separately count later
- where "FA" is fixed number of ammo a magazine can hold (e.g. 14 for a silenced Glock)
- where "CA" is number of ammo left in current magazine which you can determine with the code shown above
Ok, I think i've got the key for fix that problem. Sorry to bother you again but, do you know if it's possible to remove one magazine always we perform the action "reloading" ? That would be great.
Well, I didn't understood clearly what you meant with "reloading". However, I think you may refers either to switching between pistol magazines types or to action you perform via action menu.
- if "reloading" means switching between pistol magazines type, sure you can do it. I guess you want to achieve that, when switching from magazine type to other magazine type, you want ammo in current magazine to get wasted (which add more realism to "reloading" because in real life, if you drop a magazine with some ammo, those ammo will not get magically back in your hands). Well, you can do it by just adding following line after line you use for returning how many magazines remain in your pistol:
? (player ammo "GlockS" <= 13) : _magazines = _magazines - 1
so it would look:
_magazines = {_x == "GlockSMag"} count magazines player
? (player ammo "GlockS" <= 13) : _magazines = _magazines - 1
player removeMagazines "GlockSMag"
and this way you can switch between magazine types without wasting any ammo when you switch full magazine because, only in this case, you can save your ammo accordingly to Cold War Assault limit.
- if "reloading" means making use of action menu, then you should consider about opening a new thread and post this question there.
Cheers!