fivem-development

Develops resources for FiveM using vRP Creative Network with Lua. Covers resource creation, Proxy/Tunnel system, inventory, money, groups, identity, NUI, database (oxmysql), security, and performance. Use when the user works with FiveM, vRP, Lua scripts for GTA V servers, or mentions resources, client/server scripts, natives, NUI, or any system of the vRP Creative Network framework.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "fivem-development" with this command: npx skills add proelias7/fivem-skill/proelias7-fivem-skill-fivem-development

FiveM Development — vRP

Framework Architecture

vRP Creative Network is based on Lua 5.4 with communication via Proxy (server-to-server) and Tunnel (client-server).

FiveM Natives — Official Source

Official source for natives:

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

ConceptDescription
PassportUnique character ID (equivalent to user_id in other vRPs)
SourcePlayer connection ID on the server (changes on every reconnection)
DatatableIn-memory table with character data (inventory, position, skin, etc.)
CharactersGlobal server-side table indexed by source with character data
SourcesGlobal 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

FunctionParametersReturnDescription
vRP.Passport(source)sourcePassport|falseGets player Passport
vRP.Source(Passport)Passportsource|nilGets source from Passport
vRP.Datatable(Passport)Passporttable|falseCharacter in-memory data
vRP.Inventory(Passport)PassporttableCharacter inventory
vRP.Identity(Passport)Passporttable|falseCharacter data (name, name2, bank, phone, etc.)
vRP.FullName(source)sourcestring|falseCharacter full name
vRP.Players()tableReturns Sources (Passport→source)
vRP.Kick(source, Reason)source, stringKicks the player
vRP.Teleport(source, x, y, z)source, coordsTeleports the player
vRP.GetEntityCoords(source)sourcevector3Player coordinates
vRP.ModelPlayer(source)sourcestringPed model (mp_m/mp_f)

Money

FunctionParametersReturnDescription
vRP.GetBank(source)sourcenumberBank balance
vRP.GiveBank(Passport, Amount)Passport, numberAdds money to bank
vRP.RemoveBank(Passport, Amount)Passport, numberRemoves money from bank
vRP.PaymentBank(Passport, Amount)Passport, numberboolPays with bank (checks balance)
vRP.PaymentMoney(Passport, Amount)Passport, numberboolPays with cash
vRP.PaymentFull(Passport, Amount)Passport, numberboolTries cash, then bank
vRP.PaymentDirty(Passport, Amount)Passport, numberboolPays with dirty money
vRP.WithdrawCash(Passport, Amount)Passport, numberboolBank withdrawal
vRP.PaymentGems(Passport, Amount)Passport, numberboolPays with gems
vRP.GetCoins(Passport)PassportnumberGets coins
vRP.AddCoins(Passport, Amount)Passport, numberboolAdds coins
vRP.RemCoins(Passport, Amount)Passport, numberboolRemoves coins

Inventory

FunctionParametersReturnDescription
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)...boolRemoves item (returns success)
vRP.RemoveItem(Passport, Item, Amount, Notify)...Removes item (no return)
vRP.ItemAmount(Passport, Item)Passport, stringnumberItem amount
vRP.ConsultItem(Passport, Item, Amount)...boolChecks if has amount
vRP.InventoryWeight(Passport)PassportnumberCurrent weight
vRP.GetWeight(Passport)PassportnumberMax weight
vRP.SetWeight(Passport, Amount)Passport, numberAdds to max weight
vRP.MaxItens(Passport, Item, Amount)...boolChecks item max limit
vRP.ClearInventory(Passport)PassportClears inventory

Groups/Permissions

FunctionParametersReturnDescription
vRP.HasPermission(Passport, Permission, Level)...boolChecks direct permission
vRP.HasGroup(Passport, Permission, Level)...boolChecks group (includes parents)
vRP.HasService(Passport, Permission)...boolChecks 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, numberPlayers in service
vRP.CheckGroup(Passport, Type)...boolChecks group by type
vRP.HasAction(Passport)PassportboolChecks police action
vRP.SetAction(Passport, Status)...Sets action status

