Jump to content

Hide Color Codes in outputChatBox.


Karuzo

Recommended Posts

Hi Community,

i have a problem , i used Ruga's Advertisement Script .

But i dont wan't that color codes in the Advertisement , how to get rid of them ?

Script :

function Advertisment(thePlayer, commandName, ...) 
        local players = getElementsByType("player") 
        local playerName = getPlayerName ( thePlayer ) 
        local chatContent = {...} 
        for index, player in ipairs ( players ) do 
            outputChatBox( "[[AD FROM - " .. playerName.. "]] " ..table.concat ( chatContent, " "), player, 0, 255, 0) 
        end 
    end 
addCommandHandler( "ad", Advertisment ) 
  

Link to comment

By using gsub.

function Advertisment(thePlayer, commandName, ...) 
        local players = getElementsByType("player") 
        local playerName = getPlayerName ( thePlayer ) 
        local chatContent = {...} 
        for index, player in ipairs ( players ) do 
            outputChatBox( "[[AD FROM - " .. playerName:gsub("#%x%x%x%x%x%x","").. "]] " ..table.concat ( chatContent, " "), player, 0, 255, 0) 
        end 
    end 
addCommandHandler( "ad", Advertisment ) 
  

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