Try activating it with [8,player] exec "script.sqs"
If you still can't hear anything then your script isn't working.
ps Messiah - In situations like this arrays are your friend. They can really cut down the amount of code you need. eg:
_num = _this select 0
_pain = _this select 1
_say = ["eng22","eng23","eng29","eng30","eng31","eng32","eng33","eng34"]
_rand = random _num
_rand = _rand - _rand % 1
_pain say (_say select _rand)
exit
@Gameer
I don't think the Error Zero Divisor problem lies with units being removed from the unitarray when they are hurt - The first script I wrote does this, but the second does not. Unit array SHOULD stay the same size at all times, but in practice I have encountered this error as well. I think it might arise when units get into or out of vehicles. The sure-fire way around this problem is to get rid of:
? _tmp > _count : _tmp = 0
and replace it with
? _tmp > count unitarray : _tmp = 0
There is another method that Rubble_Maker came up with that requires fewer uses of the count command (and is therefore marginally quicker) but this method is fine unless you are experiencing serious speed problems.
Cheers