this is not hard, quite easy actualy
i'll show how u can do it, first make a script sayin something like this:
code:
_object = _this select 0
_player = _this select 1
#loop
? (_object getDistance _player ) < 10 : do something(make _bool false 2)
? _bool : goto "loop"
exit
/code
then just execute the scipt by placing it somewhere and typing [object, player] exec "somename.sqs"
That's all there's too it