Rouzbeh Posted August 24, 2015 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
Addlibs Posted August 24, 2015 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 Previously known as MrTasty.
MTA Team botder Posted August 24, 2015 MTA Team 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 GitHub: Debug Console • MTA-Discord Relay Scripting: How to draw a line chart with DirectX functions? • Doppler Effect in MTA • Get the client's FPS • Customizable Blur Shader
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