Jump to content

[HELP] string.gsub


1LoL1

Recommended Posts

Hello, normally when i have hex in name and get mute i see playername with hex how i can use string.gsub in this? admin nick see normally without hex but name not :( please can anyone help me?

function aAction ( type, action, admin, player, data, more ) 
    if ( aLogMessages[type] ) then 
        function aStripString ( string ) 
            --local adminNick = string.gsub(getPlayerName ( admin ), "#%x%x%x%x%x%x","") 
            --local playerNick = string.gsub(getPlayerName ( player ), "#%x%x%x%x%x%x","") 
            local adminNick = getPlayerName(admin):gsub("#%x%x%x%x%x%x","") 
            --local playerNick = getPlayerName(player):gsub("#%x%x%x%x%x%x","") 
            string = tostring ( string ) 
            string = string.gsub ( string, "$admin", adminNick ) 
            string = string.gsub ( string, "$by_admin_4all", isAnonAdmin4All( admin )    and "" or "" .. adminNick ) 
            string = string.gsub ( string, "$by_admin_4plr", isAnonAdmin4Victim( admin ) and "" or "" .. adminNick ) 
            string = string.gsub ( string, "$data2", more or "" ) 
            if ( player ) then string = string.gsub ( string, "$player", getPlayerName(player) )  end 
            return tostring ( string.gsub ( string, "$data", data or "" ) ) 
        end 
        local node = aLogMessages[type][action] 
        if ( node ) then 
            local r, g, b = node["r"], node["g"], node["b"] 
            if ( node["all"] ) then outputChatBox ( aStripString ( node["all"] ), _root, r, g, b, true ) end 
            if ( node["admin"] ) and ( admin ~= player ) then outputChatBox ( aStripString ( node["admin"] ), admin, r, g, b, true ) end 
            if ( node["player"] ) then outputChatBox ( aStripString ( node["player"] ), player, r, g, b, true ) end 
            if ( node["log"] ) then outputServerLog ( aStripString ( node["log"] ) ) end 
        end 
    end 
end 

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