Skip to main content
This documentation is for developers who are making scripts for redm, you should also note that this is a work in progress and anything can be changed at any time until the final release.
You cannot Import encrypted files like with escrow etc, only files that aren’t encrypted can be imported.

Lib usage

To import modules to your script you must add the following to the script fxmanifest.lua file
   shared_script "@vorp_lib/import.lua"

Module Import

Only Lua files can be imported

List of Modules

  • client
  • server
  • shared
this module contains methods that allows you to create entities like peds, vehicles, objects, etc
this module contains methods that allows you to create various types of blips styles and map related stuff
this module contains methods that allows you to create input controls
this module contains methods that allows you to create prompts
this module contains methods that allows you to register commands
this module contains methods that allows you to create points enter/exit with debug options
this module contains methods that allows you to register game events
this module contains methods that allows you to use dataview in lua
this module contains methods that allows you to call to load several game assets like anim dics models etc

Importing Modules

  • LibImport
  • Internal Import
  • External Import
module
string
required
Allows to import any modules from the lib, a list of modules available can be found here
local module = Import "modulename" -- no symbols

local prompts = Import("prompts").Prompts -- every module has a table with the module name as the key for readability

local Lib = Import "prompts"
local Prompts = Lib.Prompts -- [[@as PROMPTS]] -- for intellisense

Import Usage

  • Single Module Import
  • Multiple Module Import
  • Mixed Module Import
module
string
required
The module name to import
local module = Import "module"

Modules Usage

The following modules are available in the lib, you can import them using the Import function, documentation for each module will be available below

Entities

This module is used to create entities like peds, vehicles, objects, etc, it has a baseclass for all entities and sub classes for each entity type all creations are instanced objects every creation will have its own instance and wont be shared with other scripts since its imported to your script when you restart your resource the entities will be removed for easy development it has a entity tracker if you wish to track the entities from other scripts (see collector file) for exports
  • BASECLASS
  • PED SUBCLASS
  • VEHICLE SUBCLASS
  • OBJECT SUBCLASS
This is the baseclass for (peds, vehicles, objects) subclasses you can use these methods bellow or use directly the natives
  • Getters
  • Setters
return
string
Get the handle of the entity, this is a unique identifier for the entity
return
string
Get the model of the entity
return
vector3
Get the position of the entity
return
number
Get the heading of the entity
return
vector3
Get the rotation of the entity
return
number
Get the networked id of the entity if the entity created had IsNetworked = true

Map

The map module is used to create blips for now but will be expanded to include more map related features when you restart your resource the blips will be removed for easy development
  • Map
This is the baseclass for blips, you can use these methods below or use directly the natives
  • Getters
  • Setters
  • Create
return
integer
Get the handle of the blip
color
string|table
required
Get the color value's for blip colors, can be a single color string or table of color strings
return
integer
Returns the color value's corresponding to the color name's
    -- single string or multiple colors can be requested just for ease of use
    local blue, red, yellow = Map.Blips:GetBlipColor({ 'blue', 'red', 'yellow' }) 
    blip:AddModifierColor(blue) -- or string  "blue"

Inputs

this module is used to create input controls for your resource, single or multiple , without the user having to create loops and a bunch of code all creations are instanced objects every creation will have its own instance and wont be shared with other scripts since its imported to your script when you restart your resource the inputs will be removed for easy development
  • Inputs
use these methods below to manage input controls
  • Setters
  • Register
return
nil
Destroy the input instance and stop all processing
key
string
required
Remove a specific key from multiple inputs or if single input , destroys the input
return
nil
Pause the input processing without destroying the instance
return
nil
Resume the input processing after being paused
data
table
required
Update custom parameters for the input if needed
key
string|integer
required
Required if using multiple inputs - specifies which input to update
return
nil
Start the input processing if is not running, useful when you set state to false and start this when player is near something or character is selected

Prompts

this module is used to create prompts with coordinate-based activation, multiple prompts can be grouped together and managed as one unit all creations are instanced objects every creation will have its own instance and wont be shared with other scripts since its imported to your script when you restart your resource the prompts will be removed for easy development
  • Prompts
use these methods below to manage prompts
  • Getters
  • Setters
  • Register
key
string|integer
required
The key identifier of the specific prompt, its whatever you set in the register
return
integer
Get the handle of a specific prompt by key
key
string|integer
required
The key identifier of the specific prompt, its whatever you set in the register
return
integer
Get the group ID of a specific prompt
key
string|integer
required
The key identifier of the specific prompt, its whatever you set in the register
return
string
Get the group label of a specific prompt
return
boolean
Check if the prompt you registered is currently running

Commands

this module is used to register client-side/server-side commands with permissions, suggestions, and argument validation all creations are instanced objects every creation will have its own instance and wont be shared with other scripts since its imported to your script when you restart your resource the commands will be removed for easy development, if a command is active and suggestion hasnt been marked to add on register, it will be added on character selected automatically
  • Client
  • Server
use these methods below to manage command controls
  • Setters
  • Register
