Jump to content

Tela de carregamento


Recommended Posts

Posted (edited)
local screenW,screenH = guiGetScreenSize()
local resW, resH = 1280, 720
local x, y =  (screenW/resW), (screenH/resH)

local Fonte1 = dxCreateFont("Fonte/1.otf", 11.3)

local Loading_Matheus = false

local function Loading_Painel()

rando1 = math.abs(math.sin(getTickCount()/5000))
rando2 = math.abs(math.sin(getTickCount()/3000))
rando3 = math.abs(math.sin(getTickCount()/2500))
sound1 = playSound("Musica/Musica.mp3",true)

local Girar = interpolateBetween(screenH * 1, 0, 0,screenH * 378, 0, 0, (getTickCount()-tick)/10000, "Linear")

    dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, "Imagens/Fundo.jpg", 0, 0, 0, tocolor(255, 255, 255, 255), true)
    dxDrawImage(screenW * 0.7461, screenH * 0.7995, screenW * 0.0605, screenH * 0.0807, "Imagens/Progresso.png", getTickCount()/10, 0, 0, tocolor(208, 236, 237, 255), true)
    dxDrawText("Carregando...", screenW * 0.8125, screenH * 0.8464, screenW * 0.9629, screenH * 0.8802, tocolor(rando3*200, rando2*200, rando1*200), 1.10, Fonte1, "left", "center", false, false, true, false, false)

end

function Loading_Stop()
    tick = getTickCount()
    Loading_Matheus = true
end

setTimer(function()
    if isTransferBoxActive() then
        if not Loading_Matheus then 
            addEventHandler("onClientRender", root, Loading_Stop) 
            addEventHandler("onClientRender", root, Loading_Painel, true, "high") 
            showChat(false)
        end
    else
        if Loading_Matheus then 
            removeEventHandler("onClientRender", root, Loading_Stop) 
            removeEventHandler("onClientRender", root, Loading_Painel) 
            showChat(true)
            stopSound(sound)
            Loading_Matheus = false
        end
        Loading_Matheus = false
    end
end, 100, 0)

Quando eu incio o carregamento ele começa a tocar a musica mas quando termina de baixar ele não desliga a musica.

O código não esta bem feito pois eu ainda estou aprendendo a fazer. Se puderem ajudar a achar o erro fico grato.

Edited by Matheus Schumann
  • Moderators
Posted (edited)

Na próxima vez, poste na seção de Programação em Lua, pois se trata de uma dúvida relacionada a scripting e não ao servidor/cliente em si. E não fique postando o mesmo tópico em diferentes seções, isso é considerado spam.

Quanto a sua dúvida, na linha 41, troque sound por sound1.

Edited by Lord Henry

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! spacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

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