All pastes #1675390 Raw Edit

Mine

public text v1 · immutable
#1675390 ·published 2009-11-17 21:31 UTC
rendered paste body
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 )