xXGhostXx

[HELP] HTML Loading Screen

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.

Share this post


Link to post
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)

 

Share this post


Link to post

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

Share this post


Link to post
4 minutes ago, xFabel said:

in meta you can't use file with html


<html src="filename.html" />

 

 

Don't work :( please test script

Share this post


Link to post

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.

Share this post


Link to post
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

Share this post


Link to post

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.