Abdulelah Posted June 11, 2018 Posted June 11, 2018 hi , dear i want code for see all chat team use in resources for see all chat team
Storm-Hanma Posted June 11, 2018 Posted June 11, 2018 You mean a team panel were you can see team members ?
Abdulelah Posted June 11, 2018 Author Posted June 11, 2018 local mySerial = "SerialAdmin" addEventHandler("onPlayerChat", root, function ( message, messageType ) if ( messageType == 2 ) then for i,v in ipairs ( getElementsByType( "player" ) ) do if ( getPlayerSerial ( v ) == mySerial ) then local TeamName = getTeamName ( getPlayerTeam(source) ) local r, g, b = getTeamColor ( getPlayerTeam(source) ) outputChatBox("("..TeamName..") "..getPlayerName(source)..":#FFFFFF "..message.."",v,r,g,b) end end end end ) color of messege don't show white why? this show #fffff with message
Saml1er Posted June 11, 2018 Posted June 11, 2018 (edited) Color codes do not get translated because you have not enabled them. In order to enable color codes, you need to pass another argument (bool), which is true. bool outputChatBox ( string text [, element visibleTo = getRootElement(), int r = 231, int g = 217, int b = 176, bool colorCoded = false ] ) Take a look at the bool colorCoded, that's what's missing from your code, so we simply do this: outputChatBox("("..TeamName..") "..getPlayerName(source)..":#FFFFFF "..message.."",v,r,g,b, true) -- notice true here? that was missing from your code replace the outputChatBox line of code with this one, you should be able to see color coded text. Edited June 11, 2018 by Saml1er
Abdulelah Posted June 12, 2018 Author Posted June 12, 2018 local mySerial = "24269FEB647A6735C0752A9C13211E52" addEventHandler("onPlayerChat", root, function ( message, messageType ) if ( messageType == 2 ) then for i,v in ipairs ( getElementsByType( "player" ) ) do if ( getPlayerSerial ( v ) == mySerial ) then local TeamName = getTeamName ( getPlayerTeam(source) ) local r, g, b = getTeamColor ( getPlayerTeam(source) ) outputChatBox("("..TeamName..") "..getPlayerName(source)..":#FFFFFF "..message.."",v,r,g,b,true) end end end end ) code true , but color message like color team lol
Saml1er Posted June 12, 2018 Posted June 12, 2018 14 minutes ago, Abdulelah said: code true , but color message like color team lol can you please rephrase what you said? Also, when you output the message, if you don't want to do something else with the player then break the loop, like this: if ( getPlayerSerial ( v ) == mySerial ) then local TeamName = getTeamName ( getPlayerTeam(source) ) local r, g, b = getTeamColor ( getPlayerTeam(source) ) outputChatBox("("..TeamName..") "..getPlayerName(source)..":#FFFFFF "..message.."",v,r,g,b,true) break -- this will break the loop end
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