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
  On 14/11/2019 at 19:42, 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.

Expand  

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" />

 

  On 14/11/2019 at 21:18, 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)

 

Expand  

 

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

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