var inventoryBrowser; mp.events.add("showInventory", (show) => { if (show === true) { inventoryBrowser = mp.browsers.new('package://Gui/Inventory/inventory.html'); mp.gui.chat.activate(false); mp.gui.cursor.show(true, true); } else { if (inventoryBrowser) { inventoryBrowser.destroy(); mp.gui.chat.activate(true); mp.gui.cursor.show(false, false); } } });