I made a function that finds multiple objects within a given distance of a given object. Actually, more than one function, one finds everything, the other finds objects of a given type. They are both attached. Instructions are in the function headers.
I do not advise using this function using a radius too large. I think that 500 m radius will probably crash OFP as h- says. You use it in a script that check smaller sections in a loop that will move the check area around until you cover the larger area. Or, if you do have a larger search radius, you could set the search increments to a large value (like 10 m), then you may be able to search a 500 m radius in one call of the function, but you would then miss many items. The largest area I have entered for the function is 150 m with a search increment of 5 m.