return
nil
Removes the command and its suggestion from chat
return
nil
Adds command suggestion to chat
return
nil
Removes the command suggestion from chat
return
nil
Pause the command without removing it (temporarily disables the command)
return
nil
Resume the command after being paused
return
nil
Completely destroy the command instance and clean up
addSuggestion
boolean
Whether to add chat suggestion when registering the command, use this only on runtime, by default when player selects character suggestion is added automatically
return
nil
Start/activate the command
callback
function
required
its called when the command is executed
callback
function
its called when the command has errors

Points

this module is used to create coordinate-based enter/exit areas with radius detection, multiple points can be registered and managed independently all creations are instanced objects every creation will have its own instance and wont be shared with other scripts since its imported to your script when you restart your resource the points will be removed for easy development
  • Points
use these methods below to manage points
  • Getters
  • Setters
  • Register
id
string|integer
required
The unique identifier of the point to check
return
boolean
Returns true if the point is active and not deactivated
id
string|integer
required
The unique identifier of the point to check
return
boolean
Returns true if the player is currently inside the point radius
id
string|integer
required
The unique identifier of the point to check
return
boolean
Returns true if the player is currently outside the point radius

Events

this module is used to register game event listeners that can capture and process native game events with automatic data parsing all creations are instanced objects every creation will have its own instance and wont be shared with other scripts since its imported to your script when you restart your resource the event listeners will be removed for easy development
  • Events
use these methods below to manage event listeners
  • Setters
  • Register
return
nil
Start the event listener and begin monitoring for the registered event
return
nil
Pause the event listener without destroying the instance
return
nil
Resume the event listener after being paused
return
nil
Destroy the event listener instance and clean up
enabled
boolean
required
Enable or disable developer mode for debugging events
eventsToIgnore
string|array
Optional events to ignore when in dev mode (can be event name string, hash)
return
nil
When enabled, logs all events in the group. Use eventsToIgnore to filter out noise.
    -- Enable dev mode and ignore specific events
    event:DevMode(true, {"EVENT_PED_CREATED", "EVENT_PED_DESTROYED"})
    
    -- Enable dev mode for all events
    event:DevMode(true)
    
    -- Disable dev mode
    event:DevMode(false)

DataView

this module provides JavaScript-like DataView functionality for handling binary data in Lua with support for various data types and endianness this module is based on gottfriedleibniz’s DataView implementation providing efficient binary data manipulation
  • DataView
use these methods below to manage binary data
  • Getters
  • Setters
  • Create
return
string
Get the underlying binary buffer as a string
return
integer
Get the length of the buffer in bytes
return
integer
Get the current offset position within the buffer
Available getter methods for reading different data types:
  • GetInt8(offset, endian) - Read 8-bit signed integer
  • GetUint8(offset, endian) - Read 8-bit unsigned integer
  • GetInt16(offset, endian) - Read 16-bit signed integer
  • GetUint16(offset, endian) - Read 16-bit unsigned integer
  • GetInt32(offset, endian) - Read 32-bit signed integer
  • GetUint32(offset, endian) - Read 32-bit unsigned integer
  • GetInt64(offset, endian) - Read 64-bit signed integer
  • GetUint64(offset, endian) - Read 64-bit unsigned integer
  • GetFloat32(offset, endian) - Read 32-bit float
  • GetFloat64(offset, endian) - Read 64-bit double
  • GetString(offset, endian) - Read null-terminated string
  • GetLuaInt(offset, endian) - Read Lua integer
  • GetLuaNum(offset, endian) - Read Lua number
offset
integer
required
Byte offset from buffer start to read from
endian
boolean
Endianness: true for big-endian, false/nil for little-endian
return
number|string|nil
The read value, or nil if offset is out of bounds
  • GetFixedString(offset, length, endian) - Read fixed-length string
  • GetFixedInt(offset, length, endian) - Read fixed-size signed integer
  • GetFixedUint(offset, length, endian) - Read fixed-size unsigned integer
offset
integer
required
Byte offset from buffer start
length
integer
required
Number of bytes to read
endian
boolean
Endianness: true for big-endian, false/nil for little-endian

Streaming

this module provides utility functions for loading various game assets like models, animations, textures, and more with automatic cleanup and timeout handling all functions handle the loading process with proper validation and error handling, preventing common issues with asset streaming
  • Streaming
use these functions below to load various game assets with automatic cleanup
  • Models & Textures
  • Animations & Weapons
  • World & Collision
  • Usage
model
string|integer
required
Model name (string) or hash (integer) to load
timeout
integer
Optional timeout in milliseconds to automatically unload the model and free memory
return
nil
Loads and validates the model, throws error if invalid or fails to load within 5 seconds
dict
string
required
Texture dictionary name to load
timeout
integer
Optional timeout in milliseconds to automatically unload the texture dictionary
return
nil
Loads texture dictionary with validation and error handling
dict
string
required
Particle effect dictionary name to load
timeout
integer
Optional timeout in milliseconds to automatically remove the particle effect asset
return
nil
Loads particle effect dictionary for use with particle systems

