BorderLine Posted September 27, 2011 Share Posted September 27, 2011 Hi comunity. Well im a new user in forum. and i decide register because i learn much reading the forum's post. In special solidnake and JR10 you helpme so much Well i have a problem, i dont know if this is good or not. I want remove hex code from pm chat window function removeHEXFromString(str) return str:gsub("#%x%x%x%x%x%x", "") end i dont know if i need put some "IF" or other fuction I maked much changes, but i cant doit and sorry for my english.. i hope you can understan what i need here i have a img Thanks Link to comment
qaisjp Posted September 27, 2011 Share Posted September 27, 2011 getPlayerName:gsub("#%x%x%x%x%x%x", "") when looping players Link to comment
BorderLine Posted September 27, 2011 Author Share Posted September 27, 2011 getPlayerName:gsub("#%x%x%x%x%x%x", "") when looping players ill test it Link to comment
TwiX! Posted September 27, 2011 Share Posted September 27, 2011 maybe.. -- remove color coding from string function removeColorCoding (name) return type(name)=="string" and string.gsub(name, "#%x%x%x%x%x%x", "") or name end -- getPlayerName with color coding removed local _getPlayerName = getPlayerName function getPlayerName(player) if type(player) == "string" then return removeColorCoding(player) end return removeColorCoding (_getPlayerName(player)) end Link to comment
BorderLine Posted September 27, 2011 Author Share Posted September 27, 2011 maybe.. -- remove color coding from string function removeColorCoding (name) return type(name)=="string" and string.gsub(name, "#%x%x%x%x%x%x", "") or name end -- getPlayerName with color coding removed local _getPlayerName = getPlayerName function getPlayerName(player) if type(player) == "string" then return removeColorCoding(player) end return removeColorCoding (_getPlayerName(player)) end aaaaaah you are the best man now is fix thanks alot..!!!! if some mod read this can be closed this post all are okey Link to comment
RaceXtreme Posted September 27, 2011 Share Posted September 27, 2011 Just didnt understood a thing... return type(name)=="string" and string.gsub(name, "#%x%x%x%x%x%x", "") or name -- what is this? is like "if" structure? how this works in lua scripting? ... local _getPlayerName = getPlayerName -- this is a hook of getPlayerName? how this works? its to dosent call the costum function below? function getPlayerName(player) -- we can make a function with a native MTA one? Thanks in advance Link to comment
Castillo Posted September 27, 2011 Share Posted September 27, 2011 RaceXtreme, what Qwert did is replace the original getPlayerName with his own, so, yeah, it's possible. Link to comment
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