[M]ister Posted December 13, 2013 Share Posted December 13, 2013 Hello again, I added in a gui a label with the name of the player without the color code, and when any player open the gui the label name is updated, (more is not working) ... local name = string.gsub(getPlayerName(localPlayer), "#%x%x%x%x%x%x", "") Label = guiCreateLabel(68, 83, 252, 15, "Your Name: ", false, window) function refreshStats() if guiGetVisible(window,true) then guiSetText(Label,"Your Name: "..name) end end addEventHandler("onClientRender", getRootElement(), refreshStats) ... Link to comment
Castillo Posted December 13, 2013 Share Posted December 13, 2013 Of course it won't update, that's because you put getPlayerName outside the refreshStats function, so it'll always use the name obtained when resource started. Link to comment
[M]ister Posted December 13, 2013 Author Share Posted December 13, 2013 this? It was the first thing I tried, and did not work, I will try again. Edit: LoL now picked up, I must have done something wrong before ... Label = guiCreateLabel(68, 83, 252, 15, "Your Name: ", false, window) function refreshStats() local name = string.gsub(getPlayerName(localPlayer), "#%x%x%x%x%x%x", "") if guiGetVisible(window,true) then guiSetText(Label,"Your Name: "..name) end end addEventHandler("onClientRender", getRootElement(), refreshStats) ... Link to comment
[M]ister Posted December 13, 2013 Author Share Posted December 13, 2013 Thanks again Solidsnake14. To enjoy the post, just want to ask another question: How could be showing the name of the player with the colors (hidden code) Link to comment
Castillo Posted December 13, 2013 Share Posted December 13, 2013 Labels don't support HEX color codes. Link to comment
DNL291 Posted December 13, 2013 Share Posted December 13, 2013 if guiGetVisible(window,true) then It's wrong. Should be: if (guiGetVisible(window) == true) then Link to comment
PaiN^ Posted December 14, 2013 Share Posted December 14, 2013 Since you're using onClientRender, You can make the name color-coded by drawing it with dxDrawText function . 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