nwmafia Posted August 20, 2015 Share Posted August 20, 2015 I need help opening the in-game CEF browser with a command. Can anyone give me some help? Here's what I've tried, but it does not work. --In order to render the browser on the full screen, we need to know the dimensions. local screenWidth, screenHeight = guiGetScreenSize() --Let's create a new browser in remote mode. local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false) local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window) -- The event onClientBrowserCreated will be triggered, after the browser has been initialized. -- After this event has been triggered, we will be able to load our URL local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser addEventHandler("onClientBrowserCreated", theBrowser, function LoadBrowser() -- After the browser has been initialized, we can load [url=https://www.youtube.com]www.youtube.com[/url] loadBrowserURL(source, "https://www.youtube.com") end ) addCommandHandler ("browser", LoadBrowser) Link to comment
HUNGRY:3 Posted August 20, 2015 Share Posted August 20, 2015 (edited) --In order to render the browser on the full screen, we need to know the dimensions. local screenWidth, screenHeight = guiGetScreenSize() --Let's create a new browser in remote mode. local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false) local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window) guiSetVisible(window,false) -- The event onClientBrowserCreated will be triggered, after the browser has been initialized. -- After this event has been triggered, we will be able to load our URL local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser addEventHandler("onClientBrowserCreated", theBrowser, function() -- After the browser has been initialized, we can load [url=https://www.youtube.com]https://www.youtube.com[/url] loadBrowserURL(source, "https://www.youtube.com") end ) function open() guiSetVisible(window,true) end addCommandHandler("browser",open) Edited August 20, 2015 by Guest Link to comment
nwmafia Posted August 20, 2015 Author Share Posted August 20, 2015 --In order to render the browser on the full screen, we need to know the dimensions. local screenWidth, screenHeight = guiGetScreenSize() --Let's create a new browser in remote mode. local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false) local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window) -- The event onClientBrowserCreated will be triggered, after the browser has been initialized. -- After this event has been triggered, we will be able to load our URL local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser addEventHandler("onClientBrowserCreated", theBrowser, function() -- After the browser has been initialized, we can load [url=https://www.youtube.com]https://www.youtube.com[/url] loadBrowserURL(source, "https://www.youtube.com") end ) function open() guiSetVisible(window,true) end addCommandHandler("browser",open) Sorry this did not work. As soon I started the resource the browser immediately opened. I want to be able to start the resource, then open the browser with a command. Link to comment
HUNGRY:3 Posted August 20, 2015 Share Posted August 20, 2015 --In order to render the browser on the full screen, we need to know the dimensions. local screenWidth, screenHeight = guiGetScreenSize() --Let's create a new browser in remote mode. local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false) local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window) -- The event onClientBrowserCreated will be triggered, after the browser has been initialized. -- After this event has been triggered, we will be able to load our URL local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser addEventHandler("onClientBrowserCreated", theBrowser, function() -- After the browser has been initialized, we can load [url=https://www.youtube.com]https://www.youtube.com[/url] loadBrowserURL(source, "https://www.youtube.com") end ) function open() guiSetVisible(window,true) end addCommandHandler("browser",open) Sorry this did not work. As soon I started the resource the browser immediately opened. I want to be able to start the resource, then open the browser with a command. lol copy and paste again Link to comment
nwmafia Posted August 20, 2015 Author Share Posted August 20, 2015 --In order to render the browser on the full screen, we need to know the dimensions. local screenWidth, screenHeight = guiGetScreenSize() --Let's create a new browser in remote mode. local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false) local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window) -- The event onClientBrowserCreated will be triggered, after the browser has been initialized. -- After this event has been triggered, we will be able to load our URL local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser addEventHandler("onClientBrowserCreated", theBrowser, function() -- After the browser has been initialized, we can load [url=https://www.youtube.com]https://www.youtube.com[/url] loadBrowserURL(source, "https://www.youtube.com") end ) function open() guiSetVisible(window,true) end addCommandHandler("browser",open) Sorry this did not work. As soon I started the resource the browser immediately opened. I want to be able to start the resource, then open the browser with a command. lol copy and paste again Fixed it. You're a genious. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now