so you say you already know the script to use? then a trigger over the area where u want him to cease fire, grouped with the unit, repeatedly, with the:
OnAct execing your script
OnDeAct: keepgoing = false
.. in your script you will probably have a loop to keep checking the ammo, so at the start of that loop put
!(keepgoing):exit and put at the first line of the script, or in init.sqs, keepgoing = true
so all the time the unit is in the area it will keep checking your script, and when he leaves it will exit the script. he can the reenter and rerun the script.