1LoL1 Posted December 20, 2015 Share Posted December 20, 2015 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
Noki Posted December 20, 2015 Share Posted December 20, 2015 https://wiki.multitheftauto.com/wiki/OnPlayerChat messageType 0 is chat using 't' or /say messageType 2 is team chat using 'y' Link to comment
1LoL1 Posted December 20, 2015 Author Share Posted December 20, 2015 https://wiki.multitheftauto.com/wiki/OnPlayerChatmessageType 0 is chat using 't' or /say messageType 2 is team chat using 'y' What? i want only color team to name. If team color red so nick will red. If i don't have team all was white. Link to comment
Noki Posted December 20, 2015 Share Posted December 20, 2015 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
1LoL1 Posted December 20, 2015 Author Share Posted December 20, 2015 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now