local chatRadius = 25 --units
function sendMessageToNearbyPlayers( message, messageType )
if messageType == 0 then
local posX, posY, posZ = getElementPosition( source )
local chatSphere = createColSphere( posX, posY, posZ, chatRadius )
local nearbyPlayers = getElementsWithinColShape( chatSphere, "player" )
destroyElement( chatSphere )
for index, nearbyPlayer in ipairs( nearbyPlayers ) do
outputChatBox( message, nearbyPlayer )
end
end
end
addEventHandler( "onPlayerChat", getRootElement(), sendMessageToNearbyPlayers )
function blockChatMessage()
cancelEvent()
end
addEventHandler( "onPlayerChat", getRootElement(), blockChatMessage )