Jump to content

Help browser


Dimos7

Recommended Posts

Hello there i have make a browser i want to take sound and delete the browser when play then sound but i can make it write on browser any help

local screenWidth, screenHeight = guiGetScreenSize()

local webBrowser = createBrowser(screenWidth, screenHeight, false, false)

function webBrowserRender()
    dxDrawImage(0, 0, screenWidth, screenHeight, webBrowser, 0, 0, 0, tocolor(255, 255, 255, 255), true)
	showCursor(true)
end
	
addEventHandler("onClientBrowserCreated", webBrowser,
    function()
	    loadBrowserURL(source, "http://www.youtube.com")
		addEventHandler("onClientRender", root, webBrowserRender)
		sound = playSound(getBrowserURL(webBrowser))
		setBrowserVolume(webBrowser, 0.5)
		if sound then
		   removeEventHandler("onClientRender", root, webBrowserRender)
		   showCursor(false)
		end
	end
)

 

Link to comment
58 minutes ago, Dimos7 said:

sound = playSound(getBrowserURL(webBrowser))

This will execute as: playSound("http://www.youtube.com") which isn't useful.

Don't you want them to pick a video to play first? Why not just add a GUI button so that they can close the browser once they've picked something to play? The music of the video would then play in the background which is what you want?

Link to comment

There is a web browser resource that comes with MTA called 'webbrowser' so you can either let players use that or you can copy some of the code that's in it as it allows players to enter a URL to play a video and there's a button to close it.

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