Jump to content

onPlayerChat Teamchat w/h Color codes.


Recommended Posts

Hey, i just need help with one line LOL!

Please ignore everything else! All i need you to pay attention to is the element. I believe it will show to the team. When i do so it shows no color, and # colors are shown. Any ideas?

outputChatBox(RGBToHex(getTeamColor(getPlayerTeam(source))).."(TEAM) "..tagcolor.."["..tag.."]   #FFFFFF"..name..": "..textcolor..text, getTeamName(getPlayerTeam(source)), 255,255,255, true) 

Thanks in advance,

Chris

*EDIT* It was working with old one... Instead it was showing to all, so i added the team as an element. RBGToHex is all good. Just the element.

Link to comment
function idtag(text, msgtype) 
  local tag = getElementData(source, "ID") 
  local tagcolor = get('tagidcolor') 
  local textcolor = get('textcolor') 
  local name = getPlayerName(source) 
if (msgtype == 0) then 
cancelEvent() 
  if tag then 
    cancelEvent() 
    outputChatBox(tagcolor.."["..tag.."]   #FFFFFF"..name..": "..textcolor..text, getRootElement(), 255, 255, 255, true) 
    outputServerLog(name .. ": " .. text)     
  
end 
elseif (msgtype == 2) then 
cancelEvent() 
outputChatBox(RGBToHex(getTeamColor(getPlayerTeam(source))).."(TEAM) "..tagcolor.."["..tag.."]   #FFFFFF"..name..": "..textcolor..text, getTeamName(getPlayerTeam(source)), 255,255,255, true) 
outputServerLog("TEAM:  "..name .. ": " .. text)     
end 
end 
addEventHandler("onPlayerChat", root, idtag) 
  
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 

Omg kenix, ALL I NEED is outputChatBox(RGBToHex(getTeamColor(getPlayerTeam(source))).."(TEAM) "..tagcolor.."["..tag.."] #FFFFFF"..name..": "..textcolor..text, getTeamName(getPlayerTeam(source)), 255,255,255, true) to be visible by the current player TEAM!!!!!!! Im just recreating teamchat, by u making me show my progress i risk someone stealing it before i release the update. They will claim it as theirs...

Link to comment

Lol ok... Its basic, I can see it, but the ELEMENT is not working... No debug errors! Its all perfect i originally had

outputChatBox(RGBToHex(getTeamColor(getPlayerTeam(source))).."(TEAM) "..tagcolor.."["..tag.."]   #FFFFFF"..name..": "..textcolor..text, source, 255,255,255, true) 

That was for testing purposes! It all worked, but it was showing to all/theplayer... All else works but teamchat, it shows and no color !

So I tried to make it visible to the TEAM! SO LISTEN, EVERYTHING ELSE DOESNT MATTER FFS! ITS JUST THAT LINE!

Link to comment

try this:

  
local team = getPlayerTeam(source) 
local teamName = tostring(getTeamName(team)) 
  
local player = getElementsByType("player") 
for i = 1, #player do 
    local playerTeamName = tostring(getTeamName(getPlayerTeam(player[i]))) 
    if(playerTeamName == teamName)then 
           outputChatBox(RGBToHex(getTeamColor(team)).."(TEAM) "..tagcolor.."["..tag.."]   #FFFFFF"..name..": "..textcolor..text, player[i], 255,255,255, true) 
    end 
end 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...