Help needed with this script please:-
function chatbox(text, msgtype)
local root = getRootElement()
local account = getAccountName(getPlayerAccount(source))
local name = getPlayerName(source)
local tag = getElementData(source, "ID")
if (msgtype == 0) then
if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then
cancelEvent(true)
outputChatBox(" #cccccc["..tag.."] #8B1A1A[HEADADMIN] .. name .. ":#FFFFFF " .. text, root, 255, 255, 255, true)
outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text)
elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then
cancelEvent(true)
outputChatBox("#cccccc["..tag.."] #FF0000[ADMIN] " .. name ..":#FFFFFF " .. text, root, 255, 255, 255, true)
outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text)
elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then
cancelEvent(true)
outputChatBox("#cccccc["..tag.."] #00FF00[MODERATOR] " .. name .. ":#FFFFFF " .. text, root, 255, 255, 255, true)
outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text)
elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then
cancelEvent(true)
outputChatBox("#cccccc["..tag.."] " .. name .. ": " .. text, root, 255, 255, 255, true)
outputServerLog("CHAT: " .. name .. ": " .. text)
end
elseif (msgtype == 2) then
end
end
addEventHandler("onPlayerChat", root, chatbox)
function RGBToHex(red, green, blue, alpha)
if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then
return nil
end
if(alpha) then
return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha)
else
return string.format("#%.2X%.2X%.2X", red,green,blue)
end
end
i want the name and text color to be the default but they become of the color of the ACL tag or if name has a color code then the txt becomes of name color
Like:-
if name is Player
the text becomes :-abcdefg
Or:-
if player is in admin group ([ADMIN])
and if name is Player
then the name and text color changes to [ADMIN] Player : abcdefg