MIKI785 Posted November 28, 2011 Posted November 28, 2011 Hello, How to remove HEX codes in nick from chatbox messages sent by Admin resource? I couldn't find the function which send all the messages in the code. I mean, like: "Someone has been muted by #FF0000miki_cz (x secs)" and i want it to be: "Someone has been muted by miki_cz (x secs)"
Spanish4Life Posted November 28, 2011 Posted November 28, 2011 Hello,How to remove HEX codes in nick from chatbox messages sent by Admin resource? I couldn't find the function which send all the messages in the code. I mean, like: "Someone has been muted by #FF0000miki_cz (x secs)" and i want it to be: "Someone has been muted by miki_cz (x secs)" admin/conf/messages.xml example: <group action="ban" r="255" g="0" b="0"> change to <group action="ban" r="0" g="0" b="0">
Castillo Posted November 28, 2011 Posted November 28, 2011 Spanish4Life, that'll change the R, G, B color, it'll not remove the HEX colors. In admin_server.lua there's a function called: aAction Replace it with this one: function aAction ( type, action, admin, player, data, more ) if ( aLogMessages[type] ) then function aStripString ( string ) string = tostring ( string ) string = string.gsub ( string, "$admin", getPlayerName ( admin ):gsub("#%x%x%x%x%x%x","") ) string = string.gsub ( string, "$by_admin_4all", isAnonAdmin4All( admin ) and "" or " by " .. getPlayerName ( admin ):gsub("#%x%x%x%x%x%x","") ) string = string.gsub ( string, "$by_admin_4plr", isAnonAdmin4Victim( admin ) and "" or " by " .. getPlayerName ( admin ):gsub("#%x%x%x%x%x%x","") ) string = string.gsub ( string, "$data2", more or "" ) if ( player ) then string = string.gsub ( string, "$player", getPlayerName ( player ):gsub("#%x%x%x%x%x%x","") ) 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 ) end if ( node["admin"] ) and ( admin ~= player ) then outputChatBox ( aStripString ( node["admin"] ), admin, r, g, b ) end if ( node["player"] ) then outputChatBox ( aStripString ( node["player"] ), player, r, g, b ) end if ( node["log"] ) then outputServerLog ( aStripString ( node["log"] ) ) end end end end
MIKI785 Posted December 1, 2011 Author Posted December 1, 2011 Solidsnake14, that works, but sometimes it doesn't output player's nick but just $Player EG. $player has been muted by admin... Where's the problem now? Admin's nick works every time.
MIKI785 Posted December 3, 2011 Author Posted December 3, 2011 Solidsnake14, that works, but sometimes it doesn't output player's nick but just $PlayerEG. $player has been muted by admin... Where's the problem now? Admin's nick works every time. It doesn't output nick when it doesn't have HEX codes in it.
Castillo Posted December 3, 2011 Posted December 3, 2011 function aAction ( type, action, admin, player, data, more ) if ( aLogMessages[type] ) then function aStripString ( string ) string = tostring ( string ) string = string.gsub ( string, "$admin", getPlayerName ( admin ):gsub("#%x%x%x%x%x%x","") ) string = string.gsub ( string, "$by_admin_4all", isAnonAdmin4All( admin ) and "" or " by " .. getPlayerName ( admin ):gsub("#%x%x%x%x%x%x","") ) string = string.gsub ( string, "$by_admin_4plr", isAnonAdmin4Victim( admin ) and "" or " by " .. getPlayerName ( admin ):gsub("#%x%x%x%x%x%x","") ) string = string.gsub ( string, "$data2", more or "" ) if ( player ) then string = string.gsub ( string, "$player", getPlayerName ( player ) ) string = string:gsub("#%x%x%x%x%x%x","") 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 ) end if ( node["admin"] ) and ( admin ~= player ) then outputChatBox ( aStripString ( node["admin"] ), admin, r, g, b ) end if ( node["player"] ) then outputChatBox ( aStripString ( node["player"] ), player, r, g, b ) end if ( node["log"] ) then outputServerLog ( aStripString ( node["log"] ) ) end end end end Fixed.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now