Jump to content

MTA GUI Buttons


Recommended Posts

Posted

xfsMlKt.png

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

Posted

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.

Posted
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() 

Posted

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

Posted

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" ); 

Posted

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)) 
  

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...