Hello, community!
Can you help me? What is the best method to send RGB/HEX colors in function?
function meChat(thePlayer, cmd, ...)
ProxDetector(30, thePlayer, ..., color1, color2, color3, color4, color5)
end
addCommandHandler("do", meChat)
function ProxDetector(radius, thePlayer, ..., color1)
local text = table.concat({...}," ")
local oldposx, oldposy, oldposz = getElementPosition(thePlayer)
for k, v in pairs(getElementsByType("player")) do
local posx, posy, posz = getElementPosition(v)
if getElementDimension(v) == getElementDimension(thePlayer) then
local getRadius = getDistanceBetweenPoints3D(oldposx, oldposy, oldposz, posx, posy, posz)
if (getRadius < radius / 16) then
outputChatBox(getPlayerName(thePlayer).." "..text, v, color1, false)
elseif (getRadius < radius / 8) then
outputChatBox(getPlayerName(thePlayer).." "..text, v, color2, false)
elseif(getRadius < radius / 4) then
outputChatBox(getPlayerName(thePlayer).." "..text, v, color3, false)
elseif(getRadius < radius / 2) then
outputChatBox(getPlayerName(thePlayer).." "..text, v, color4, false)
elseif(getRadius < radius) then
outputChatBox(getPlayerName(thePlayer).." "..text, v, color5, false)
end
end
end
return true
end
I tried something like COLOR_PURPLE = 0xC2A2DAAA and then convert in to RGB in outputchatBox function but it says that ")" expected near "," in function string.