XanaXxx666 Posted February 27, 2022 Share Posted February 27, 2022 Estou precisando de ajuda para fazer com que meu painel DX abra toda vez que eu passe por cima de uma marker no chão! meu codigo estará a baixo! ajudem eu ai na moral <3 Painel.lua local screenW, screenH = guiGetScreenSize() local exibindo_painel = false function PainelDX () dxDrawLine((screenW * 0.3635) - 1, (screenH * 0.3426) - 1, (screenW * 0.3635) - 1, screenH * 0.6528, tocolor(21, 151, 0, 242), 1, false) dxDrawLine(screenW * 0.6448, (screenH * 0.3426) - 1, (screenW * 0.3635) - 1, (screenH * 0.3426) - 1, tocolor(21, 151, 0, 242), 1, false) dxDrawLine((screenW * 0.3635) - 1, screenH * 0.6528, screenW * 0.6448, screenH * 0.6528, tocolor(21, 151, 0, 242), 1, false) dxDrawLine(screenW * 0.6448, screenH * 0.6528, screenW * 0.6448, (screenH * 0.3426) - 1, tocolor(21, 151, 0, 242), 1, false) dxDrawRectangle(screenW * 0.3635, screenH * 0.3426, screenW * 0.2812, screenH * 0.3102, tocolor(152, 152, 152, 253), false) dxDrawText("", 902, 437, 902, 437, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawImage(842, 548, 0, 0, ":dx/trabalhar.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(837, 483, 5, 0, ":dx/trabalhar.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(954, 1076, 18, 0, ":dx/trabalhar.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(822, 532, 0, 0, ":dx/trabalhar.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawLine((screenW * 0.3818) - 1, (screenH * 0.5593) - 1, (screenW * 0.3818) - 1, screenH * 0.6120, tocolor(12, 237, 33, 166), 1, false) dxDrawLine(screenW * 0.4896, (screenH * 0.5593) - 1, (screenW * 0.3818) - 1, (screenH * 0.5593) - 1, tocolor(12, 237, 33, 166), 1, false) dxDrawLine((screenW * 0.3818) - 1, screenH * 0.6120, screenW * 0.4896, screenH * 0.6120, tocolor(12, 237, 33, 166), 1, false) dxDrawLine(screenW * 0.4896, screenH * 0.6120, screenW * 0.4896, (screenH * 0.5593) - 1, tocolor(12, 237, 33, 166), 1, false) dxDrawRectangle(screenW * 0.3818, screenH * 0.5593, screenW * 0.1078, screenH * 0.0528, tocolor(0, 0, 0, 166), false) dxDrawLine((screenW * 0.5214) - 1, (screenH * 0.5593) - 1, (screenW * 0.5214) - 1, screenH * 0.6120, tocolor(12, 237, 33, 166), 1, false) dxDrawLine(screenW * 0.6292, (screenH * 0.5593) - 1, (screenW * 0.5214) - 1, (screenH * 0.5593) - 1, tocolor(12, 237, 33, 166), 1, false) dxDrawLine((screenW * 0.5214) - 1, screenH * 0.6120, screenW * 0.6292, screenH * 0.6120, tocolor(12, 237, 33, 166), 1, false) dxDrawLine(screenW * 0.6292, screenH * 0.6120, screenW * 0.6292, (screenH * 0.5593) - 1, tocolor(12, 237, 33, 166), 1, false) dxDrawRectangle(screenW * 0.5214, screenH * 0.5593, screenW * 0.1078, screenH * 0.0528, tocolor(0, 0, 0, 166), false) dxDrawText("Trabalhar", screenW * 0.3906, screenH * 0.5769, screenW * 0.4802, screenH * 0.5972, tocolor(255, 255, 255, 220), 1.00, "arial", "center", "center", false, false, false, false, false) dxDrawText("Sair do trabalho", screenW * 0.5344, screenH * 0.5769, screenW * 0.6240, screenH * 0.5972, tocolor(255, 255, 255, 220), 1.00, "arial", "center", "center", false, false, false, false, false) end addCommandHandler("trabalhar", function() if exibindo_painel == false then addEventHandler("onClientRender", getRootElement(), PainelDX) exibindo_painel = true showCursor(true) else removeEventHandler("onClientRender", getRootElement(), PainelDX) exibindo_painel = false showCursor(false) end end) function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) ) end -- Modified version for DX Text function isCursorOverText(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 addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if exibindo_painel == true then if isMouseInPosition(screenW * 0.3818, screenH * 0.5593, screenW * 0.1078, screenH * 0.0528) then givePlayerMoney(20000) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if exibindo_painel == true then if isMouseInPosition(screenW * 0.5214, screenH * 0.5593, screenW * 0.1078, screenH * 0.0528) then setElementModel(localPlayer, 0) end end end end) PainelServer.lua local marker = createMarker(-2400.1970214844,-586.59515380859,132.6484375 -1, "cylinder", 2,0,255,0, 60) addEventHandler("onMarkerHit", marker, function(hit) if getElementType(hit) == "player" then triggerClientEvent(hit, "Exibir", hit) end end) Link to comment
Moderators Vinyard Posted February 27, 2022 Moderators Share Posted February 27, 2022 Hi, welcome to the forums! I've moved your thread to the Portuguese section so you can get better assistance in your native language. It would truly help with readability if you could format your code inside this thread to Lua by following these steps (also found here) Quote Use code snippet tags. Always add your code (if applicable) in this uniform way. Click the ''< >'' shortcut in the text editor, as seen in below screenshot: Then put your code within the box that said button (< >) creates. Be sure to select Lua for highlighting from the drop-down list in bottom right corner for automatic syntax colouring, wiki links for built-in functions and events and other cool features. 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