Welcome! Here you can paste sources and general debugging text, You can even set yourself a password if you want to keep it just for yourself.

Posted by Anonymous on July Tue 28th 2:43 PM - Never Expires
Download | New paste

  1. local sx, sy = guiGetScreenSize()
  2. local width,height = sx-5, sy-5
  3. local window = guiCreateWindow(sx/2-width/2, sy/2-height/2, width, height, "B?ng?sző", false)
  4. guiWindowSetMovable(window, false)
  5. tabPanel = guiCreateTabPanel(0, 20, width, height-20, false, window)
  6. guiMoveToBack(tabPanel)
  7. minimizeButton = guiCreateButton(sx-220,25,100,20,"Kis m?ret",false)
  8. closeButton = guiCreateButton(sx-110,25,100,20,"Bez?r",false)
  9. guiSetVisible(window, false)
  10. requestBrowserDomains({"hl-rpg.eu","forum.hl-rpg.eu"})
  11. local pages = {}
  12. table.insert(pages,{"Weboldal","http://hl-rpg.eu"})
  13. table.insert(pages,{"F?rum","http://forum.hl-rpg.eu"})
  14. table.insert(pages,{"Youtube","http://youtube.com"})
  15. local browsers = {}
  16. local tabs = {}
  17. local minimized = false
  18.  
  19. function hideBrowser()
  20.         for k,v in pairs(browsers) do
  21.                 destroyElement(k)
  22.         end
  23.         browsers = {}
  24.         -- exports.ex_core:toggleComponents(false)
  25. end
  26.  
  27. addEventHandler("onClientGUIClick", root, function()
  28.         if source == minimizeButton then
  29.                 guiSetVisible(window, false)
  30.                 minimized = true
  31.                 -- exports.ex_core:toggleComponents(false)
  32.         elseif source == closeButton then
  33.                 hideBrowser()
  34.         end
  35. end)
  36.  
  37. addEventHandler("onClientBrowserCreated", root, function()
  38.         if source and browsers[source] then
  39.                 loadBrowserURL(source, browsers[source])
  40.         end
  41. end)
  42.  
  43. addEventHandler("onClientResourceStart", resourceRoot, function()
  44.         for k,v in ipairs(pages) do
  45.                 tabs[k] = guiCreateTab(v[1], tabPanel)
  46.         end
  47. end)
  48.  
  49. addEventHandler("onClientResourceStop", resourceRoot, function()
  50.         hideBrowser()
  51. end)
  52.  
  53. addCommandHandler("chrome", function()
  54.         local visible = not guiGetVisible(window)
  55.         guiSetVisible(window, visible)
  56.         if not minimized then
  57.                 if visible then
  58.                         browsers = {}
  59.                         for k,v in ipairs(pages) do
  60.                                 tempBrowser = guiCreateBrowser(5, 5, width-10, height-10, false, false, false, tabs[k])
  61.                                 browsers[guiGetBrowser(tempBrowser)] = v[2]
  62.                         end
  63.                         -- exports.ex_core:toggleComponents(true)
  64.                 else
  65.                         hideBrowser()
  66.                 end
  67.         else
  68.                 minimized = false
  69.                 -- exports.ex_core:toggleComponents(true)
  70.         end
  71. end)
Language:
To highlight particular lines, prefix each line with @@





© 2022 - Powered by PASTE 1.0