ZeyadGTX Posted September 10, 2014 Share Posted September 10, 2014 Hello guys i have script made by Nikolai96 he helped me with this script , the script make you in team chat (TEAM) this word changes to (CLAN) but the problem i want this (CLAN) with Red color and the other doesn't change i forgot that script because my pc was formated and i forgot every thing help pls , the problem is the whole text is with green iwant only (CLAN) addEventHandler('onPlayerChat', getRootElement(), function(msg, type) if type == 2 then cancelEvent() local r, g, b = getPlayerNametagColor(source) for placeNumber, playerData in ipairs(getPlayersInTeam(getPlayerTeam(source))) do outputChatBox("#00FF00(CLAN)"..getPlayerName(source)..":#FFFFFF "..string.gsub(msg, "#%x%x%x%x%x%x", ""), playerData, r, g, b, true) end end end ) Link to comment
Moderators DNL291 Posted September 10, 2014 Moderators Share Posted September 10, 2014 Try this: addEventHandler('onPlayerChat', getRootElement(), function(msg, type) if type == 2 then cancelEvent() local playerTeam = getPlayerTeam(source) if playerTeam then local r, g, b = getTeamColor(playerTeam) local hexColor = string.format("#%.2X%.2X%.2X", r, g, b) else return end for placeNumber, playerData in ipairs(getPlayersInTeam(playerTeam)) do outputChatBox("#00FF00(CLAN)"..hexColor .. getPlayerName(source)..":#FFFFFF "..msg:gsub("#%x%x%x%x%x%x", ""), playerData, r, g, b, true) end end end ) Link to comment
ZeyadGTX Posted September 10, 2014 Author Share Posted September 10, 2014 Now i can't see the team chat Link to comment
-.Paradox.- Posted September 10, 2014 Share Posted September 10, 2014 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 local function onplayerChat ( message, messageType ) if ( messageType == 2 ) then --Team (Clan) chat cancelEvent ( ) local name = getPlayerName ( source ) local red, green, blue = getPlayerNametagColor ( source ) local hex = RGBToHex ( red, green, blue ) local team = getPlayerTeam( source ) if not team then return outputChatBox( "You are not part of a team yet !", source, 200, 100, 0) end local members = getPlayersInTeam( team ) or {} for _, player in ipairs(members) do outputChatBox( "#FF0000(CLAN)" .. hex.." "..name .. ": #FFFFFF" .. message, player, 255, 255, 255, true ) end outputServerLog( "(TEAM): " .. name .. ": " .. message ) end end addEventHandler ( "onPlayerChat", root, onplayerChat ) addCommandHandler("c", onplayerChat) Link to comment
ZeyadGTX Posted September 10, 2014 Author Share Posted September 10, 2014 Thanks Man you are Aweosme 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