VORP Lib is a modular scripting library for RedM that simplifies game development by providing reusable, instance-based components with automatic cleanup. Designed specifically for VORP Core Framework, it helps developers write cleaner, more efficient scripts while eliminating common issues like memory leaks and global variable pollution
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.
Allows to import any modules from the lib, a list of modules available can be found here
Copy
local module = Import "modulename" -- no symbolslocal prompts = Import("prompts").Prompts -- every module has a table with the module name as the key for readabilitylocal Lib = Import "prompts"local Prompts = Lib.Prompts -- [[@as PROMPTS]] -- for intellisense
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 developmentit has a entity tracker if you wish to track the entities from other scripts (see collector file) for exports
Shared
This is the baseclass for (peds, vehicles, objects) subclasses you can use these methods bellow or use directly the natives
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
Blip
This is the baseclass for blips, you can use these methods below or use directly the natives
Returns the color value's corresponding to the color name's
Copy
-- 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"
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
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
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
Command
use these methods below to manage command controls
Whether to add chat suggestion when registering the command, use this only on runtime, by default when player selects character suggestion is added automatically
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
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
When enabled, logs all events in the group. Use eventsToIgnore to filter out noise.
Copy
-- 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)
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
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
Asset Loading
use these functions below to load various game assets with automatic cleanup
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
OOP System
use these methods below to create classes with full OOP support
Returns a new class that can create instances with :New()
Copy
-- 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
Copy
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"
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
use these utilities for advanced control flow and timing operations
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
the result of the progress bar true or false if false the progress bar was cancelled
Copy
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}-- SYNClocal result = exports.vorp_lib:progressStart(data)if not result then print('cancelled')else print('completed')end--OR ASYNCexports.vorp_lib:progressStart(data, function(result) if result then print('Progress bar completed') else print('Progress bar cancelled') endend)