KL[0]DER Posted May 19, 2020 Share Posted May 19, 2020 Hello guys , I have this script and there is a problem I couldn't understand When I write in the team chat the team tag doesn't show Can anyone help please .. function RGBToHex(red, green, blue) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255)) then return nil end return string.format("#%.2X%.2X%.2X", red, green, blue) end function onplayerChat ( message, messageType ) local red, green, blue = getPlayerNametagColor ( source ) local hex = RGBToHex ( red, green, blue ) local team = getPlayerTeam( source ) local members = getPlayersInTeam( team ) or {} if ( isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(source)),aclGetGroup('Console')) ) then cancelEvent() outputChatBox('#FF0000* #A8A8A8[ Console ] '..hex..' '..getPlayerName(source)..'#FF6100: '..message..'',root,255,255,255,true) elseif ( messageType == 2 ) then cancelEvent ( ) for _, player in ipairs(members) do outputChatBox('#FF0000* ( Team )#A8A8A8 [ Console ]'..hex..' '..getPlayerName ( source )..'#FF6100: '..message..'',root,255,255,255,true) end outputServerLog( "(TEAM): " .. getPlayerName ( source ) .. " : " .. message ) end end addEventHandler ( "onPlayerChat", root, onplayerChat ) addCommandHandler("c", onplayerChat) Link to comment
-Ilker. Posted May 19, 2020 Share Posted May 19, 2020 (edited) function RGBToHex(red, green, blue) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255)) then return nil end return string.format("#%.2X%.2X%.2X", red, green, blue) end addEventHandler ( "onPlayerChat" , root , function ( Msg , Type ) if ( Type == 0 ) then Hex = RGBToHex ( unpack({ getPlayerNametagColor ( source ) }) ) ; if ( isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Console") ) ) then outputChatBox('#FF0000* #A8A8A8[ Console ] '..Hex..' '..getPlayerName(source)..'#FF6100: '..Msg..'',root,255,255,255,true) cancelEvent() end elseif ( Type == 2 ) then if ( not getPlayerTeam ( source ) ) then return end cancelEvent() for k,v in ipairs ( getPlayersInTeam ( getPlayerTeam ( source ) ) ) do outputChatBox('#FF0000* ( Team )#A8A8A8 [ Console ]'..Hex..' '..getPlayerName ( source )..'#FF6100: '..Msg..'',root,255,255,255,true) end outputServerLog( "(TEAM): " .. getPlayerName ( source ) .. " : " .. Msg ) end end ) ; Edited May 19, 2020 by -Ilker. Link to comment
KL[0]DER Posted May 19, 2020 Author Share Posted May 19, 2020 4 hours ago, -Ilker. said: function RGBToHex(red, green, blue) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255)) then return nil end return string.format("#%.2X%.2X%.2X", red, green, blue) end addEventHandler ( "onPlayerChat" , root , function ( Msg , Type ) if ( Type == 0 ) then Hex = RGBToHex ( unpack({ getPlayerNametagColor ( source ) }) ) ; if ( isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Console") ) ) then outputChatBox('#FF0000* #A8A8A8[ Console ] '..Hex..' '..getPlayerName(source)..'#FF6100: '..Msg..'',root,255,255,255,true) cancelEvent() end elseif ( Type == 2 ) then if ( not getPlayerTeam ( source ) ) then return end cancelEvent() for k,v in ipairs ( getPlayersInTeam ( getPlayerTeam ( source ) ) ) do outputChatBox('#FF0000* ( Team )#A8A8A8 [ Console ]'..Hex..' '..getPlayerName ( source )..'#FF6100: '..Msg..'',root,255,255,255,true) end outputServerLog( "(TEAM): " .. getPlayerName ( source ) .. " : " .. Msg ) end end ) ; Thank you , you're the best Link to comment
-Ilker. Posted May 19, 2020 Share Posted May 19, 2020 You're welcome You're welcome 1 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