Orhan32 Posted December 30, 2020 Share Posted December 30, 2020 (edited) DX Button Create local nextOffset = centerX - 45 -- menü x pozisyonu for i, v in pairs(menu) do local textwidth = 150 -- yazının genişliği local textheight = 29 -- yazının yüksekliği local posX = nextOffset local posY = centerY + 315 -- menü y pozisyonu local endX = posX + textwidth local endY = posY + textheight table={bir=posX,iki=posY,uc=endX,dort=endY} dxDrawRectangle(posX-5, posY-3, 150, 29, (isCursorHover(posX-5, posY-3, endX, endY) and tocolor(0, 0, 0, 170) or tocolor(0, 0, 0, 200))) dxDrawText(v.name, posX, posY, endX, endY, (isCursorHover(posX, posY, endX, endY) and tocolor(255, 135, 0) or v.color), 1.5, 1.5, font, "center") nextOffset = nextOffset + textwidth end How to click dynamic DX items function buttonClick(button, state) for i, v in pairs(table) do if (v) then if not isCursorHover(v.bir, v.iki, v.uc, v.dort) then return false end if button == "left" and state == "down" then if v == 1 then outputChatBox("Login") end if table == 1 then outputChatBox("Register") end end end end end addEventHandler ("onClientClick", getRootElement(), buttonClick) function isCursorHover(posX, posY, sizeX, sizeY) if ( not isCursorShowing( ) ) then return false end local cX, cY = getCursorPosition() local screenWidth, screenHeight = guiGetScreenSize() local cX, cY = (cX*screenWidth), (cY*screenHeight) return ( (cX >= posX and cX <= posX+(sizeX - posX)) and (cY >= posY and cY <= posY+(sizeY - posY)) ) end Edited December 30, 2020 by Orhan32 Link to comment
Tekken Posted December 31, 2020 Share Posted December 31, 2020 Try using onClientKey as onClientClick it’s triggered when you click a world element if I recall correctly. 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