Jump to content

ID chat


Bazoookaaa

Recommended Posts

Hi is there a resource on community that when u chat it shows the ID BUT using the TEAM COLOR on the team you are? Because theres one but it shows the nick in white

I know theres a funcion GetTeamColor but i dont know how to use it!!!

Heres the code:

function idtag(text, msgtype) 
  local tag = getElementData(source, "ID") 
  local tagcolor = get('tagidcolor') 
  local textcolor = get('textcolor') 
  local name = getPlayerName(source) 
if (msgtype == 0) then 
cancelEvent() 
  if tag then 
    cancelEvent() 
    outputChatBox(tagcolor.."["..tag.."]   #FFFFFF"..name..": "..textcolor..text, getRootElement(), 255, 255, 255, true) 
    outputServerLog(name .. ": " .. text)     
  
end 
elseif (msgtype == 2) then 
cancelEvent() 
local team = getPlayerTeam(source) 
local teamName = tostring">tostring(getTeamName(team)) 
  
local player = getElementsByType("player") 
for i = 1, #player do 
    local playerTeamName = tostring">tostring(getTeamName(getPlayerTeam(player[i]))) 
    if(playerTeamName == teamName)then 
           outputChatBox(RGBToHex(getTeamColor(team)).."(TEAM) "..tagcolor.."["..tag.."]   #FFFFFF"..name..": "..textcolor..text, player[i], 255,255,255, true) 
    end 
end 
outputServerLog("TEAM:  "..name .. ": " .. text)     
end 
end 
addEventHandler("onPlayerChat", root, idtag) 
  
function RGBToHex(red, green, blue, alpha) 
    if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then 
        return nil 
    end 
    if(alpha) then 
        return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) 
    else 
        return string.format("#%.2X%.2X%.2X", red,green,blue) 
    end 
end 

And heres the meta (i think heres the problem but i dont know how to change it :(:(

    "[EGL]Chris" version="1.15" type">type="script" name="Basemode ID Tag" description="This adds the basemode ID tag before a players name." /> 
    

Link to comment
function idtag(text, msgtype) 
    local tag = getElementData ( source, "ID" ) or 0 
    local tagcolor = get ( 'tagidcolor' ) or "#FFFFFF" 
    local textcolor = get ( 'textcolor' ) or "#FFFFFF" 
    local name = getPlayerName ( source ) 
    local r, g, b = getPlayerNametagColor ( source ) 
    if ( msgtype == 0 ) then 
        cancelEvent() 
        if ( tag ) then 
            cancelEvent ( ) 
            outputChatBox ( tagcolor .."[".. tag .."]   #FFFFFF".. name ..": ".. textcolor .. text, root, 255, 255, 255, true) 
            outputServerLog ( name .. ": " .. text )     
        end 
    elseif ( msgtype == 2 ) then 
        cancelEvent ( ) 
        local team = getPlayerTeam ( source ) 
        if ( team ) then 
            for index, player in ipairs">ipairs ( getPlayersInTeam ( team ) ) do 
            outputChatBox ( RGBToHex ( getTeamColor( team ) ) .."(TEAM) ".. tagcolor .."[".. tag .."]   #FFFFFF".. name ..": ".. textcolor ..text, player, 255, 255, 255, true ) 
        end 
    end 
    outputServerLog ( "TEAM:  ".. name .. ": " .. text ) 
    end 
end 
addEventHandler("onPlayerChat", root, idtag) 
  
function RGBToHex(red, green, blue, alpha) 
    if ( ( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ) ) ) then 
        return nil 
    end 
    if ( alpha ) then 
        return string.format( "#%.2X%.2X%.2X%.2X", red, green, blue, alpha ) 
    else 
        return string.format( "#%.2X%.2X%.2X", red, green, blue ) 
    end 
end 

Link to comment
<meta> 
            <info author="[EGL]Chris" version="1.15" type="script" name="Basemode ID Tag" description="This adds the basemode ID tag before a players name." /> 
            <script src="IDTag.lua" type="server" /> 
             
                    <settings> 
                    <setting name="*tagidcolor" value="#FF0000" /> 
                    <setting name="*namecolor" value="#FFFFFF" /> 
                    <setting name="*textcolor" value="#FFFFFF" /> 
                    </settings> 
</meta> 
  

Link to comment
Sorry for not noticing this bug. I will go through my script after school and update it. If you want ill make a Admin and ID tag script. [12] [Admin] Chris. It could be [12] Chris for normal players. Ill have to share it.

Thanks if u have the time to do it ill like the script with admin and id tag :)

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...