Jump to content

doesn't add color


manve1

Recommended Posts

it doesn't add colors if i do #FF00FF or #FFFF00 ect .. i think you get the point

addEventHandler("onPlayerChat", root,  
function (txt) 
    txt = string.gsub(txt,"#[%x][%x][%x][%x][%x][%x]","") 
    local len = 0 
    if string.len(txt) > 48 then 
        return 
    end 
if string.find(txt, "hey chuck") then 
local text = string.gsub(txt,"hey chuck","") 
setTimer( function() 
outputChatBox("#FF00FF|NcO|#FFFF00Chuck: Hey!", source, 255, 255, 0, true)  
end, 100, 1 ) 
end 
end 
) 

Link to comment
addEventHandler ( "onPlayerChat", root, 
    function ( txt ) 
        local txt = txt:gsub ( "#[%x][%x][%x][%x][%x][%x]", "" ) 
        local len = 0 
        if ( txt:len ( ) > 48 ) then 
            return 
        end 
  
        if ( txt:find ( "hey chuck" ) ) then 
            local text = txt:gsub ( "hey chuck", "" ) 
            setTimer ( 
                outputChatBox, 
                100, 
                1, 
                "#FF00FF|NcO|#FFFF00Chuck: Hey!", 
                source, 
                255, 
                255, 
                0, 
                true 
            ) 
        end 
    end 
) 

Should work.

The problem was that you created another function for the timer, instead of using just 'outputChatBox', so 'source' was not defined.

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