Jump to content

[HELP] HTML Loading Screen


xXGhostXx

Recommended Posts

That's quite simple.

local screen = {guiGetScreenSize()}
local page = "http://mta/local/yourfile.html"

function downloadGUI()
	browser = guiCreateBrowser(0,0,screen[1],screen[2],true,true,false) --display the Browser
	bg = guiGetBrowser(browser)
	addEventHandler("onClientBrowserCreated", bg, function()
		loadBrowserURL(source, page)		
	end)
end
addEventHandler("onClientRender", root, downloadGUI)

function checkTransfer()    
    if isTransferBoxActive() == true then
        setTimer(checkTransfer,2000,1) -- Check again after 2 seconds
    else 
        removeEventHandler("onClientRender", root, downloadGUI)
    end
end
addEventHandler("onClientResourceStart",resourceRoot,checkTransfer)

Also you need to update your download_priority_group field in meta.xml.

Link to comment
1 hour ago, edge said:

That's quite simple.


local screen = {guiGetScreenSize()}
local page = "http://mta/local/yourfile.html"

function downloadGUI()
	browser = guiCreateBrowser(0,0,screen[1],screen[2],true,true,false) --display the Browser
	bg = guiGetBrowser(browser)
	addEventHandler("onClientBrowserCreated", bg, function()
		loadBrowserURL(source, page)		
	end)
end
addEventHandler("onClientRender", root, downloadGUI)

function checkTransfer()    
    if isTransferBoxActive() == true then
        setTimer(checkTransfer,2000,1) -- Check again after 2 seconds
    else 
        removeEventHandler("onClientRender", root, downloadGUI)
    end
end
addEventHandler("onClientResourceStart",resourceRoot,checkTransfer)

Also you need to update your download_priority_group field in meta.xml.

Don't work.

Meta:

<meta>
	<script src="Loading.Lua" type="client" />
	
	<file src="index.html" />
	
	<download_priority_group>1</download_priority_group>
</meta>

Client:

local screen = {guiGetScreenSize()}
local page = "http://mta/local/index.html"

function downloadGUI()
	browser = guiCreateBrowser(0,0,screen[1],screen[2],true,true,false) --display the Browser
	bg = guiGetBrowser(browser)
	addEventHandler("onClientBrowserCreated", bg, function()
		loadBrowserURL(source, page)		
	end)
end
addEventHandler("onClientRender", root, downloadGUI)

function checkTransfer()    
    if isTransferBoxActive() == true then
        setTimer(checkTransfer,2000,1) -- Check again after 2 seconds
    else 
        removeEventHandler("onClientRender", root, downloadGUI)
    end
end
addEventHandler("onClientResourceStart",resourceRoot,checkTransfer)

 

Link to comment

in meta you can't use file with html

<html src="filename.html" />

 

7 minutes ago, xXGhostXx said:

Don't work.

Meta:


<meta>
	<script src="Loading.Lua" type="client" />
	
	<file src="index.html" />
	
	<download_priority_group>1</download_priority_group>
</meta>

Client:


local screen = {guiGetScreenSize()}
local page = "http://mta/local/index.html"

function downloadGUI()
	browser = guiCreateBrowser(0,0,screen[1],screen[2],true,true,false) --display the Browser
	bg = guiGetBrowser(browser)
	addEventHandler("onClientBrowserCreated", bg, function()
		loadBrowserURL(source, page)		
	end)
end
addEventHandler("onClientRender", root, downloadGUI)

function checkTransfer()    
    if isTransferBoxActive() == true then
        setTimer(checkTransfer,2000,1) -- Check again after 2 seconds
    else 
        removeEventHandler("onClientRender", root, downloadGUI)
    end
end
addEventHandler("onClientResourceStart",resourceRoot,checkTransfer)

 

 

https://wiki.multitheftauto.com/wiki/Resource_Web_Access

Link to comment
10 hours ago, edge said:

This works just when the files are being downloaded. Try to remove all your cached-files and enter your server. If that doesn't works, we'll check that. I don't think it didn't works, but I'll test it soon.

I want on player join in my server when data loading play this html page

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