Your code makes no sense at all.
Why would you possibly need this irritating plugin?
"In range" of what? I suggest you stop writing this plugin, no one will download it.
If you still wanna write it...:
Whenever there is one person outside of the range no one inside will se a hudmsg since your second loop wich shouldn't even be there keeps counting until i is equal to num... then the first loop would end too, since i is equal to num.