Jump to content

[REL] Downloading Screen


Gaimo

Recommended Posts

spacer.png

Code: 

Spoiler

local c = {}

c.sW, c.sH = guiGetScreenSize()
c.vol = 0.35 -- 35% do volume da musica
c.soundActive = true

function downloadingScreen()    

    dxDrawImage(0,0, c.sW, c.sH, "files/background.png") -- Draw background

    if c.soundActive then -- Se a musica esta ativa
        dxDrawImage(25, 20, 17, 34, "files/pause.png")
    else
        dxDrawImage(20, 20, 38, 39, "files/play.png")
    end

end

function playPause(button, state, x, y, worldX, worldY, worldZ, clickedElement)
    if button == "left" and state == "down" then
        
        if x >= 20 and x <= 60 and y >= 20 and y <= 60 then
            if c.soundActive then
                c.soundActive = false
                setSoundPaused(c.song, true)
            else
                c.soundActive = true
                setSoundPaused(c.song, false)
            end
        end
    end
end


function downloadComplete()
    if not isTransferBoxActive() then
        stopSound(c.song)
        showChat(true)
        showCursor(false)
        c = nil
        removeEventHandler("onClientRender", root, downloadingScreen)
        removeEventHandler("onClientRender", root, playPause)
    else
        setTimer(downloadComplete, 2000, 1)
    end
end

-- Quando o resource iniciar no client
addEventHandler("onClientResourceStart", resourceRoot, function()

    addEventHandler("onClientRender", root, downloadingScreen)
    addEventHandler ( "onClientClick", root, playPause)

    c.song = playSound("files/song.mp3", true) -- Play song
    setSoundVolume(c.song, c.vol)
    showChat(false)
    showCursor(true)

    setTimer(downloadComplete, 2000, 1)

end)

 

Download

 

Simple Downloading Screen with music.

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