Jump to content

Team NametagColor


Recommended Posts

Posted

Hello guys, i tried to getPlayerNametagColor when player talk in team chat, but i get this error

WARNING: Test\server:5: Bad Argument @ 'getPlayerNametagColor'

Server:

local function onplayerChat(message, messageType) 
    if messageType == 2 then --Team (Clan) chat 
                cancelEvent() 
            local name = getPlayerName(source) 
                local red, green, blue = getPlayerNametagColor(name) 
        outputChatBox("#9AFE2E(CLAN)"..name..": #FFFFFF"..message, root, red, green, blue, true ) 
        outputServerLog("(TEAM): "..getPlayerName(source)..": "..message)--NOTE: Beacuse we cancelled the onPlayerChat event, we need to log chat manually. 
    end 
end 
addEventHandler("onPlayerChat", root, 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.

Posted

I did this first time, but it output no errors in debug and it don't output player nametag color in the clan chat, it output all the Text with green color..

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.

Posted

Oh yeah shit my bad, thanks anyway :)

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.

Posted

Now it's working, but i want to output a colored (CLAN) Text and after it the Player name tag color, any ideas?

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.

Posted
    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 
    local function onplayerChat(message, messageType) 
        if messageType == 2 then --Team (Clan) chat 
            cancelEvent() 
            local name = getPlayerName(source) 
            local red, green, blue = getPlayerNametagColor(name) 
            local hex = RGBToHex ( red, green, blue ) 
            outputChatBox("#9AFE2E(CLAN)" .. hex .. ..name.."#FFFFFF:"..message, root, 255, 255, 255, true ) 
            outputServerLog("(TEAM): "..getPlayerName(source)..": "..message)--NOTE: Beacuse we cancelled the onPlayerChat event, we need to log chat manually. 
        end 
    end 
    addEventHandler("onPlayerChat", root, onplayerChat) 

Posted

ERROR: Chat/basic_s.lua:2:attempt to compare boolean with number

   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 
    local function onplayerChat(message, messageType) 
        if messageType == 2 then --Team (Clan) chat 
            cancelEvent() 
            local name = getPlayerName(source) 
            local red, green, blue = getPlayerNametagColor(name) 
            local hex = RGBToHex ( red, green, blue ) 
            outputChatBox("#9AFE2E(CLAN)" .. hex .." "..name.."#FFFFFF:"..message, root, 255, 255, 255, true ) 
            outputServerLog("(TEAM): "..getPlayerName(source)..": "..message)--NOTE: Beacuse we cancelled the onPlayerChat event, we need to log chat manually. 
        end 
    end 
    addEventHandler("onPlayerChat", root, 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.

Posted
        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(name) 
                local hex = RGBToHex ( red, green, blue ) 
                outputChatBox("#9AFE2E(CLAN)" .. hex .. ..name.."#FFFFFF:"..message, root, 255, 255, 255, true ) 
                outputServerLog("(TEAM): "..getPlayerName(source)..": "..message)--NOTE: Beacuse we cancelled the onPlayerChat event, we need to log chat manually. 
            end 
        end 
        addEventHandler("onPlayerChat", root, onplayerChat) 

Posted

Bad argument @'getPlayerNametagColor' line 11

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.

Posted
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 ) 
         
        outputChatBox( "#9AFE2E(CLAN)" .. hex .. name .. "#FFFFFF:" .. message, root, 255, 255, 255, true ) 
        outputServerLog( "(TEAM): " .. name .. ": " .. message )--NOTE: Beacuse we cancelled the onPlayerChat event, we need to log chat manually. 
    end 
end 
addEventHandler ( "onPlayerChat", root, onplayerChat ) 

Posted (edited)

Thanks dude. (: /lock

Edited by Guest

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.

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...