MamadHastam Posted December 20, 2022 Posted December 20, 2022 hello im a new scripter and i want some help so i want made a panel with image that i have and add an action when i click on image [ example : spawncar ] i want change this : local entradaB = createMarker(1086.4340820313,-1803.6898193359,14.602746963501, "cylinder", 1, 255, 255, 255, 0) local myBlip = createBlip( 1085.6364746094,-1800.0280761719,13.626179695129, 44, 0, 0, 0, 255, myPlayer ) addEventHandler( "onClientRender", root, function() local x, y, z = getElementPosition( entradaB ) local Mx, My, Mz = getCameraMatrix( ) if ( getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz ) <= 15 ) then local WorldPositionX, WorldPositionY = getScreenFromWorldPosition( x, y, z +1, 0.07 ) if ( WorldPositionX and WorldPositionY ) then dxDrawText("", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(0, 0, 0, 255), 2.52, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(255, 255, 255, 255), 2.50, "default-bold", "center", "center", false, false, false, false, false) end end end ) --------------------------------------------- function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end wndArenda = guiCreateWindow(0,0,500,150,"",false) centerWindow(wndArenda) guiSetVisible(wndArenda,false) label1 = guiCreateLabel(0,30,490,480, "", false, wndArenda) guiSetFont(label1, "default-bold-small") guiLabelSetHorizontalAlign(label1, "center", false) local btn1 = guiCreateButton(20,100,200,35,"",false,wndArenda) local btn2 = guiCreateButton(280,100,200,35,"",false,wndArenda) addEventHandler('onClientGUIClick',wndArenda,function() if source == btn1 then triggerServerEvent("onPlayerUseCustomPickup", localPlayer) guiSetVisible(wndArenda,false) showCursor(false) elseif source == btn2 then guiSetVisible(wndArenda,false) showCursor(false) end end) function changeArendaMenuState() guiSetVisible(wndArenda,true) showCursor(true) end addEvent("changeArendaMenuState", true) addEventHandler("changeArendaMenuState", getRootElement(), changeArendaMenuState) to this : local screenW,screenH = guiGetScreenSize() local px,py = 1920,1080 local xx,yy = (screenW/px), (screenH/py) local sum1 = 10000 local sum2 = 15000 local sum3 = 20000 local draw = false function gruz() dxDrawImage(xx*550, yy*260, xx*825, yy*500, "images/fon.png") if isCursorOverRectangle(xx*594, yy*396, xx*235, yy*300) then color = 180 else color = 255 end dxDrawImage(xx*594, yy*396, xx*235, yy*300, "images/1.png", 0, 0, 0, tocolor(255, 255, 255, color), false) if isCursorOverRectangle(xx*840, yy*396, xx*235, yy*300) then color = 180 else color = 255 end dxDrawImage(xx*840, yy*396, xx*235, yy*300, "images/2.png", 0, 0, 0, tocolor(255, 255, 255, color), false) if isCursorOverRectangle(xx*1092, yy*396, xx*235, yy*300) then color = 180 else color = 255 end dxDrawImage(xx*1092, yy*396, xx*235, yy*300, "images/3.png", 0, 0, 0, tocolor(255, 255, 255, color), false) if isCursorOverRectangle(xx*1330, yy*275, xx*36, yy*36) then color = 180 else color = 255 end dxDrawImage(xx*1330, yy*275, xx*36, yy*36, "images/exit.png", 0, 0, 0, tocolor(255, 255, 255, color), false) dxDrawText("", xx*900, yy*280, xx*1035, yy*300, tocolor(255, 255, 255, 255), xx*1.5, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("", xx*900, yy*350, xx*1080, yy*345, tocolor(255, 255, 255, 255), xx*1.2, "sans", "left", "top", false, false, false, false, false) dxDrawText("", xx*675, yy*415, xx*870, yy*435, tocolor(255, 255, 255, 150), xx*1.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("", xx*920, yy*415, xx*870, yy*435, tocolor(255, 255, 255, 150), xx*1.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("", xx*1175, yy*415, xx*870, yy*435, tocolor(255, 255, 255, 150), xx*1.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("", xx*620, yy*455, xx*750, yy*475, tocolor(255, 255, 255, 255), xx*1.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("", xx*868, yy*455, xx*750, yy*475, tocolor(255, 255, 255, 255), xx*1.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("", xx*1120, yy*455, xx*750, yy*475, tocolor(255, 255, 255, 255), xx*1.00, "sans", "left", "top", false, false, false, false, false) dxDrawText(""..sum1, xx*620, yy*480, xx*770, yy*500, tocolor(255, 255, 255, 255), xx*1.00, "sans", "left", "top", false, false, false, false, false) dxDrawText(""..sum2, xx*868, yy*480, xx*770, yy*500, tocolor(255, 255, 255, 255), xx*1.00, "sans", "left", "top", false, false, false, false, false) dxDrawText(""..sum3, xx*1120, yy*480, xx*770, yy*500, tocolor(255, 255, 255, 255), xx*1.00, "sans", "left", "top", false, false, false, false, false) end not exacly this but i want to turn theme from guiCreateButton to dxdraw
AngelAlpha Posted December 20, 2022 Posted December 20, 2022 addEventHandler ("onClientClick", root, function(btn, state) if btn ~= "left" or state ~= "down" then return end if isMouseInPosition (xx*594, yy*396, xx*235, yy*300) then -- click 1-st button elseif isMouseInPosition (xx*840, yy*396, xx*235, yy*300) then -- click 2-nd button 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 isMouseInPosition wiki function
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