local chatRadius = 15
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 )
local gracz = getPlayerName ( source )
local dlugosc = #message
for index, nearbyPlayer in ipairs ( nearbyPlayers ) do
outputChatBox ( "#99b7d0".. gracz .." mówi: #c8e6ff".. message, nearbyPlayer, 255, 255, 255, true )
end
if ( dlugosc <= 8 ) then
setPedAnimation ( source, "ped", "IDLE_chat", ( #message * 70 ), false, false, false, false )
else
setPedAnimation ( source, "ped", "IDLE_chat", ( #message * 35 ), false, false, false, false )
end
end
end
addEventHandler ( "onPlayerChat", root, sendMessageToNearbyPlayers )
Try that.