Jump to content

rectangle as button


fsdfdsf

Recommended Posts

Posted

how can i make rectangle press ( button)?

my code, i want my rectangles to press?

local x,y = guiGetScreenSize() 
  
function panel() 
  
  
showChat( false ) 
showCursor( true ) 
  
dxDrawRectangle ( x/4, y/3.8, x/4, y/2, tocolor ( 255, 0, 0, 100 ) ) 
  
  
dxDrawRectangle ( x/1.92, y/3.8, x/4, y/2, tocolor ( 0, 255, 0, 100 ) ) 
  
end 
addEventHandler ( "onClientRender", getRootElement(), panel) 
  

  • Moderators
Posted

For you as beginner,

I would recommend you to create a gui button and make it invisible on top of your rectangles.

https://wiki.multitheftauto.com/wiki/GuiCreateButton

https://wiki.multitheftauto.com/wiki/GuiSetVisible

When you are getting better at lua, you can start learning new and cleaner techniques.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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