Jump to content

How to create image button? [Solved]


undefined

Recommended Posts

local x,y = guiGetScreenSize() 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        sWindow = guiCreateWindow((x/2)-100, (y/2)-75, 200, 150, "Deneme", false) 
        guiWindowSetSizable(sWindow, false) 
        guiSetVisible(sWindow, false) 
        guiSetAlpha(sWindow, 0.65) 
  
        egg_deneme = guiCreateStaticImage(88, 55, 25, 35, "images/egg.png", false, sWindow) 
        close = guiCreateButton(30, 123, 139, 17, "Close", false, sWindow)     
    end 
) 
  
addEventHandler( "onClientMouseEnter", getRootElement(),  
    function() 
guiStaticImageLoadImage(egg_deneme, "images/egg_sel.png" ) 
guiSetAlpha(egg_deneme, 0.65) 
    end 
) 
  
addEventHandler( "onClientMouseLeave", getRootElement(),  
    function() 
guiStaticImageLoadImage(egg_deneme, "images/egg.png" ) 
guiSetAlpha(egg_deneme, 1.00) 
    end 
) 
  
function open() 
    if (guiGetVisible (sWindow) == true) then 
    guiSetVisible(sWindow, false) 
    showCursor(false) 
    elseif (guiGetVisible (sWindow) == false) then 
    guiSetVisible(sWindow, true) 
    showCursor(true) 
    end 
end 
bindKey ("L", "down", open) 
     
function close() 
        if source == close then 
        guiSetVisible ( sWindow,false ) 
        showCursor(false) 
        end 
    end 
addEventHandler("onClientGUIClick",root,close ) 

I've done it. The image is changing when I comes to the window but i want to changing when I comes to on the image. How to fix it?

Link to comment
local x,y = guiGetScreenSize() 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        sWindow = guiCreateWindow((x/2)-100, (y/2)-75, 200, 150, "Deneme", false) 
        guiWindowSetSizable(sWindow, false) 
        guiSetVisible(sWindow, false) 
        guiSetAlpha(sWindow, 0.65) 
  
        egg_deneme = guiCreateStaticImage(88, 55, 25, 35, "images/egg.png", false, sWindow) 
        close = guiCreateButton(30, 123, 139, 17, "Close", false, sWindow)     
    end 
) 
  
addEventHandler( "onClientMouseEnter", getRootElement(), 
    function() 
        if source == egg_deneme then 
            guiStaticImageLoadImage(egg_deneme, "images/egg_sel.png" ) 
            guiSetAlpha(egg_deneme, 0.65) 
        end 
    end 
) 
  
addEventHandler( "onClientMouseLeave", getRootElement(), 
    function() 
        if source == egg_deneme then 
            guiStaticImageLoadImage(egg_deneme, "images/egg.png" ) 
            guiSetAlpha(egg_deneme, 1.00) 
        end 
    end 
) 
  
function open() 
    if (guiGetVisible (sWindow) == true) then 
    guiSetVisible(sWindow, false) 
    showCursor(false) 
    elseif (guiGetVisible (sWindow) == false) then 
    guiSetVisible(sWindow, true) 
    showCursor(true) 
    end 
end 
bindKey ("L", "down", open) 
    
function close() 
        if source == close then 
        guiSetVisible ( sWindow,false ) 
        showCursor(false) 
        end 
    end 
addEventHandler("onClientGUIClick",root,close ) 

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