Public feed
#887671
function sendMessageToNearbyPlayers( message, messageType )
local chatRadius = 20 --units
if messageType == 0 then
-- get the chatting player's position
local posX, posY, posZ = getElementPosition( source )
-- create a sphere of the specified radius in that position
local chatSphere = createColSphere( posX, posY, posZ, chatRadius )
local nearbyPlayers = getElementsWithinColShape( chatSphere, "player" )
destroyElement( chatSphere )
for index, nearbyPlayer in ipairs( nearbyPlayers ) do
outputChatBox( getPlayerName(source) .. ": " .. message, nearbyPlayer )
end
end
end