APPs Config

circle-exclamation

App Structure

Every Config.App can include the following data:

  • name:string Unique app name

  • label:string App label

  • isEnabled:function(serial) return boolean and gives access to player

  • maximize?:boolean Allows player to maximize app (false by default)

  • height?:string App window height (default "80%"), it also supports pixels "300px"

  • width?:string App window width (default "80%"), it also supports pixels "300px"

  • path?:string Path for the .html file your resource uses for the UI rendering, this should not include the resource name, example of a valid path: /ui/dist/index.html

Config = {}
Config.App = {
    name = "my_app",
    label = "My App Label",
    isEnabled = function(serial)
        -- Run your own check here and return true to show the APP or false to hide it
        return true
    end,
    maximize = true, -- this is optional
    height = "490px", -- this is optional, 490px is the calculator height value
    width = "260px", -- this is optional, 260px is the calculator width value
    path = "/ui/dist/index.html" -- optional, for official AV APPS this field is not required
}

The following snippets are just examples for most common cases, add your own checks or use other scripts exports for this.

If you want to restrict an APP so only players with X item(s) can access it, you can use the following export:

The export hasItem also support a table of items for situations where you want to verify if the player owns more than 1 item at the same time:

Laptop Container

If using ox_inventory or origen_inventory you can use laptop as container, this means each laptop can be used to open an individual stash:

open the inventory > right click on laptop icon > Devices.

You can drag n drop your items inside that little stash and use it to enable specific apps by using the following export:

params:

  • itemName:string Item required inside laptop container.

  • laptopSerial:string This is sent from laptop to isEnabled function

returns:

  • result: boolean

Last updated