ZeyadGTX Posted September 10, 2014 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 ) My nick in MTA is Spider
DNL291 Posted September 10, 2014 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 ) Please do not PM me with scripting related question nor support, use the forums instead.
ZeyadGTX Posted September 10, 2014 Author Posted September 10, 2014 Now i can't see the team chat My nick in MTA is Spider
-.Paradox.- Posted September 10, 2014 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) If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
ZeyadGTX Posted September 10, 2014 Author Posted September 10, 2014 Thanks Man you are Aweosme My nick in MTA is Spider
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