Unified, framework-agnostic API for SiloTek RedM scripts. Supports VORP Core and RSG Core — write your script once, run it on both.
local SiloLibs = exports["silo-libs"]:GetSiloLibs()
SiloLibs.AddItem(source, "bread", 1) -- same call on VORP and RSGThe goal: your scripts never call exports.vorp_inventory:... or
exports.rsg_inventory:... directly. They call SiloLibs.FunctionName(...),
and silo-libs decides at startup which
framework is running and which adapter to use. If the framework changes
(or VORP/RSG change their internal API), you only update the adapter in
silo-libs — not every script.
- Put the
silo-libsfolder in your server'sresourcesdirectory. - Add it to
server.cfgbefore the scripts that use it, but aftervorp_core(orrsg-core):ensure vorp_core ensure vorp_inventory ensure silo-libs
-- client or server, identical
local SiloLibs = exports["silo-libs"]:GetSiloLibs()
-- server
local added = SiloLibs.AddItem(source, "bread", 1)
local count = SiloLibs.GetItemCount(source, "bread")
local cash = SiloLibs.GetMoney(source)
-- client
local items = SiloLibs.GetInventory()The API table is built once when silo-libs starts, based on the detected
framework (vorp_core or rsg-core running). If neither is running the
table stays empty and a warning is printed to the console.
| Category | VORP | RSG |
|---|---|---|
| Inventory (items) | YES | stub (logs "not implemented yet") |
| Inventory (weapons) | YES | stub |
| Custom inventories | YES | stub |
| Core (charid/job/money) | YES | YES |
| SiloLibs | vorp_core source |
|---|---|
| GetCharid | getUser(source).getUsedCharacter.charIdentifier |
| GetFirstname | getUser(source).getUsedCharacter.firstname |
| GetLastname | getUser(source).getUsedCharacter.lastname |
| GetJob | getUser(source).getUsedCharacter.job |
| GetJobGrade | getUser(source).getUsedCharacter.jobGrade |
| SetJob | character.setJob(job) + character.setJobGrade(grade) (grade optional) |
| FindCharacterByName | direct DB: characters table by firstname+lastname (case-insensitive, works offline) → result via callback: { charId, firstname, lastname } or nil. Callback-based because cross-resource refs must not yield. |
| GetMoney | getUser(source).getUsedCharacter.money |
| GiveMoney | character.addCurrency(0, amount) |
| RemoveMoney | character.removeCurrency(0, amount) (checks sufficient funds first) |
| Notify | CoreFunctions.NotifyObjective(source, text, duration) |
All VORP server functions respond synchronously (they return the value
directly, no callback needed) — vorp_inventory internally uses a
respond(cb, result) helper that returns result whether you pass a callback
or not. That is why the silo-libs wrappers never send one.
| SiloLibs | vorp_inventory export |
|---|---|
| GetInventory | getInventoryItems |
| GetItem | getInventoryItem |
| GetServerItem | getServerItem |
| CloseInventory | closeInventory |
| GetWeaponDefaultWeight | getWeaponDefaultWeight |
| GetWeaponDefaultDesc | getWeaponDefaultDesc |
| GetWeaponDefaultLabel | getWeaponDefaultLabel |
| GetWeaponName | getWeaponName |
| GetWeaponsDefaultData | getWeaponsDefaultData |
| GetWeaponAmmoTypes | getWeaponAmmoTypes |
| GetAmmoLabel | getAmmoLabel |
Items
| SiloLibs | vorp_inventory export |
|---|---|
| GetInventory | getUserInventoryItems |
| GetItem | getItem |
| GetItemById | getItemById |
| GetItemByName | getItemByName |
| GetItemDB | getItemDB |
| GetItemCount | getItemCount |
| AddItem | addItem |
| RemoveItem | subItem |
| RemoveItemById | subItemById |
| SetItemMetadata | setItemMetadata |
| CanCarryItem | canCarryItem |
| RegisterUsableItem | registerUsableItem |
| UnregisterUsableItem | unRegisterUsableItem |
Weapons
| SiloLibs | vorp_inventory export |
|---|---|
| GetWeapon | getUserWeapon |
| GetWeapons | getUserInventoryWeapons |
| GetWeaponBullets | getWeaponBullets |
| GetWeaponComponents | getWeaponComponents |
| GetAmmo | getUserAmmo |
| RemoveAllAmmo | removeAllUserAmmo |
| AddBullets | addBullets |
| RemoveBullets | subBullets |
| CanCarryWeapons | canCarryWeapons |
| SetWeaponLabel | setWeaponCustomLabel |
| SetWeaponSerial | setWeaponSerialNumber |
| SetWeaponDesc | setWeaponCustomDesc |
| CreateWeapon | createWeapon |
| GiveWeapon | giveWeapon |
| RemoveWeapon | subWeapon |
| DeleteWeapon | deleteWeapon |
Custom inventories
| SiloLibs | vorp_inventory export |
|---|---|
| RegisterInventory | registerInventory |
| RemoveInventory | removeInventory |
| DeleteInventory | deleteCustomInventory |
| IsInventoryRegistered | isCustomInventoryRegistered |
| GetInventoryData | getCustomInventoryData |
| SetInventoryData | updateCustomInventoryData |
| OpenInventory | openInventory |
| CloseInventory | closeInventory |
| OpenPlayerInventory | openPlayerInventory |
| GetInventorySlots | getCustomInventorySlots |
| SetInventorySlots | updateCustomInventorySlots |
| SetInventoryItemLimit | setCustomInventoryItemLimit |
| SetInventoryWeaponLimit | setCustomInventoryWeaponLimit |
| BlacklistInventoryItem | BlackListCustomAny |
| AddInventoryMovePermission | AddPermissionMoveToCustom |
| AddInventoryTakePermission | AddPermissionTakeFromCustom |
| AddInventoryCharMovePermission | AddCharIdPermissionMoveToCustom |
| AddInventoryCharTakePermission | AddCharIdPermissionTakeFromCustom |
| GetInventoryItems | getCustomInventoryItems |
| GetInventoryItemCount | getCustomInventoryItemCount |
| AddItemsToInventory | addItemsToCustomInventory |
| RemoveItemFromInventory | removeItemFromCustomInventory |
| UpdateInventoryItem | updateCustomInventoryItem |
| GetInventoryWeapons | getCustomInventoryWeapons |
| GetInventoryWeaponCount | getCustomInventoryWeaponCount |
| AddWeaponsToInventory | addWeaponsToCustomInventory |
| RemoveWeaponFromInventory | removeWeaponFromCustomInventory |
| RemoveInventoryWeaponById | removeCustomInventoryWeaponById |
- Real RSG inventory adapter (
rsg-inventoryexport signatures need to be verified — possibly different from VORP). - New categories (banking, housing, ...) as new adapter files following the
same pattern:
client/adapters/cl_<framework>_<category>.lua+server/adapters/sv_<framework>_<category>.lua, registered insh_framework.lua/cl_main.lua/sv_main.lua.
MIT — free to use in any project. See LICENSE.
Discord: https://discord.gg/T5T5ZsGEsU