Hugos Posted June 6, 2019 Share Posted June 6, 2019 (edited) You must set a variable with this function: The user enters the characters on the keyboard and they are shown with one line on the screen. How can this be done? (A variable is a string of text) Edited June 6, 2019 by Hugos Link to comment
DNL291 Posted June 6, 2019 Share Posted June 6, 2019 onClientCharacter Example: local text = "" addEventHandler( "onClientCharacter", root, function ( character ) text = text .. character end ) 1 Link to comment
Hugos Posted June 7, 2019 Author Share Posted June 7, 2019 (edited) 10 hours ago, DNL291 said: onClientCharacter Example: local text = "" addEventHandler( "onClientCharacter", root, function ( character ) text = text .. character end ) Thank! Edited June 7, 2019 by Hugos Link to comment
Hugos Posted June 7, 2019 Author Share Posted June 7, 2019 11 hours ago, DNL291 said: onClientCharacter Example: local text = "" addEventHandler( "onClientCharacter", root, function ( character ) text = text .. character end ) Is it possible to delete the last character when clicking on "backspace"? Link to comment
salh Posted June 7, 2019 Share Posted June 7, 2019 yes its possible you can make new function for this Link to comment
Hugos Posted June 7, 2019 Author Share Posted June 7, 2019 1 minute ago, salh said: yes its possible you can make new function for this What function? Link to comment
Hugos Posted June 7, 2019 Author Share Posted June 7, 2019 19 minutes ago, salh said: "new function" ? Link to comment
Hugos Posted June 7, 2019 Author Share Posted June 7, 2019 20 hours ago, DNL291 said: onClientCharacter Example: local text = "" addEventHandler( "onClientCharacter", root, function ( character ) text = text .. character end ) can the resulting text be output to "DxDrawText"? If so, then how to do it? (Can be example on opportunities? ) Link to comment
salh Posted June 7, 2019 Share Posted June 7, 2019 local text = "" addEventHandler( "onClientCharacter", root, function ( character ) text = text .. character end ) addEventHandler("onClientRender", root, function() dxDrawText(text, 398, 71, 817, 192, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) end ) Link to comment
DNL291 Posted June 8, 2019 Share Posted June 8, 2019 18 hours ago, Hugos said: Is it possible to delete the last character when clicking on "backspace"? local text = "" addEventHandler( "onClientCharacter", root, function ( character ) if character == "backspace" then text = text:sub( 1, -2 ) else text = text .. character end end ) Link to comment
Hugos Posted June 8, 2019 Author Share Posted June 8, 2019 (edited) 8 hours ago, salh said: local text = "" addEventHandler( "onClientCharacter", root, function ( character ) text = text .. character end ) addEventHandler("onClientRender", root, function() dxDrawText(text, 398, 71, 817, 192, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) end ) Thank! Edited June 8, 2019 by Hugos Link to comment
Hugos Posted June 8, 2019 Author Share Posted June 8, 2019 34 minutes ago, DNL291 said: local text = "" addEventHandler( "onClientCharacter", root, function ( character ) if character == "backspace" then text = text:sub( 1, -2 ) else text = text .. character end end ) I don't know why, but "backspace" doesn't work. (For example, if you change the character to y, q, d, f or s - works) Link to comment
salh Posted June 8, 2019 Share Posted June 8, 2019 becose the onClientCharacter hes job get the key not make action for hem if you want backspace you need make new function for new action Link to comment
Hugos Posted June 8, 2019 Author Share Posted June 8, 2019 Just now, salh said: becose the onClientCharacter hes job get the key not make action for hem if you want backspace you need make new function for new action ? Link to comment
salh Posted June 8, 2019 Share Posted June 8, 2019 use this: id = guiCreateEdit(414, 226, 353, 90, "", false) guiSetAlpha(id, 0.00) addEventHandler("onClientRender", root, function() dxDrawRectangle(412, 223, 365, 98, tocolor(7, 39, 0, 121), false) dxDrawText(guiGetText(id), 411, 224, 777, 316, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) end ) Link to comment
Hugos Posted June 8, 2019 Author Share Posted June 8, 2019 40 minutes ago, salh said: use this: id = guiCreateEdit(414, 226, 353, 90, "", false) guiSetAlpha(id, 0.00) addEventHandler("onClientRender", root, function() dxDrawRectangle(412, 223, 365, 98, tocolor(7, 39, 0, 121), false) dxDrawText(guiGetText(id), 411, 224, 777, 316, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) end ) It not suitable) Link to comment
DNL291 Posted June 8, 2019 Share Posted June 8, 2019 12 hours ago, Hugos said: I don't know why, but "backspace" doesn't work. (For example, if you change the character to y, q, d, f or s - works) "backspace" only works for the "onClientKey" event, my bad. In this case, add this event for the "backspace" key and it should work. 1 Link to comment
Hugos Posted June 8, 2019 Author Share Posted June 8, 2019 33 minutes ago, DNL291 said: "backspace" only works for the "onClientKey" event, my bad. In this case, add this event for the "backspace" key and it should work. Thank! 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