FlyingSpoon Posted June 23, 2015 Share Posted June 23, 2015 Well, I want to type 5 numbers, maximum integer 5 and basically the person is meant to type but I cant get it to type, so far when the person presses the certain button it only appears that number. Can someone help me? e.g. 'Person presses 1, 4, 2, 1' It will appear in the GUI Edit Link to comment
Animan99 Posted June 23, 2015 Share Posted June 23, 2015 add a number to the table like this: local numberTable = {} addEventHandler("onClientGUIClick", Button1, function() if #numberTable < 6 then table.insert(numberTable, 1) end end) i dont know why are you using edit box, just simply write out with a label. You can write out like this: addEventHandler("onClientRender", root, function() dxDrawText(table.concat(numberTable), --rest of dxText) end) Or you can use guilabel or set the text of the edit box without onClientRender. Link to comment
FlyingSpoon Posted June 23, 2015 Author Share Posted June 23, 2015 Dont understand what you're trying to do. Link to comment
Animan99 Posted June 23, 2015 Share Posted June 23, 2015 ok, then what is your problem? i showed you how to add number in table and write out the table numbers. Link to comment
Walid Posted June 23, 2015 Share Posted June 23, 2015 Dont understand what you're trying to do. Explain your problem better , if you are talking about the maximum text length that can be typed into an edit box use guiEditSetMaxLength() Link to comment
FlyingSpoon Posted June 23, 2015 Author Share Posted June 23, 2015 I am trying to type numbers so for example, If I press the button 1 and 2 and 3 and 4 It will say in the GUI Edit Box 1234 -- I am trying to make a realistic vending machine Link to comment
Blaawee Posted June 23, 2015 Share Posted June 23, 2015 Hmmm.. Why don't you get the text and set the text with the old one plus the new one?? local oldText = guiGetText( gui-edit ); local newText = guiSetText( gui-edit, oldText .. "1" ); Link to comment
Animan99 Posted June 25, 2015 Share Posted June 25, 2015 i said it right then... local table = {} addEventHandler("onClientGUIClick", button1, function() if #table <= 5 then table.insert(table, 5) end end) wirte the value... dxDrawText(table.concat(table)) -- write it like this: table.concat(tablename) you can do this with edit box, just set the text of the edit box like this guiSetText(edit, table.concat(table)) 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