Exports

In this page you will find some exports and events you can use from your external scripts to interact with av_laptop.

showLaptop(tablet,itemCheck)

Use this export to open the laptop and set it as background while you run some other UI in front.

params:

  • tablet? boolean: Enable the tablet prop and animation.

  • itemCheck? boolean: It will check if the player has the laptop item in their inventory and use the wallpaper for the interface. If the player does not have the item, it will return false and cancel the animation.

-- Example using bl_ui minigames:
RegisterCommand("minigame", function()
    local hasLaptop = exports['av_laptop']:showLaptop(true,true)
    if hasLaptop then
        local success = exports.bl_ui:DigitDazzle(3, {
            length = 4,
            duration = 5000,
        })
        exports['av_laptop']:hideLaptop()
    else
        print("Player doesn't have laptop item")
    end
end)

Note: Your minigame UI should have a z-index of 100 otherwise it will be hidden behind laptop UI.

hideLaptop()

Use it to close laptop when opened using showLaptop() export.

exports['av_laptop']:hideLaptop()

getSerial()

Use this export to retrieve the current laptop serial.

params:

  • none

returns:

  • string or false

local serial = exports['av_laptop']:getSerial()
print(serial) -- false or string

Wifi()

Use this export to get the current WiFi network the laptop is connected to.

returns:

  • string or nil

local WiFi = exports['av_laptop']:WiFi()
print(WiFi)

Wifi Event

  • The following event gets triggered when the player connects/disconnects from a hotspot, you can use it in your own resource:

RegisterNetEvent('av_laptop:WiFi', function(hotspot, state)
    print(hotspot, state)
    -- hotspot: string
    -- state: boolean
end)

av_laptop:closeApp

Use the following event to close a specific APP in player laptop.

params:

  • name string: APP name.

local appName = "boosting"
TriggerEvent("av_laptop:closeApp", appName)

av_laptop:close

Use this event to close laptop UI.

TriggerEvent('av_laptop:close')

Last updated