kukimuki Posted July 17, 2023 Share Posted July 17, 2023 I really need some help!! I made a button and if i press it it doesnt do anything, but i want to do that to if i press it it creates a tank front of me local sx, sy = guiGetScreenSize(); local show= false; function render() -- // alap "kocka" \\ -- dxDrawRectangle(sx*0.38, sy*0.30, sx*0.26, sy*0.5, tocolor(0,0,0,180), false); -- // keret \\ -- dxDrawRectangle(sx*0.38, sy*0.30, sx*0.002, sy*0.5, tocolor(255,0,0,210), false); dxDrawRectangle(sx*0.64, sy*0.30, sx*0.002, sy*0.5, tocolor(255,0,0,210), false); dxDrawRectangle(sx*0.38, sy*0.30, sx*0.26, sy*0.002, tocolor(255,0,0,210), false); dxDrawRectangle(sx*0.38, sy*0.80, sx*0.26, sy*0.002, tocolor(255,0,0,210), false); -- // premium panel irat es doboza \\ -- dxDrawRectangle(sx*0.38, sy*0.30, sx*0.26, sy*0.06, tocolor(0,0,0,150), false); dxDrawText("Prémium Panel", sx*0.38, sy*0.35, sx*0.63, sy*0.36, tocolor(255,255,255), 2, "pricedown", "right", "bottom", false, false, false, false); -- // jármű lehívó \\ -- -- tank -- dxDrawRectangle(sx*0.39, sy*0.38, sx*0.11, sy*0.070, tocolor(180, 102, 88, 178), false); dxDrawImage(sx*0.42, sy*0.40, sx*0.05, sy*0.050, "img/Rhino.png") dxDrawText("Tank", sx*0.62, sy*0.68, sx*0.46, sy*0.41, tocolor(255,255,255), 2, "clear", "right", "bottom", false, false, false, false); -- hydra -- dxDrawRectangle(sx*0.52, sy*0.38, sx*0.11, sy*0.070, tocolor(180, 102, 88, 178), false); -- // fegyverek \\ -- dxDrawText("Exlúzív fegyverek", sx*0.35, sy*0.35, sx*0.59, sy*0.49, tocolor(255,255,255), 2, "clear", "right", "bottom", false, false, false, false); end addEventHandler("onClientRender",root,render); addEventHandler("onClientKey", root, function(button, state) if show then if button == "mouse1" and state then if ) addEventHandler("onClientClick", root, function(button, state) end ); addEventHandler("onClientKey",root,function(button,state) if show then if button == "mouse1" and state then end end end); function toggleCursor() showCursor(not isCursorShowing()); end bindKey("m", "down", toggleCursor); Link to comment
klue Posted July 19, 2023 Share Posted July 19, 2023 (edited) local sx, sy = guiGetScreenSize(); local show = false; render = function () -- // alap "kocka" \\ -- dxDrawRectangle(sx*0.38, sy*0.30, sx*0.26, sy*0.5, tocolor(0,0,0,180), false); -- // keret \\ -- dxDrawRectangle(sx*0.38, sy*0.30, sx*0.002, sy*0.5, tocolor(255,0,0,210), false); dxDrawRectangle(sx*0.64, sy*0.30, sx*0.002, sy*0.5, tocolor(255,0,0,210), false); dxDrawRectangle(sx*0.38, sy*0.30, sx*0.26, sy*0.002, tocolor(255,0,0,210), false); dxDrawRectangle(sx*0.38, sy*0.80, sx*0.26, sy*0.002, tocolor(255,0,0,210), false); -- // premium panel irat es doboza \\ -- dxDrawRectangle(sx*0.38, sy*0.30, sx*0.26, sy*0.06, tocolor(0,0,0,150), false); dxDrawText("Prémium Panel", sx*0.38, sy*0.35, sx*0.63, sy*0.36, tocolor(255,255,255), 2, "pricedown", "right", "bottom", false, false, false, false); -- // jármű lehívó \\ -- -- tank -- dxDrawRectangle(sx*0.39, sy*0.38, sx*0.11, sy*0.070, tocolor(180, 102, 88, 178), false); dxDrawImage(sx*0.42, sy*0.40, sx*0.05, sy*0.050, "img/Rhino.png") dxDrawText("Tank", sx*0.62, sy*0.68, sx*0.46, sy*0.41, tocolor(255,255,255), 2, "clear", "right", "bottom", false, false, false, false); -- hydra -- dxDrawRectangle(sx*0.52, sy*0.38, sx*0.11, sy*0.070, tocolor(180, 102, 88, 178), false); -- // fegyverek \\ -- dxDrawText("Exlúzív fegyverek", sx*0.35, sy*0.35, sx*0.59, sy*0.49, tocolor(255,255,255), 2, "clear", "right", "bottom", false, false, false, false); end addEventHandler("onClientRender",root, render); addEventHandler("onClientClick", root, function (button, state) if state then if button == "left" then if isCursorHover(sx*0.39, sy*0.38, sx*0.11, sy*0.070) then -- Ide jön a tank lehívás, amit már megkéne tudnod magadtól csinálni. -- Lényeg: szerver oldalon csinálod, triggerServerEvent (nézz utána wikin) -- ahol van createVehicle (lekéred a játékos pozícióját, és adsz az x kordinátához + 5-t. triggerServerEvent("event neve", localPlayer) end end end end); isCursorHover = function (x, y, w, h) if x and y and w and h then if isCursorShowing() then if not isMTAWindowActive() then local cursorX, cursorY = getCursorPosition() cursorX, cursorY = cursorX * sx, cursorY * sy; if cursorX >= x and cursorX <= x + w and cursorY >= y and cursorY <= y + h then return true; end end end end return false; end bindKey("m", "down", function () showCursor(not isCursorShowing()); end); Edited July 19, 2023 by klue Link to comment
kukimuki Posted August 2, 2023 Author Share Posted August 2, 2023 Köszönöm szépen a segítséget! 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