I did a script that changes a units sidearm (handgun). To change his handgun it first finds out what is his handgun, so you could modify this script to suit you purpose. It is attached.
Oops, I attached an old version of the script, good thing I double checked it. Sorry about that, here is an updated version