vRP Framework — Creative Network
Language rule: Internal reasoning is in compact English. All messages and output displayed to the user must be in the user's language.
Framework Architecture
vRP Creative Network is based on Lua 5.4 with communication via Proxy (server-to-server) and Tunnel (client-server).
Support for Creative v5 and vRPEX (older variations)
Older versions maintain the same logic and best practices but change function and file names.
- Creative v5: core in
camelCase, modules/group.lua, configs in config/*.lua.
- vRPEX: classic core (
getUserId, getUserSource, getUsers, etc.) and configs in cfg/*.lua.
See the full mapping in reference.md.
Key Concepts
| Concept |
Description |
| Passport |
Unique character ID (equivalent to user_id in other vRPs) |
| Source |
Player connection ID on the server (changes on every reconnection) |
| Datatable |
In-memory table with character data (inventory, position, skin, etc.) |
| Characters |
Global server-side table indexed by source with character data |
| Sources |
Global table Sources[Passport] = source for reverse lookup |
Identification Flow
-- Server-side: get Passport from source
local Passport = vRP.Passport(source)
-- Server-side: get source from Passport
local source = vRP.Source(Passport)
-- Server-side: get character Datatable
local Datatable = vRP.Datatable(Passport)
-- Server-side: get inventory
local Inventory = vRP.Inventory(Passport)
Proxy/Tunnel System
-- In any SERVER-SIDE resource, get access to vRP:
local Proxy = module("vrp", "lib/Proxy")
vRP = Proxy.getInterface("vRP")
-- In any CLIENT-SIDE resource:
local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")
vRPS = Tunnel.getInterface("vRP") -- call server functions
-- Expose your resource functions (server):
myResource = {}
Proxy.addInterface("myResource", myResource)
Tunnel.bindInterface("myResource", myResource)
Fire-and-forget Rule
Prefix Tunnel calls with _ to not wait for a response:
-- Await response (blocking)
local result = vRP.Generateitem(Passport,"water",1)
-- Fire-and-forget (non-blocking)
vRP._Generateitem(Passport,"water",1)
Main API (Server-side)
Player/Identity
| Function |
Parameters |
Return |
Description |
vRP.Passport(source) |
source |
Passport|false |
Gets player Passport |
vRP.Source(Passport) |
Passport |
source|nil |
Gets source from Passport |
vRP.Datatable(Passport) |
Passport |
table|false |
Character in-memory data |
vRP.Inventory(Passport) |
Passport |
table |
Character inventory |
vRP.Identity(Passport) |
Passport |
table|false |
Character data (name, name2, bank, phone, etc.) |
vRP.FullName(source) |
source |
string|false |
Character full name |
vRP.Players() |
— |
table |
Returns Sources (Passport→source) |
vRP.Kick(source, Reason) |
source, string |
— |
Kicks the player |
vRP.Teleport(source, x, y, z) |
source, coords |
— |
Teleports the player |
vRP.GetEntityCoords(source) |
source |
vector3 |
Player coordinates |
vRP.ModelPlayer(source) |
source |
string |
Ped model (mp_m/mp_f) |
Money
| Function |
Parameters |
Return |
Description |
vRP.GetBank(source) |
source |
number |
Bank balance |
vRP.GiveBank(Passport, Amount) |
Passport, number |
— |
Adds money to bank |
vRP.RemoveBank(Passport, Amount) |
Passport, number |
— |
Removes money from bank |
vRP.PaymentBank(Passport, Amount) |
Passport, number |
bool |
Pays with bank (checks balance) |
vRP.PaymentMoney(Passport, Amount) |
Passport, number |
bool |
Pays with cash |
vRP.PaymentFull(Passport, Amount) |
Passport, number |
bool |
Tries cash, then bank |
vRP.PaymentDirty(Passport, Amount) |
Passport, number |
bool |
Pays with dirty money |
vRP.WithdrawCash(Passport, Amount) |
Passport, number |
bool |
Bank withdrawal |
vRP.PaymentGems(Passport, Amount) |
Passport, number |
bool |
Pays with gems |
vRP.GetCoins(Passport) |
Passport |
number |
Gets coins |
vRP.AddCoins(Passport, Amount) |
Passport, number |
bool |
Adds coins |
vRP.RemCoins(Passport, Amount) |
Passport, number |
bool |
Removes coins |
Inventory
| Function |
Parameters |
Return |
Description |
vRP.GiveItem(Passport, Item, Amount, Notify, Slot) |
... |
— |
Gives item (no durability) |
vRP.GenerateItem(Passport, Item, Amount, Notify, Slot) |
... |
— |
Gives item (with durability/charges) |
vRP.TakeItem(Passport, Item, Amount, Notify, Slot) |
... |
bool |
Removes item (returns success) |
vRP.RemoveItem(Passport, Item, Amount, Notify) |
... |
— |
Removes item (no return) |
vRP.ItemAmount(Passport, Item) |
Passport, string |
number |
Item amount |
vRP.ConsultItem(Passport, Item, Amount) |
... |
bool |
Checks if has amount |
vRP.InventoryWeight(Passport) |
Passport |
number |
Current weight |
vRP.GetWeight(Passport) |
Passport |
number |
Max weight |
vRP.SetWeight(Passport, Amount) |
Passport, number |
— |
Adds to max weight |
vRP.MaxItens(Passport, Item, Amount) |
... |
bool |
Checks item max limit |
vRP.ClearInventory(Passport) |
Passport |
— |
Clears inventory |
Groups/Permissions
| Function |
Parameters |
Return |
Description |
vRP.HasPermission(Passport, Permission, Level) |
... |
bool |
Checks direct permission |
vRP.HasGroup(Passport, Permission, Level) |
... |
bool |
Checks group (includes parents) |
vRP.HasService(Passport, Permission) |
... |
bool |
Checks if in service |
vRP.SetPermission(Passport, Permission, Level, Mode) |
... |
— |
Sets permission |
vRP.RemovePermission(Passport, Permission) |
... |
— |
Removes permission |
vRP.ServiceToggle(Source, Passport, Permission, Silenced) |
... |
— |
Toggles service |
vRP.NumPermission(Permission, Level) |
... |
table, number |
Players in service |
vRP.CheckGroup(Passport, Type) |
... |
bool |
Checks group by type |
vRP.HasAction(Passport) |
Passport |
bool |
Checks police action |
vRP.SetAction(Passport, Status) |
... |
— |
Sets action status |
Survival
| Function |
Parameters |
Description |
vRP.UpgradeHunger(Passport, Amount) |
... |
Increases hunger |
vRP.DowngradeHunger(Passport, Amount) |
... |
Decreases hunger |
vRP.UpgradeThirst(Passport, Amount) |
... |
Increases thirst |
vRP.DowngradeThirst(Passport, Amount) |
... |
Decreases thirst |
vRP.UpgradeInfection(Passport, Amount) |
... |
Increases infection |
vRP.DowngradeInfection(Passport, Amount) |
... |
Decreases infection |
vRP.Revive(source, Health) |
... |
Revives player |
Database
-- Register prepared query
vRP.Prepare("name/query", "SELECT * FROM table WHERE id = @id")
-- Execute query
local result = vRP.Query("name/query", { id = 123 })
Uses oxmysql internally. Parameters with @name.
Persistent Data
-- Server Data (entitydata — global data)
local data = vRP.GetSrvData("UniqueKey")
vRP.SetSrvData("UniqueKey", { field = "value" })
-- Player Data (playerdata — data per player)
local data = vRP.UserData(Passport, "key")
vRP.setUData(Passport, "key", json.encode(data))
Global Utilities
| Function |
Description |
parseInt(value) |
Converts to integer (min. 0) |
parseFormat(value) |
Formats number with thousand separator |
splitString(str, symbol) |
Splits string by separator |
SplitOne(name) |
First element of split |
sanitizeString(str, chars, allow) |
Filters characters |
CompleteTimers(seconds) |
Formats full time in HTML |
MinimalTimers(seconds) |
Formats summarized time |
CountTable(table) |
Counts items in table |
async(func) |
Executes asynchronous function |
Client-Server Communication
Notification Events
-- Server-side: simple notification
TriggerClientEvent("Notify", source, "success", "Message.", false, 5000)
-- Types: "success", "important", "negado" (denied)
-- Server-side: item notification
TriggerClientEvent("NotifyItens", source, { "+", "itemIndex", "amount", "Item Name" })
-- "+" for gain, "-" for loss
Important Events
| Event |
Side |
Description |
"Connect" |
Server |
Player chose character (Passport, Source) |
"Disconnect" |
Server |
Player disconnected (Passport, Source) |
"CharacterChosen" |
Server |
Character chosen (Passport, source) |
"vRP:Active" |
Client |
Player activated (source, Passport, Name) |
vRPex Compatibility
The vRP Creative Network has compatibility aliases with classic vRP:
| vRPex (old) |
Creative Network (current) |
getUserId |
Passport |
getUserSource |
Source |
getUserIdentity |
Identity |
getUserDataTable |
Datatable |
hasGroup |
HasGroup |
hasPermission |
HasPermission |
giveInventoryItem |
GiveItem |
tryGetInventoryItem |
TakeItem |
getInventoryItemAmount |
ItemAmount |
giveMoney |
GiveBank |
tryFullPayment |
PaymentFull |
getBankMoney |
GetBank |
query / execute |
Query |
prepare |
Prepare |
ALWAYS use the native Creative Network names (right column), not the aliases.
Additional References
- For complete and detailed API: reference.md
- For code examples: examples.md
- For resource templates: templates.md
- For patterns and conventions: patterns.md
- For general FiveM best practices (performance, security, cache): use skill
fivem-development
- For NUI interface construction (React + Vite): use skill
fivem-react-nui
1---2name: vrp-framework3description: Develops resources for FiveM using vRP Creative Network with Lua. Covers Proxy/Tunnel system, Passport/Source/Datatable, inventory, money, groups, identity, database (oxmysql), events, and vRPEX compatibility. Use when the user works with vRP, Creative Network, vRPEX, Proxy, Tunnel, Passport, or any vRP server-side/client-side API.4---56# vRP Framework — Creative Network78**Language rule:** Internal reasoning is in compact English. All messages and output displayed to the user must be in the user's language.910## Framework Architecture1112vRP Creative Network is based on **Lua 5.4** with communication via **Proxy** (server-to-server) and **Tunnel** (client-server).1314## Support for Creative v5 and vRPEX (older variations)1516Older versions maintain the same logic and best practices but change function and file names.1718- **Creative v5:** core in `camelCase`, `modules/group.lua`, configs in `config/*.lua`.19- **vRPEX:** classic core (`getUserId`, `getUserSource`, `getUsers`, etc.) and configs in `cfg/*.lua`.2021See the full mapping in [reference.md](reference.md).2223### Key Concepts2425| Concept | Description |26|---|---|27| **Passport** | Unique character ID (equivalent to `user_id` in other vRPs) |28| **Source** | Player connection ID on the server (changes on every reconnection) |29| **Datatable** | In-memory table with character data (inventory, position, skin, etc.) |30| **Characters** | Global server-side table indexed by `source` with character data |31| **Sources** | Global table `Sources[Passport] = source` for reverse lookup |3233### Identification Flow3435```lua36-- Server-side: get Passport from source37local Passport = vRP.Passport(source)3839-- Server-side: get source from Passport40local source = vRP.Source(Passport)4142-- Server-side: get character Datatable43local Datatable = vRP.Datatable(Passport)4445-- Server-side: get inventory46local Inventory = vRP.Inventory(Passport)47```4849### Proxy/Tunnel System5051```lua52-- In any SERVER-SIDE resource, get access to vRP:53local Proxy = module("vrp", "lib/Proxy")54vRP = Proxy.getInterface("vRP")5556-- In any CLIENT-SIDE resource:57local Tunnel = module("vrp", "lib/Tunnel")58local Proxy = module("vrp", "lib/Proxy")59vRPS = Tunnel.getInterface("vRP") -- call server functions6061-- Expose your resource functions (server):62myResource = {}63Proxy.addInterface("myResource", myResource)64Tunnel.bindInterface("myResource", myResource)65```6667### Fire-and-forget Rule6869Prefix Tunnel calls with `_` to not wait for a response:7071```lua72-- Await response (blocking)73local result = vRP.Generateitem(Passport,"water",1)7475-- Fire-and-forget (non-blocking)76vRP._Generateitem(Passport,"water",1)77```7879## Main API (Server-side)8081### Player/Identity8283| Function | Parameters | Return | Description |84|--------|------------|---------|-----------|85| `vRP.Passport(source)` | source | Passport\|false | Gets player Passport |86| `vRP.Source(Passport)` | Passport | source\|nil | Gets source from Passport |87| `vRP.Datatable(Passport)` | Passport | table\|false | Character in-memory data |88| `vRP.Inventory(Passport)` | Passport | table | Character inventory |89| `vRP.Identity(Passport)` | Passport | table\|false | Character data (name, name2, bank, phone, etc.) |90| `vRP.FullName(source)` | source | string\|false | Character full name |91| `vRP.Players()` | — | table | Returns `Sources` (Passport→source) |92| `vRP.Kick(source, Reason)` | source, string | — | Kicks the player |93| `vRP.Teleport(source, x, y, z)` | source, coords | — | Teleports the player |94| `vRP.GetEntityCoords(source)` | source | vector3 | Player coordinates |95| `vRP.ModelPlayer(source)` | source | string | Ped model (mp_m/mp_f) |9697### Money9899| Function | Parameters | Return | Description |100|--------|------------|---------|-----------|101| `vRP.GetBank(source)` | source | number | Bank balance |102| `vRP.GiveBank(Passport, Amount)` | Passport, number | — | Adds money to bank |103| `vRP.RemoveBank(Passport, Amount)` | Passport, number | — | Removes money from bank |104| `vRP.PaymentBank(Passport, Amount)` | Passport, number | bool | Pays with bank (checks balance) |105| `vRP.PaymentMoney(Passport, Amount)` | Passport, number | bool | Pays with cash |106| `vRP.PaymentFull(Passport, Amount)` | Passport, number | bool | Tries cash, then bank |107| `vRP.PaymentDirty(Passport, Amount)` | Passport, number | bool | Pays with dirty money |108| `vRP.WithdrawCash(Passport, Amount)` | Passport, number | bool | Bank withdrawal |109| `vRP.PaymentGems(Passport, Amount)` | Passport, number | bool | Pays with gems |110| `vRP.GetCoins(Passport)` | Passport | number | Gets coins |111| `vRP.AddCoins(Passport, Amount)` | Passport, number | bool | Adds coins |112| `vRP.RemCoins(Passport, Amount)` | Passport, number | bool | Removes coins |113114### Inventory115116| Function | Parameters | Return | Description |117|--------|------------|---------|-----------|118| `vRP.GiveItem(Passport, Item, Amount, Notify, Slot)` | ... | — | Gives item (no durability) |119| `vRP.GenerateItem(Passport, Item, Amount, Notify, Slot)` | ... | — | Gives item (with durability/charges) |120| `vRP.TakeItem(Passport, Item, Amount, Notify, Slot)` | ... | bool | Removes item (returns success) |121| `vRP.RemoveItem(Passport, Item, Amount, Notify)` | ... | — | Removes item (no return) |122| `vRP.ItemAmount(Passport, Item)` | Passport, string | number | Item amount |123| `vRP.ConsultItem(Passport, Item, Amount)` | ... | bool | Checks if has amount |124| `vRP.InventoryWeight(Passport)` | Passport | number | Current weight |125| `vRP.GetWeight(Passport)` | Passport | number | Max weight |126| `vRP.SetWeight(Passport, Amount)` | Passport, number | — | Adds to max weight |127| `vRP.MaxItens(Passport, Item, Amount)` | ... | bool | Checks item max limit |128| `vRP.ClearInventory(Passport)` | Passport | — | Clears inventory |129130### Groups/Permissions131132| Function | Parameters | Return | Description |133|--------|------------|---------|-----------|134| `vRP.HasPermission(Passport, Permission, Level)` | ... | bool | Checks direct permission |135| `vRP.HasGroup(Passport, Permission, Level)` | ... | bool | Checks group (includes parents) |136| `vRP.HasService(Passport, Permission)` | ... | bool | Checks if in service |137| `vRP.SetPermission(Passport, Permission, Level, Mode)` | ... | — | Sets permission |138| `vRP.RemovePermission(Passport, Permission)` | ... | — | Removes permission |139| `vRP.ServiceToggle(Source, Passport, Permission, Silenced)` | ... | — | Toggles service |140| `vRP.NumPermission(Permission, Level)` | ... | table, number | Players in service |141| `vRP.CheckGroup(Passport, Type)` | ... | bool | Checks group by type |142| `vRP.HasAction(Passport)` | Passport | bool | Checks police action |143| `vRP.SetAction(Passport, Status)` | ... | — | Sets action status |144145### Survival146147| Function | Parameters | Description |148|--------|------------|-----------|149| `vRP.UpgradeHunger(Passport, Amount)` | ... | Increases hunger |150| `vRP.DowngradeHunger(Passport, Amount)` | ... | Decreases hunger |151| `vRP.UpgradeThirst(Passport, Amount)` | ... | Increases thirst |152| `vRP.DowngradeThirst(Passport, Amount)` | ... | Decreases thirst |153| `vRP.UpgradeInfection(Passport, Amount)` | ... | Increases infection |154| `vRP.DowngradeInfection(Passport, Amount)` | ... | Decreases infection |155| `vRP.Revive(source, Health)` | ... | Revives player |156157### Database158159```lua160-- Register prepared query161vRP.Prepare("name/query", "SELECT * FROM table WHERE id = @id")162163-- Execute query164local result = vRP.Query("name/query", { id = 123 })165```166167Uses **oxmysql** internally. Parameters with `@name`.168169### Persistent Data170171```lua172-- Server Data (entitydata — global data)173local data = vRP.GetSrvData("UniqueKey")174vRP.SetSrvData("UniqueKey", { field = "value" })175176-- Player Data (playerdata — data per player)177local data = vRP.UserData(Passport, "key")178vRP.setUData(Passport, "key", json.encode(data))179```180181### Global Utilities182183| Function | Description |184|--------|-----------|185| `parseInt(value)` | Converts to integer (min. 0) |186| `parseFormat(value)` | Formats number with thousand separator |187| `splitString(str, symbol)` | Splits string by separator |188| `SplitOne(name)` | First element of split |189| `sanitizeString(str, chars, allow)` | Filters characters |190| `CompleteTimers(seconds)` | Formats full time in HTML |191| `MinimalTimers(seconds)` | Formats summarized time |192| `CountTable(table)` | Counts items in table |193| `async(func)` | Executes asynchronous function |194195## Client-Server Communication196197### Notification Events198199```lua200-- Server-side: simple notification201TriggerClientEvent("Notify", source, "success", "Message.", false, 5000)202-- Types: "success", "important", "negado" (denied)203204-- Server-side: item notification205TriggerClientEvent("NotifyItens", source, { "+", "itemIndex", "amount", "Item Name" })206-- "+" for gain, "-" for loss207```208209### Important Events210211| Event | Side | Description |212|--------|------|-----------|213| `"Connect"` | Server | Player chose character `(Passport, Source)` |214| `"Disconnect"` | Server | Player disconnected `(Passport, Source)` |215| `"CharacterChosen"` | Server | Character chosen `(Passport, source)` |216| `"vRP:Active"` | Client | Player activated `(source, Passport, Name)` |217218## vRPex Compatibility219220The vRP Creative Network has compatibility aliases with classic vRP:221222| vRPex (old) | Creative Network (current) |223|----------------|--------------------------|224| `getUserId` | `Passport` |225| `getUserSource` | `Source` |226| `getUserIdentity` | `Identity` |227| `getUserDataTable` | `Datatable` |228| `hasGroup` | `HasGroup` |229| `hasPermission` | `HasPermission` |230| `giveInventoryItem` | `GiveItem` |231| `tryGetInventoryItem` | `TakeItem` |232| `getInventoryItemAmount` | `ItemAmount` |233| `giveMoney` | `GiveBank` |234| `tryFullPayment` | `PaymentFull` |235| `getBankMoney` | `GetBank` |236| `query` / `execute` | `Query` |237| `prepare` | `Prepare` |238239**ALWAYS use the native Creative Network names** (right column), not the aliases.240241## Additional References242243- For complete and detailed API: [reference.md](reference.md)244- For code examples: [examples.md](examples.md)245- For resource templates: [templates.md](templates.md)246- For patterns and conventions: [patterns.md](patterns.md)247- For general FiveM best practices (performance, security, cache): use skill `fivem-development`248- For NUI interface construction (React + Vite): use skill `fivem-react-nui`