Rouzbeh Posted August 24, 2015 Share Posted August 24, 2015 hi, i want a code to get replace characters between "[ ]" from playername like: [clan]playername to playername delete "[x]" from playername Link to comment
Addlibs Posted August 24, 2015 Share Posted August 24, 2015 (edited) function getPlayerNameWithoutTags(player) local name = getPlayerName(player) return string.gsub(name, "\[.*\]", "") end Edit: I failed with escaping. Sorry. The slashes (\) should be percent symbols (%). Edited August 24, 2015 by Guest Link to comment
MTA Team botder Posted August 24, 2015 MTA Team Share Posted August 24, 2015 The pattern is wrong, here is the fix: function getPlayerNameWithoutTags(player) return getPlayerName(player):gsub("%[.*%]", "") end function getPlayerNameWithoutTags(player) local name = getPlayerName(player) return string.gsub(name, "\[.*\]", "") end 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