Library permissions

Permissions library. Provides an interface to check for access to certain priveleged functions.

Functions

canPerformAction( action, target ) Returns whether your instance has been granted permission to perform the given action.
register( rights ) Registers a permission request for this instance.

Fields

SPAWN_ENTITY Permission to spawn entities (props).
REMOVE_ENTITY Permission to remove entities belonging to the owner.
SET_PLAYER_POSITION Permission to set the owner's position.
CONTROL_VEHICLE_INPUT Permission to control input (e.g. exiting) while in a vehicle owned by the chip owner.
PLAY_CLIENT_SOUNDS Permission to play sounds on the client.
DRAW_HALOS Permission to draw halos on the client.
PLAY_URL_SOUNDS Permission to play sounds from the internet.
USE_WEB_BROWSER Permission to use the game's web browser.
SEND_HTTP_REQUESTS Permission to make HTTP requests on the client (on the chip's owner only).
READ_CHATBOX_STATE Permission to read the chatbox state, including typed text.
DRAW_MESH_HOLOGRAMS Permission to draw meshes using holograms.
USE_RENDER_TARGET_MATERIALS_WITH_HOLOGRAMS Permission to apply render target textures as a hologram's material.


Functions

permissions.canPerformAction( action, target )
Returns whether your instance has been granted permission to perform the given action. Note that this will throw an error if you have not registered the permission first.

Environment:

Shared

Parameters:

  • (string) action: The permission action to check access for.
  • (Player?) target: (Optional) The target player to evaluate the permission against. This is only applicable on the server.

Return value:

    (boolean) True if the instance has been granted this permission, false otherwise.
permissions.register( rights )
Registers a permission request for this instance. You must register permissions in order to be granted them. All valid permissions are fields on the permissions library table.

Environment:

Shared

Parameters:

  • (string | table) rights: The permission(s) to register (a single value or a list of values).

Usage:

    -- Request access to draw halos and play sounds from the internet. 
    permissions.register( { permissions.DRAW_HALOS, permissions.PLAY_URL_SOUNDS } )

Valid XHTML 1.0!