Hi SS
I'm not sure if I have this right but it looks like you're getting _num from the script parameter (_this select 0), then using _num to determine which gun to get. That's fine so long as your script parameter is 0, 1 or 2, eg -
[0] exec "giveGun.sqs"
This should pass the number "0" to _num, which will result in the script selecting item 0 from the list of guns (ie - "M16").
It may be that this is not what you intended. You may instead wish to define which gun is selected from within the script (by simple assigment, eg _num = 0) or by reference to some public variable. In that case try wording your script like this -
guns = ["M16","M21","M60"]
_num = 0
_weapon = guns select _num
_otherguy setpos getpos _somedude
removeallweapons _otherguy
_otherguy addweapon _weapon
Of course if you wanted to have some external script determine which gun to take you would set the second line to read -
_num = gunSelection
where gunSelection is defined by some other script or Init entry (eg gunSelection = 0).
Hope that this helps.
roni