function toggle ()
local screenWidth, screenHeight = guiGetScreenSize( )
local window = guiCreateWindow( 0, 0, screenWidth/1.2, screenHeight/1.2, "Mobile Data Computer", false )
exports.global:centerWindow(window)
guiSetInputEnabled(not guiGetInputEnabled())
guiWindowSetSizable ( window, false )
guiSetAlpha( window, 255)
local browser = guiCreateBrowser( 0, 28, screenWidth/1.2, screenHeight/1.35, false, false, false, window )
local theBrowser = guiGetBrowser( browser )
local closeButton = guiCreateButton( 0, (screenHeight/1.35)+40, screenWidth/1.2, 50, "Close Mobile Data Computer", false, window )
addEventHandler("onClientGUIClick", closeButton,
function ()
destroyElement(window)
destroyElement(browser)
destroyElement(theBrowser)
destroyElement(closeButton)
window = nil
browser = nil
theBrowser = nil
guiSetInputEnabled(not guiGetInputEnabled())
end)
addEventHandler( "onClientBrowserCreated", theBrowser,
function( )
loadBrowserURL( source, "http://facebook.com" )
end
)
end
addCommandHandler("callmdc", toggle )
addEventHandler("onClientResourceStart", getResourceRootElement(),
function()
requestBrowserDomains({"http://facebook.com"})
end
)
This code works fine sometimes, when I do it, its fine, but for everyone else, it just shows the GUI window, with no browser inside. No errors in debug.