Please bear with the muddled typing, and hopefully not to muddled thinking - just back from a wonderful dinner in Provence.
_tank addEventHandler ["fired",{call format ["bullet=nearestObject [_this select 0,""%1""]",_this select 4]; tankDir=(getDir bullet)}]
All this does is once the tank fires its gun is to set the values of two global variables. I presume you have a script running somewhere that uses them. One posibility is to have the EH run the script directly, something like (and this is where the provencal wine starts to get in the way);
_tank addEventHandler ["fired",{[_this select 0,_this select 4] exec "thisisthescripttorunwhenatankfiresitsgun.sqs"}]
in the script have
_bullet =nearestObject [_this select 0,_this select 1]
_tankDir=(getDir _bullet)
Or some such.
Also
_tank addEventHandler ["fired",{_this exec "thisisthescripttorunwhenatankfiresitsgun.sqs"}]
might also be worth playing around with.
In the script:
_this select 0 : who fired ;
_this select 1 : with what weapon ;
_this select 2 : with what muzzle (your M16, or M203 ?)
_this select 3 : mode ? (either single, or burst, or auto)
_this select 4 : the type of ammo used.
I am sorry I can't test anything I am away from my games machine at the moment.