MineX server Posted November 17, 2021 Share Posted November 17, 2021 Please help me how to create a dx panel with close button and other buttons, and how to make a hud with dx Link to comment
Moderators Vinyard Posted November 17, 2021 Moderators Share Posted November 17, 2021 Hi, welcome to the forums! I've moved your thread to a better section so you can get the answers you're looking for. Link to comment
The_GTA Posted November 17, 2021 Share Posted November 17, 2021 Hello MineX server, creating a custom UI layout system along with all the required layout math can be frustrating for beginners. By asking this question I am assuming that you have no prior experience with custom UI systems in general. For that reason I recommend you to use the DGS resource. It was created by renowned members ( @xLive and @thisdp) of the MTA community and is based on the dx family of drawing functions. How about you give it a try? 1 Link to comment
MineX server Posted November 17, 2021 Author Share Posted November 17, 2021 ok thx, but i cant do it with Dx, just asking Link to comment
The_GTA Posted November 17, 2021 Share Posted November 17, 2021 9 minutes ago, MineX server said: ok thx, but i cant do it with Dx, just asking I am going to assume that you have basic Lua skills. Take a look at the following leads: dxDrawRectangle - Multi Theft Auto: Wiki UI layout basics text drawing details Edit box details custom scrollpane 1 Link to comment
MineX server Posted November 18, 2021 Author Share Posted November 18, 2021 Ok thanks, now i create a custom window that shows when you press ( i ) : function openwin() dxDrawRectangle(510, 217, 368, 349, tocolor(3, 0, 0, 179), false) dxDrawRectangle(523, 518, 68, 38, tocolor(201, 12, 12, 254), false) dxDrawText("Close", 521, 525, 591, 552, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawRectangle(601, 518, 68, 38, tocolor(40, 36, 36, 180), false) dxDrawText("Use", 599, 525, 669, 552, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawRectangle(524, 326, 128, 75, tocolor(201, 12, 12, 254), false) dxDrawText("Bottle", 527, 345, 642, 387, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) end setElementData(localPlayer, "open", false) function show() if getElementData(localPlayer, "open") == true then removeEventHandler("onClientRender", getRootElement(), openwin) setElementData(localPlayer, "open", false) showCursor(false) return elseif getElementData(localPlayer, "open") == false then addEventHandler("onClientRender", root, openwin) showCursor(true) setElementData(localPlayer, "open", true) end end bindKey("i", "down", show) Now i need how to create a button Link to comment
MineX server Posted November 18, 2021 Author Share Posted November 18, 2021 if you can give me a simple script for it Link to comment
The_GTA Posted November 18, 2021 Share Posted November 18, 2021 (edited) 3 minutes ago, MineX server said: if you can give me a simple script for it But what you are trying to do is not a simple task! Try to read the post I mentioned and research onClientClick event handlers. addEventHandler("onClientClick", root, function(button, state, screen_x, screen_y) outputChatBox("bla"); end ); Edited November 18, 2021 by The_GTA Link to comment
MineX server Posted November 18, 2021 Author Share Posted November 18, 2021 In normal gui i can do like this: GUIEditor = { button = {}, window = {} } function GUI() GUIEditor.window[1] = guiCreateWindow(599, 297, 163, 121, "Talk Menu", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) guiSetInputEnabled(false) GUIEditor.button[1] = guiCreateButton(9, 25, 144, 43, "Say Hi!", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(9, 72, 144, 39, "Close", false, GUIEditor.window[1]) end addEventHandler("onClientResourceStart", resourceRoot, GUI) setElementData(localPlayer, "show", false) function show() if getElementData(localPlayer, "show") == false then guiSetVisible(GUIEditor.window[1], true) guiSetInputEnabled(true) setElementData(localPlayer, "show", true) return elseif getElementData(localPlayer, "show") == true then guiSetVisible(GUIEditor.window[1], false) guiSetInputEnabled(false) setElementData(localPlayer, "show", false) end end bindKey("h", "down", show) function click() if source == GUIEditor.button[1] then outputChatBox("Hi!") guiSetVisible(GUIEditor.window[1], false) guiSetInputEnabled(false) elseif source == GUIEditor.button[2] then guiSetVisible(GUIEditor.window[1], false) guiSetInputEnabled(false) end end addEventHandler("onClientGUIClick", root, click) How i can do like the click function ,choose the button and add a event (on clicked will do command) But on Dx panel, i can understand if you give me a full script Link to comment
The_GTA Posted November 18, 2021 Share Posted November 18, 2021 DX drawing does not result in elements. Instead of drawing things manually I whole-heartedly recommend you to use DGS instead. You have not entirely read my mentioned posts. I am not supporting this topic anymore. Link to comment
MineX server Posted November 18, 2021 Author Share Posted November 18, 2021 Ok thanks Link to comment
MineX server Posted November 18, 2021 Author Share Posted November 18, 2021 but how others can make a designed panels, like inventory or login panels he use other programming langues ? 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