Survival

FunctionParametersDescription
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

FunctionDescription
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

EventSideDescription
"Connect"ServerPlayer chose character (Passport, Source)
"Disconnect"ServerPlayer disconnected (Passport, Source)
"CharacterChosen"ServerCharacter chosen (Passport, source)
"vRP:Active"ClientPlayer activated (source, Passport, Name)

Critical Performance Rules (Summary)

ALWAYS follow these rules when writing code:

  1. Tunnel vs Event: Use TriggerServerEvent/TriggerClientEvent when you do NOT need a return. Use Tunnel only when you NEED a return.
  2. Dynamic Sleep: NEVER fixed Wait(0). Adjust based on state (dist < 20 = 0, dist < 50 = 500, else = 1000+).
  3. Calls in same environment: Call functions directly. NEVER use TriggerEvent() to call on the same side.
  4. No remote calls in loops: Do not use Tunnel/Events in loops < 5 seconds. Prefer batch or delta.
  5. Small Payloads: Send only the change, not full data. Limit of ~8KB per event.
  6. Cache: Use exports.cacheaside:Get() for repeated database queries. Never query the database in a loop.
  7. SafeEvent (server): Every event that gives money/item/advantage MUST pass through exports["cerberus"]:SafeEvent(source, "eventName", { time = N }).
  8. SetCooldown (client): Repetitive actions on client (open menu, use item) must use exports["cerberus"]:SetCooldown("name", ms).
  9. Tables > if/else: For 3+ conditions, use lookup table (O(1)) instead of if/elseif chains.
  10. Protect nil: Always check variables before concatenating. Use or "" as fallback.

UI Construction (React + Vite)

Stack: React 18 + TypeScript + Vite + Tailwind CSS + Zustand.

Fundamental Rules:

  • base: "./" in vite.config.ts (MANDATORY for FiveM)
  • Use rem for ALL sizes — NEVER px for layout
  • Media queries in html font-size to scale with player resolution
  • Tailwind v4 uses OKLCH and FiveM CEF does not support it. Use Tailwind v3.4.17.
  • FORBIDDEN: backdrop-filter: blur(), filter: blur(), filter: drop-shadow() — cause FPS drop
  • FORBIDDEN: framer-motion, GSAP, react-spring — heavy animation libs
  • Use pure CSS transitions/keyframes for animations
  • Independent modules (Notify, Progress) outside VisibilityProvider
  • Main interface inside VisibilityProvider with NuiFocus
  • Global overflow: hidden and user-select: none
  • isEnvBrowser() for data mocking in dev
  • Communication: observe() to listen to NUI, Post.create() to send callbacks

For complete UI guide: ui-guide.md

Additional References

External Resources (Download)

Use these official repositories when the project mentions dependencies:

  • cacheaside (in-memory cache): git@github.com:proelias7/cacheaside.git
  • cerberus (anti-exploit + cooldowns): git@github.com:proelias7/cerberus.git

vRPex Compatibility

The vRP Creative Network has compatibility aliases with classic vRP:

vRPex (old)Creative Network (current)
getUserIdPassport
getUserSourceSource
getUserIdentityIdentity
getUserDataTableDatatable
hasGroupHasGroup
hasPermissionHasPermission
giveInventoryItemGiveItem
tryGetInventoryItemTakeItem
getInventoryItemAmountItemAmount
giveMoneyGiveBank
tryFullPaymentPaymentFull
getBankMoneyGetBank
query / executeQuery
preparePrepare

ALWAYS use the native Creative Network names (right column), not the aliases.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

esx-framework

No summary provided by upstream source.

Repository SourceNeeds Review
General

qbox-framework

No summary provided by upstream source.

Repository SourceNeeds Review
General

qbcore-framework

No summary provided by upstream source.

Repository SourceNeeds Review