Hugos Posted June 6, 2019 Share Posted June 6, 2019 Help me, how to use functions "outputPressedCharacter" and this script: Button = guiCreateStaticImage(250, 250, 250, 30, "gfx/Button.png", false) addEventHandler("onClientGUIClick", Button, FButton, false) function FButton(button) if button == "left" then end end show text that the user types after clicking the button (text, not a single character)? Link to comment
salh Posted June 6, 2019 Share Posted June 6, 2019 (edited) please clarify use this: -- gui Button = guiCreateStaticImage(250, 250, 250, 30, "gfx/Button.png", false) function outputPressedCharacter(character) if character==" " then --if the character is a space character = "space" --change 'character' to 'space' end setTimer ( function() guiSetText(salh, "") end, 100, 1 ) salh = guiCreateLabel(453, 0, 476, 78, character, false) end addEventHandler("onClientGUIClick", root, function () if source == Button then addEventHandler("onClientCharacter", getRootElement(), outputPressedCharacter) end end) Edited June 6, 2019 by salh Link to comment
Hugos Posted June 6, 2019 Author Share Posted June 6, 2019 43 minutes ago, salh said: please clarify use this: -- gui Button = guiCreateStaticImage(250, 250, 250, 30, "gfx/Button.png", false) function outputPressedCharacter(character) if character==" " then --if the character is a space character = "space" --change 'character' to 'space' end setTimer ( function() guiSetText(salh, "") end, 100, 1 ) salh = guiCreateLabel(453, 0, 476, 78, character, false) end addEventHandler("onClientGUIClick", root, function () if source == Button then addEventHandler("onClientCharacter", getRootElement(), outputPressedCharacter) end end) not work Link to comment
salh Posted June 6, 2019 Share Posted June 6, 2019 you want if player click the button show the text or the character? this work with me Link to comment
Hugos Posted June 6, 2019 Author Share Posted June 6, 2019 Just now, salh said: вы хотите, если игрок нажмите кнопку показать текст илисимвол? эта работа со мной text Link to comment
Hugos Posted June 6, 2019 Author Share Posted June 6, 2019 2 hours ago, salh said: ok this show the text ? Link to comment
salh Posted June 6, 2019 Share Posted June 6, 2019 -- gui Button = guiCreateStaticImage(250, 250, 250, 30, "gfx/Button.png", false) function outputPressedCharacter(character) if character==" " then --if the character is a space character = "space" --change 'character' to 'space' end setTimer ( function() guiSetText(salh, "") end, 100, 1 ) salh = guiCreateLabel(453, 0, 476, 78, character, false) end addEventHandler("onClientGUIClick", root, function () if source == Button then addEventHandler("onClientCharacter", getRootElement(), outputPressedCharacter) end end) thsi code make the text show this* Link to comment
Hugos Posted June 6, 2019 Author Share Posted June 6, 2019 1 hour ago, salh said: -- gui Button = guiCreateStaticImage(250, 250, 250, 30, "gfx/Button.png", false) function outputPressedCharacter(character) if character==" " then --if the character is a space character = "space" --change 'character' to 'space' end setTimer( function() guiSetText(salh, "") end, 100, 1 ) salh = guiCreateLabel(453, 0, 476, 78, character, false) end addEventHandler("onClientGUIClick", root, function () if source == Button then addEventHandler("onClientCharacter", getRootElement(), outputPressedCharacter) end end) thsi code make the text show this* this script does not work. (Show black display) 1 hour ago, salh said: -- gui Button = guiCreateStaticImage(250, 250, 250, 30, "gfx/Button.png", false) function outputPressedCharacter(character) if character==" " then --if the character is a space character = "space" --change 'character' to 'space' end setTimer ( function() guiSetText(salh, "") end, 100, 1 ) salh = guiCreateLabel(453, 0, 476, 78, character, false) end addEventHandler("onClientGUIClick", root, function () if source == Button then addEventHandler("onClientCharacter", getRootElement(), outputPressedCharacter) end end) thsi code make the text show this* Understood. Find errors. Necessary: local salh = guiCreateLabel(453, 0, 476, 78, character, false) instead "salh = guiCreateLabel(453, 0, 476, 78, character, false)" and must be before "guiSetText(salh, "")" Link to comment
Hugos Posted June 6, 2019 Author Share Posted June 6, 2019 (edited) + The text is displayed not in a string, but in a single character on top of another Edited June 6, 2019 by Hugos Link to comment
salh Posted June 6, 2019 Share Posted June 6, 2019 why you make this local salh = guiCreateLabel(453, 0, 476, 78, character, false) -- this is gui you can use local ut not Necessary Link to comment
Hugos Posted June 6, 2019 Author Share Posted June 6, 2019 (edited) 12 minutes ago, salh said: why you make this local salh = guiCreateLabel(453, 0, 476, 78, character, false) -- this is gui you can use local ut not Necessary The text is displayed not in a string, but in a single character on top of another. What to do? Edited June 6, 2019 by Hugos Link to comment
Hugos Posted June 7, 2019 Author Share Posted June 7, 2019 (edited) up Edited June 7, 2019 by Hugos 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