Jump to content

Help me Please !! Too urgent.


Poete

Recommended Posts

I want to make this gui, I tried for like 30 minutes and it never worked out :/ I can't get to any solution so please help me

I want to make it inside of the gui once u place the mouse on a picture, another picture will show up

I tried this but it didn't work...

local g_Window = nil 
local clBt = {} 
local blurry = 'images/1.png' 
local normal = 'images/2.png' 
addCommandHandler("window", 
function () 
    if g_Window then return end 
  
    g_Window = {} 
 for i,v in ipairs(clBt) do 
            if isElement(v) then 
                destroyElement(v) 
            end 
        end 
    local screenWidth, screenHeight = guiGetScreenSize() 
    faWidth, faHeight = 477,419 
    local left = screenWidth/2 - faWidth/2 
    local top = screenHeight/2 - faHeight/2 
  
    fa = guiCreateGridList(left, top, faWidth, faHeight, false) 
guiSetAlpha(fa, 0.62) 
    g_Window.closeBtn = guiCreateStaticImage(436, 0, 41, 32, ":admin/client/images/error.png", false, fa) 
    clBt = guiCreateStaticImage(117, 96, 292, 267, normal, false, fa)  
    guiSetEnabled(fa, false) 
    guiSetVisible(fa, false) 
    g_Window.startTime = getTickCount() 
    g_Window.startSize = {0, 0} 
    g_Window.endSize = {faWidth, faHeight} 
    g_Window.endTime = g_Window.startTime + 1000 
    addEventHandler("onClientRender", getRootElement(), popWindowUp) 
end) 
     
 addEventHandler("onClientMouseEnter",root, 
    function() 
        for i,v in ipairs(clBt) do 
            if source == v then 
                if not getElementData(v, "sign") then 
                    guiStaticImageLoadImage(v, blurry) 
                end 
            end 
        end 
    end 
) 
  
addEventHandler("onClientMouseLeave",root, 
    function() 
        for i,v in ipairs(clBt) do 
            if source == v then 
                if not getElementData(v, "sign") then 
                    guiStaticImageLoadImage(v, normal) 
                end 
            end 
        end 
    end 
) 
  
function on_closeBtn_clicked(button, state, absoluteX, absoluteY) 
    if (button ~= "left") or (state ~= "up") then 
        return 
    end 
  
    if not g_Window then return end 
  
    showCursor(false) 
    guiSetEnabled(fa, false) 
  
    local screenWidth, screenHeight = guiGetScreenSize() 
    local posX, posY = guiGetPosition(fa, false) 
  
    g_Window.startTime = getTickCount() 
    g_Window.startSize = {faWidth, faHeight} 
    g_Window.startCenter =  
    { 
        posX + faWidth/2, 
        posY + faHeight/2, 
    } 
  
    g_Window.endSize = {0, 0} 
    g_Window.endTime = g_Window.startTime + 1000 
    g_Window.endCenter =  
    { 
        screenWidth,  
        screenHeight 
    } 
  
    addEventHandler("onClientRender", getRootElement(), popWindowDown) 
end 
  
function popWindowUp() 
    local now = getTickCount() 
    local elapsedTime = now - g_Window.startTime 
    local duration = g_Window.endTime - g_Window.startTime 
    local progress = elapsedTime / duration 
  
    local width, height, _ = interpolateBetween (  
        g_Window.startSize[1], g_Window.startSize[2], 0,  
        g_Window.endSize[1], g_Window.endSize[2], 0,  
        progress, "OutElastic") 
  
    guiSetSize(fa, width, height, false) 
  
    local screenWidth, screenHeight = guiGetScreenSize() 
    guiSetPosition(fa, screenWidth/2 - width/2, screenHeight/2 - height/2, false) 
  
    if not guiGetVisible(fa) then 
        guiSetVisible(fa, true) 
        guiBringToFront(fa) 
    end 
  
    if now >= g_Window.endTime then 
        guiSetEnabled(fa, true) 
  
        guiBringToFront(fa) 
        removeEventHandler("onClientRender", getRootElement(), popWindowUp) 
        addEventHandler("onClientGUIClick", g_Window.closeBtn, on_closeBtn_clicked, false)           
        showCursor(true) 
    end 
end 

I want to make it once u put the mouse on image1, image2 will show at its same position, please help me it's urgent and thanks in advance.

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