Jump to content

onPlayerChat


1LoL1

Recommended Posts

Hello, i created chat but if i'am not in team i can't say :(

Can anyone help me?

addEventHandler('onPlayerChat', getRootElement(), 
    function(msg, type) 
        if type == 0 then 
            cancelEvent() 
            local name = getPlayerName(source) 
            local team = getPlayerTeam(source) 
            local r, g, b = getTeamColor(team) 
            local hex = string.format("#%.2X%.2X%.2X", r, g, b) 
            if (hex) == "255, 255, 255" then 
            outputChatBox(""..hex..name.. ": #FFFFFF"..msg, getRootElement(), r, g, b, true) 
            else 
            outputChatBox(""..hex..name.. ": #FFFFFF"..msg, getRootElement(), r, g, b, true) 
        end 
    end 
end 
) 

Link to comment

I don't really understand what you're trying to say. But if you want a player's name to be the same colour as his team on chat, just get rid of that hex nonsense at lines 8 and 9. Then for the outputs, just use outputChatBox(name..": #FFFFFF"..msg, root, r, g, b, true). I believe team chat doesn't work if you're not in a team, so if you want it to be white when a player isn't in a team then you'll need to make your own custom team chat.

Line 3 should be:

if type == 2 then 

Link to comment
I don't really understand what you're trying to say. But if you want a player's name to be the same colour as his team on chat, just get rid of that hex nonsense at lines 8 and 9. Then for the outputs, just use outputChatBox(name..": #FFFFFF"..msg, root, r, g, b, true). I believe team chat doesn't work if you're not in a team, so if you want it to be white when a player isn't in a team then you'll need to make your own custom team chat.

Line 3 should be:

if type == 2 then 

Ok thanks for info.

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...