Jump to content

[HELP]


Firespider

Recommended Posts

Why does the button not flash when the cursor is moved over it?
 
 
 
local Gun = createPed(312, 296.15252685547, -40.215438842773, 1001.515625)
setElementInterior(Gun, 1)
--------------------------------------
local sx,sy = guiGetScreenSize();--1920,1080
local relx,rely = sx/1920,sy/1080;

local isCardShop = true
color = tocolor(41, 173, 21, 255)

addEventHandler("onClientRender", root,
    function()
	   if (isCardShop) then 
          dxDrawRectangle(sx*.35, sy*.20, sx*.35, sy*.05, tocolor(110, 118, 125, 255))--Fejléc	
		    dxDrawText("Fegyver bolt", sx*.55, sy*.2, sx*.49, sy*.25, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
		  dxDrawRectangle(sx*.35, sy*.25, sx*.35, sy*.5, tocolor(0, 0, 0,  200))--Fejléc
            dxDrawText("Colt-45", sx*.40, sy*.31, sx*.35, sy*.25, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
			dxDrawText("50.000$", sx*.40, sy*.35, sx*.35, sy*.25, tocolor(69, 194, 58, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
		  dxDrawRectangle(sx*.41, sy*.25, sx*.10, sy*.06, color)--gomb
            dxDrawText("Megvétel", sx*.57, sy*.32, sx*.35, sy*.25, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat		  
		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
---------------------------------------------------
if isMouseInPosition(sx*.41, sy*.25, sx*.10, sy*.06) then
  color1 = tocolor(88, 0, 0, 50)
  else
    color1 = color

end
if isMouseInPosition(sx*0.55, sy*0.47, sx*0.06, sy*0.05) then
    color2 = tocolor(88, 0, 0, 50)
    else
      color2 = color
end
end

 

Link to comment

You need to change the "color" value
try this
 

local Gun = createPed(312, 296.15252685547, -40.215438842773, 1001.515625)
setElementInterior(Gun, 1)
--------------------------------------
local sx,sy = guiGetScreenSize();--1920,1080
local relx,rely = sx/1920,sy/1080;

local isCardShop = true
defaultcolor = tocolor(41, 173, 21, 255)
color = defaultcolor

addEventHandler("onClientRender", root,
    function()
	   if (isCardShop) then 
          dxDrawRectangle(sx*.35, sy*.20, sx*.35, sy*.05, tocolor(110, 118, 125, 255))--Fejléc	
		    dxDrawText("Fegyver bolt", sx*.55, sy*.2, sx*.49, sy*.25, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
		  dxDrawRectangle(sx*.35, sy*.25, sx*.35, sy*.5, tocolor(0, 0, 0,  200))--Fejléc
            dxDrawText("Colt-45", sx*.40, sy*.31, sx*.35, sy*.25, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
			dxDrawText("50.000$", sx*.40, sy*.35, sx*.35, sy*.25, tocolor(69, 194, 58, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
		  dxDrawRectangle(sx*.41, sy*.25, sx*.10, sy*.06, color)--gomb
            dxDrawText("Megvétel", sx*.57, sy*.32, sx*.35, sy*.25, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat		  
		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
---------------------------------------------------
if isMouseInPosition(sx*.41, sy*.25, sx*.10, sy*.06) then
  color = tocolor(88, 0, 0, 50)
  else
    color = defaultcolor

end
if isMouseInPosition(sx*0.55, sy*0.47, sx*0.06, sy*0.05) then
    color = tocolor(88, 0, 0, 50)
    else
      color = defaultcolor
end
end

 

Link to comment

i fixed your problem and i tested it is working

local Gun = createPed(312, 296.15252685547, -40.215438842773, 1001.515625)
setElementInterior(Gun, 1)
--------------------------------------
local sx,sy = guiGetScreenSize();--1920,1080
local relx,rely = sx/1920,sy/1080;

local isCardShop = true
color = tocolor(41, 173, 21, 255)
color1 = tocolor(41, 173, 21, 200)

addEventHandler("onClientRender", root,
    function()
    showCursor(true)
       if (isCardShop) then 
          dxDrawRectangle(sx*.35, sy*.20, sx*.35, sy*.05, tocolor(110, 118, 125, 255))--Fejléc    
            dxDrawText("Fegyver bolt", sx*.55, sy*.2, sx*.49, sy*.25, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
          dxDrawRectangle(sx*.35, sy*.25, sx*.35, sy*.5, tocolor(0, 0, 0,  200))--Fejléc
            dxDrawText("Colt-45", sx*.40, sy*.31, sx*.35, sy*.25, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
            dxDrawText("50.000$", sx*.40, sy*.35, sx*.35, sy*.25, tocolor(69, 194, 58, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
    if isMouseInPosition(sx*.41, sy*.25, sx*.10, sy*.06) then
        dxDrawRectangle(sx*.41, sy*.25, sx*.10, sy*.06, color)--gomb
        dxDrawText("Megvétel", sx*.57, sy*.32, sx*.35, sy*.25, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat    
    else
        dxDrawRectangle(sx*.41, sy*.25, sx*.10, sy*.06, color1)--gomb
        dxDrawText("Megvétel", sx*.57, sy*.32, sx*.35, sy*.25, tocolor(200, 200, 200, 200), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat          
    end
        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

 

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...