Jump to content

Trigger New Event


3B00DG4MER

Recommended Posts

Hi Guys,

Today i making a new script dx GUI for my server BLAH Blah blah .....

what i want is

How to trigger Event onClientRender and check if Left Mouse is Down without onClientClick Event cuz it will gives lagg on Event "OnClientRender"

local sW, sH = guiGetScreenSize() 
function dxDrawButton(x, y, w, h, text, color, borderColor,font) 
local font = font or "pricedown" 
        dxDrawRectangle(x ,y ,w ,h, color) 
        dxDrawRectangle(x, y, w, 1, borderColor) 
      dxDrawRectangle(x, y, 1, h, borderColor) 
      dxDrawRectangle(x, y + h, w, 1, borderColor) 
      dxDrawRectangle(x + w, y , 1, h, borderColor) 
      if text then 
      dxDrawText ( text, x, y, x + w, y + h, tocolor(31,31,31), 1, font, "center", "center") 
      end 
        if isMouseWithinRangeOf(x, y, w, h) then 
        dxDrawRectangle(x ,y,w,h,tocolor(0,255,255)) 
                              -- I think here i put the  event but i've to check first if Mouse Stat (if left Mouse is down)  
           if text then 
           dxDrawText ( text, x, y , x + w, y + h, tocolor(255,255,255), 1, font, "center", "center") 
           end 
        end 
  
end 
  
function isMouseWithinRangeOf(posX, posY, sizeX, sizeY) 
  if isCursorShowing() == false then 
    return false 
  end 
  local cx,cy = getCursorPosition() 
  cx,cy = cx*sW,cy*sH 
  if cx >= posX and cx <= posX+sizeX and cy >= posY and cy <= posY+sizeY then 
    return true,cx,cy 
  else 
    return false 
  end 
end 
  

:?

Edited by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...