You can change the first six lines according to your needs,
adminTag = "[ADMIN]"
sModTag = "[sMOD]"
modTag = "[MOD]"
adminColor = "#FF0000" -- leave blank if you dont want pre defined color
sModColor = "#FF0000" -- leave blank if you dont want pre defined color
modColor = "#FF0000" -- leave blank if you dont want pre defined color
function chatbox( message )
cancelEvent ( )
local account = getAccountName ( getPlayerAccount ( source ) )
if ( isAccountInGroup ( account, "Admin" ) ) then
tag = adminColor .. adminTag .. " "
elseif ( isAccountInGroup ( account, "SuperModerator" ) ) then
tag = sModColor .. sModTag .. " "
elseif ( isAccountInGroup ( account, "Moderator" ) ) then
tag = modColor .. modTag .. " "
else
tag = "" -- no tag
end
output ( tag, source, message )
end
addEventHandler("onPlayerChat", root, chatbox)
function output ( tag, player, text )
if ( getPlayerTeam ( player) ) then
r,g,b = getTeamColor ( getPlayerTeam ( player) )
else
r,g,b = getPlayerNametagColor ( player )
end
outputChatBox ( tag .. "" .. getPlayerName ( player ) .. ":#FFFFFF " .. text, root, r, g, b, true )
tag = string.gsub( tag, "#%x%x%x%x%x%x", "" )
outputServerLog ( tag .. "" .. getPlayerName ( player ) .. ": " .. text )
end
function isAccountInGroup ( _acc, _group )
if ( isObjectInACLGroup ( "user." .. _acc, aclGetGroup ( _group ) ) ) then
return
true
end
end