Jump to content
  • 0

Heeeeelp With Loading Browser URL (Instagram)


H20

Question

Hi guys , I don't know what's wrong with my code, I'm trying to load instagram , but nothing worked!

Here's my code:

 

local screenW, screenH = guiGetScreenSize()
local resW, resH = 1366, 768
local x, y = (screenW / resW), (screenH / resH)

requestBrowserDomains({"instagram.com"})

local font = dxCreateFont("files/fontt4.ttf", y * 10)
local font2 = dxCreateFont("files/fontt5.ttf", y * 8)

local webBrowser
local isBrowserOpen = false

function openInstagram()
    if isBrowserOpen then return end  -- Prevent multiple instances

    webBrowser = guiCreateBrowser(0, 0, screenW, screenH, false, true, false)
    local browser = guiGetBrowser(webBrowser)

    addEventHandler("onClientBrowserCreated", browser, function()
        showCursor(true)
        loadBrowserURL(browser, "http://www.instagram.com") 
    end)

    isBrowserOpen = true
end

function closeInstagram()
    if isBrowserOpen and isElement(webBrowser) then
        showCursor(false)
        destroyElement(webBrowser)
        webBrowser = nil
        isBrowserOpen = false
    end
end

function drawInterface()
    local time = getRealTime()
    local Hora = string.format("%02d", time.hour)
    local Minuto = string.format("%02d", time.minute)

    -- Draw background and UI elements efficiently
    local backgroundImage = getElementData(localPlayer, "ZN-CellCfgNPert") and "files/4.png" or "files/3.png"
    dxDrawImage(x * 1100, y * 150, x * 250, y * 500, "files/fundo3.png", 0, 0, 0, tocolor(31, 44, 52))
    dxDrawImage(x * 1100, y * 151, x * 247, y * 500, backgroundImage, 0, 0, 0, tocolor(255, 255, 255))
    
    dxDrawText(Hora .. ":" .. Minuto, x * 1120, y * 303, x * 1120, y * 40, tocolor(255, 255, 255), 1.0, font2, "left", "center", false, false, false, true, false)
end

-- Command to toggle the browser
addCommandHandler("insta", function()
    if isBrowserOpen then
        closeInstagram()
    else
        openInstagram()
    end
end)

 

Link to comment

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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