VenomOG Posted August 3, 2018 Share Posted August 3, 2018 Okey i know u cannot help me without any info or somecodes but just start me off then ill do the dx and the coding. Link to comment
xMKHx Posted August 3, 2018 Share Posted August 3, 2018 You can use dxDrawRectangle dxDrawText guiCreateButton guiSetVisible guiSetAlpha Link to comment
SycroX Posted August 3, 2018 Share Posted August 3, 2018 i prefer to use dxDrawRectangle dxDrawText addEventHandler "onClientClick" isMouseInPosition -- useful function in wiki.mtasa variables i've created a useful function for you to create a button (dxDrawButton) and i've made an example for you function isMouseInPosition ( x, y, width, height ) -- wiki.multitheftauto.com if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end function dxDrawButton(x, y, w, h, t, color1, color2) if tonumber(x..y..w..h) and t then if not color1 then color1 = tocolor(0, 0, 0, 255) end if not color2 then color2 = tocolor(255, 255, 255, 255) end if isMouseInPosition(x, y, w, h) then dxDrawRectangle(x, y, w, h, color1, false) dxDrawText(t, x, y, w+x, h+y, tocolor(255, 255, 255, 255), 1, "default-bold", "center", "center") else dxDrawRectangle(x, y, w, h, color2, false) dxDrawText(t, x, y, w+x, h+y, tocolor(255, 255, 255, 255), 1, "default-bold", "center", "center") end end end ---# addEventHandler("onClientRender", root, function() dxDrawButton(100, 100, 50, 50, "test") end ) addEventHandler("onClientClick", root, function(b,s) if b == "left" and s == "down" then if isMouseInPosition(100, 100, 50, 50) then outputChatBox("you've clicked on the dx-button") end end end ) Link to comment
VenomOG Posted August 4, 2018 Author Share Posted August 4, 2018 CLIENT local resolutionX = 1366 local resolutionY = 768 function guiCreateRelativeLabel( posX, posY, width, height,text,postGUI ) local resolutionX = 1366 local resolutionY = 768 local sWidth,sHeight = guiGetScreenSize( ) return guiCreateLabel( ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, tostring( text ), postGUI ) end function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing ( ) ) then return false end local sWidth,sHeight = guiGetScreenSize( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx* sWidth ), ( cy* sHeight ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end function dxDrawRelativeRectangle( posX, posY, width, height,color,postGUI ) local resolutionX = 1366 local resolutionY = 768 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawRectangle( ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, color, postGUI ) end local x,y = guiGetScreenSize() -- Get players resolution. local sWidth,sHeight = guiGetScreenSize( ) function dxPanel() dxDrawLine(376, 360, 558, 360, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(376, 425, 558, 425, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(376, 393, 558, 393, tocolor(255, 255, 255, 255), 1, false) dxDrawText("Say Hi", 411, 360, 578, 393, tocolor(0, 255, 0, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Give money", 401, 393, 568, 426, tocolor(255, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) end addEvent("dx", true) addEventHandler("dx", root, function (hi) if panelOpen then return end panelOpen = true dxDrawLine(376, 360, 558, 360, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(376, 425, 558, 425, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(376, 393, 558, 393, tocolor(255, 255, 255, 255), 1, false) dxDrawText("Say Hi", 411, 360, 578, 393, tocolor(0, 255, 0, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Give money", 401, 393, 568, 426, tocolor(255, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) addEventHandler ("onClientRender", root, dxPanel) end) if isMouseInPosition((411/resolutionX )*sWidth,(360/resolutionY )*sHeight, (578/resolutionX )*sWidth, (393/resolutionY )*sHeight) then dxDrawText("Say Hi", 411, 360, 578, 393, tocolor(0, 255, 0, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) end addEventHandler("onClientClick",root, function(bttn,state) if bttn == "left" and state == "down" then if GonnaFade then return false end local resolutionX = 1366 local resolutionY = 768 local sWidth,sHeight = guiGetScreenSize( ) if confirmWindow ~= true and isMouseInPosition((411/resolutionX )*sWidth,(360/resolutionY )*sHeight, (578/resolutionX )*sWidth, (393/resolutionY )*sHeight) then dxDrawRelativeRectangle(1070,490,180,40,tocolor(0,0,0,155),false) destroyElement(hi) outputChatBox("HI") else dxDrawText("Say Hi", 411, 360, 578, 393, tocolor(0, 255, 0, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Give money", 401, 393, 568, 426, tocolor(255, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) end end end) function test() dxDrawRelativeRectangle(1070,490,180,40,tocolor(0,0,0,155),false) end addEventHandler ("onClientRender", root, test) So i want if click "Message" it opens gui to msg someone 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