local function playerChat ( message, messageType )
cancelEvent ( )
if ( messageType == 2 ) then
local acc = getPlayerAccount ( source )
if ( not isGuestAccount ( acc ) ) then
if ( getAccountData ( acc, "chatc" ) and getElementData ( source, "Vip" ) == true ) then
local color = getAccountData ( acc, "chatc" )
local team = getPlayerTeam ( source )
if ( not team ) then
return
end
local r, g, b = getTeamColor ( team )
local name = getPlayerName ( source )
for _, team in ipairs ( getPlayersInTeam ( team ) ) do
outputChatBox ( "(ALL): ".. RGBToHex ( r, g, b ) .."".. name ..": ".. ( color and color or "#FFFFFF" ) .."".. message, root, 255, 255, 255, true )
end
end
end
elseif ( messageType == 0 ) then
local r, g, b = getPlayerNametagColor ( source )
local name = getPlayerName ( source )
outputChatBox ( "(ALL): ".. RGBToHex ( r, g, b ) .."".. name ..": #FFFFFF".. message, root, 255, 255, 255, true )
outputServerLog ( "CHAT: ".. name ..": ".. message )
end
end
addEventHandler ( "onPlayerChat", root, playerChat )