MineX server Posted June 23, 2023 Share Posted June 23, 2023 Idk Why But this script is not working please correct it: local browser local browserVisible = false local screenWidth, screenHeight = guiGetScreenSize() function createYouTubeBrowser() -- Create the browser with a custom size and position local browserWidth, browserHeight = 800, 600 local browserPosX, browserPosY = (screenWidth - browserWidth) / 2, (screenHeight - browserHeight) / 2 browser = createBrowser(browserWidth, browserHeight, true, false) setBrowserProperty(browser, "scalable", "false") setBrowserProperty(browser, "movable", "true") -- Load the YouTube website loadBrowserURL(browser, "https://www.youtube.com") end function toggleYouTubeBrowser() if browserVisible then -- If the browser is already showing, hide it destroyElement(browser) browserVisible = false else -- If the browser is not showing, create it createYouTubeBrowser() browserVisible = true end end -- Bind the toggleYouTubeBrowser function to the F4 key bindKey("F4", "down", toggleYouTubeBrowser) This is AI generated script from Chat GPT btw The script is not working and showing no error in the console or in the debug please help Link to comment
Moderators Vinyard Posted June 24, 2023 Moderators Share Posted June 24, 2023 Moving this to the scripting section. Link to comment
klue Posted June 25, 2023 Share Posted June 25, 2023 (edited) I haven't tested it, but it should work. local screenWidth, screenHeight = guiGetScreenSize(); local isVisible = false; local browser = false; loadBrowser = function () loadBrowserURL(source, "https://www.youtube.com"); end addEventHandler("onClientResourceStart", resourceRoot, function () browser = createBrowser(screenWidth, screenHeight, true, true); if browser then addEventHandler("onClientBrowserCreated", browser, loadBrowser); end end); toggleBrowser = function () if isVisible then isVisible = false; removeEventHandler("onClientRender", root, draw); else isVisible = true; addEventHandler("onClientRender", root, draw); end end draw = function () local sx = 800; local sy = 600; local x = (screenWidth - sx) / 2; local y = (screenHeight - sy) / 2; dxDrawImage(x, y, sx, sy, browser); end bindKey("F4", "down", toggleBrowser); Edited June 25, 2023 by klue Link to comment
MineX server Posted June 26, 2023 Author Share Posted June 26, 2023 still when i click F4 nothing happens. This resource work very well for me:https://community.multitheftauto.com/index.php?p=resources&s=details&id=11976 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