Class

this module provides a complete object-oriented programming system for Lua with classes, inheritance, private members, and automatic getters/setters supports both traditional Lua OOP patterns and modern structured approaches with automatic property management was inspired by JavaScript classes
  • Class
use these methods below to create classes with full OOP support
  • Class Creation
  • Inheritance
  • Getters & Setters
  • Private Members
  • Usage Examples
base
table|class
Base class to inherit from, or table of initial methods/properties
className
string
Optional name for the class (used in error messages)
return
class
Returns a new class that can create instances with :New()
    -- Import the class module
    local Lib = Import 'class' --[[@as CLASS]]
    
    -- Create a basic class
    local MyClass = Lib.Class:Create({
        constructor = function(self, name)
            self.name = name
        end,
        
        getName = function(self)
            return self.name
        end
    }, "MyClass")
    
    -- Create instance
    local instance = MyClass:New("Test")
    print(instance:getName()) -- "Test"
  • Traditional Lua example
 local MyClass = Lib.Class:Create({},"MyClass")

 function MyClass:constructor(name)
    self.name = name
 end

 function MyClass:getName()
    return self.name
 end

 local instance = MyClass:New("Test")
 print(instance:getName()) -- "Test"
...
any
Arguments to pass to the constructor
return
instance
Returns a new instance of the class
Creates new instances of the class. Supports both table-based and argument-based constructors.
    -- Table-based constructor
    local instance1 = MyClass:New({
        name = "John",
        age = 30
    })
    
    -- Argument-based constructor  
    local instance2 = MyClass:New("John", 30)

Functions

utility classes for control flow, timing, and conditional execution provides Switch-case patterns, repeating intervals, and one-time timeouts with full control over execution state shared between server and client environments
  • Switch
  • Interval
  • Timeout
use these utilities for advanced control flow and timing operations
value
any
The value to match against cases
creates a switch-case control structure that allows chaining case statements and default handling inspired by JS
     -- Import the functions module
     local Lib = Import 'functions' --[[@as FUNCTIONS]]
     
     -- Basic switch usage
     local result = Lib.Switch(playerLevel)
        :case(1, function(value) 
            return "Beginner" 
        end)
         :case(2, function(value) 
            return "Intermediate" 
        end)
         :case(3, function(value) 
            return "Advanced" 
        end)
         :default(function(value) 
            return "Unknown Level: " .. value 
        end)
        :execute()
     
    print(result)

Exports

Selector

This Selector allows you to select players with a NUI selector that will return the player id that was selected
  • Usage
allow_self
boolean
Allow self selection
amount_of_players
integer
Amount of players to select
distance
number
Distance to select players
allow_in_vehicle
boolean
Allow selection of players in vehicles
allow_on_horse
boolean
Allow selection of players on horses
playerid
integer
The player id that was selected
local result <const> = exports.vorp_lib:Select({
    allow_self = true, 
    amount_of_players = 4,
    distance = 8.0,  
    allow_in_vehicle = true,
    allow_on_horse = true 
})

ProgressBar

Allows you to create a progress bar that will be displayed on screen for a specified amount of time
  • Usage
text
string
required
Text to display in the progress bar
colors
table
required
Table with the colors for the progress bar startColor and endColor are the colors for the text and backgroundColor and fillColor are the colors for the background and the fill of the progress bar image
duration
integer
required
Duration in milliseconds for the progress bar
type
string
required
Type of progress bar only linear is avaliable for now
position
table
required
Table with the position for the progress bar on screen top and left are the position in % for the progress bar
image
string
Image for the progress bar only png is avaliable for now
callback
function
Callback function if you want to use it as async
return
boolean
the result of the progress bar true or false if false the progress bar was cancelled
local data = {
    text = 'Some text here',
    colors = {
        -- for text
        startColor = 'white', -- starting color of the text
        endColor = 'black', -- ending color of the text
        -- these colors are filters they dont really represent the color that well but its an option if you want to change it
        -- for background
        -- https://colorpicker.dev/#21d70d use this website choose hwb and its the first number just add deg to it like this 330deg

        -- backgroundColor = '0deg', -- Changes grey bar to blue-ish
        --fillColor = '120deg',     -- Changes white bar to green-ish
    },
    duration = 5000,
    type = 'linear',                    -- only linear is avaliable for now
    position = { top = 90, left = 50 }, -- in % for position on the screen
    image = 'score_timer_extralong',    -- only png this is optional you can add your own image , images must be in this script images folder
}

-- SYNC
local result = exports.vorp_lib:progressStart(data)
if not result then
    print('cancelled')
else
    print('completed')
end

--OR ASYNC
exports.vorp_lib:progressStart(data, function(result)
    if result then
        print('Progress bar completed')
    else
        print('Progress bar cancelled')
    end
end)
cancel the progress bar
    exports.vorp_lib:progressCancel()

Density

Not yet implemented

Collector

Not yet implemented
I