Jump to content

Carregando resources


Recommended Posts

Posted

Olá, eu queria saber como posso fazer uma transição de imagens. Eu estou utilizando um script que em quanto as resources do servidor carrega aparece uma mensagem na tela, eu queria fazer cm que em quanto carregue fique passando duas imagens na posição que eu definir com DX. tipo a cada 5 segundos troca de imagem exemplo:

/files/imagem1.png
5 SECONDS DPS
/files/imagem2.png

Meu código atual: (Não fiz ainda o DX da posição da imagem)

    setCameraMatrix(1054.26343, -1317.34631, 26.06291)
    exports["fx_blur"]:dxDrawBluredRectangle(0, 0, screenW, screenH, tocolor(255, 255, 255, 255))
    --vazernRectangle(410, 239, 489, 190, tocolor(0, 0, 0, 170), false)
    vazernRectangle(0, 0, 1360, 768, tocolor(0, 0, 0, 179), false)
    --vazernRectangle(410, 239, 489, 42, tocolor(0, 0, 0, 138), false)
    vazernText("Seja muito bem vindo, #1066e7"..getPlayerName(localPlayer).."#ffffff!", 418, 246, 787, 340, tocolor(254, 254, 254, 223), 2.00, "arial", "left", "top", false, false, false, true, false)
    vazernText("Por favor, para jogar, aguarde finalizar \ndownload de nossos #1066e7dados#ffffff.", 418, 292, 943, 386, tocolor(254, 254, 254, 218), 2.00, "arial", "left", "top", false, false, false, true, false)
    vazernRectangle(410, 281, 489, 3, tocolor(0, 248, 0, 0), false)

 

Posted (edited)

Faça com getTickCount, um exemplo:

local screen = { cImage = "/files/imagem1.png" }
local imagensTotal = 2 -- quantas imagens no total irão mostrar na tela
local id = 1

addEventHandler( "onClientResourceStart", resourceRoot,
    function()

        screen.tickStart = getTickCount()
        addEventHandler( "onClientRender", root, renderDXImage )
    end
)

function renderDXImage()
	if screen.cImage then
		if (getTickCount() - screen.tickStart) > 5000 then
			local id = id + 1
			id = ( id > imagensTotal ) and 1 or id

			screen.cImage = "/files/imagem"..tostring(id)..".png"
			screen.tickStart = getTickCount()
		end
		
		dxDrawImage( x, y, w, h, screen.cImage )
	end
end

 

Edited by DNL291
Posted
On 25/04/2019 at 03:11, DNL291 said:

Faça com getTickCount, um exemplo:


local screen = { cImage = "/files/imagem1.png" }
local imagensTotal = 2 -- quantas imagens no total irão mostrar na tela
local id = 1

addEventHandler( "onClientResourceStart", resourceRoot,
    function()

        screen.tickStart = getTickCount()
        addEventHandler( "onClientRender", root, renderDXImage )
    end
)

function renderDXImage()
	if screen.cImage then
		if (getTickCount() - screen.tickStart) > 5000 then
			local id = id + 1
			id = ( id > imagensTotal ) and 1 or id

			screen.cImage = "/files/imagem"..tostring(id)..".png"
			screen.tickStart = getTickCount()
		end
		
		dxDrawImage( x, y, w, h, screen.cImage )
	end
end

 

Funcionou mas eu queria que trocasse toda hora, tipo.
IMAGEM1

IMAGEM2

IMAGEM1

IMAGEM2

Enquanto carrega, esse código troca pra 2 e não volta mais pra 1.

Posted

Desculpe a demora na resposta (tinha esquecido do post).

Remova local na linha 17, deixa a variável global (ela já está local na linha 4).

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