The JRS lib is a set of plain helper functions that used to ship as a separate jrs_lib resource. It now lives inside jrs_core (client/lib.lua, client/lib_exports.lua and server/lib.lua), and jrs_core still answers to the old name through provide 'jrs_lib'. Call one of the exports below to get the helper table for your side, then call functions on it.
Getting The Helpers#
exports.jrs_core:jrs_lib()Builds and returns the client helper table. The name matches the old resource, so a script written for it only needs the resource name changed.
local lib = exports.jrs_core:jrs_lib()
local hours, minutes = lib.getTime()
print(('In-game time %02d:%02d'):format(hours, minutes))exports.jrs_core:getLibApi()Same table as jrs_lib(), under a clearer name. Pick either one; they are built by the same function.
local lib = exports.jrs_core:getLibApi()TriggerEvent('jrs_lib:getApi', function(lib) ... end)Hands the full client helper table to your callback. This copy also carries getFolder and fpsTimer, which the export does not include.
local lib
TriggerEvent('jrs_lib:getApi', function(api) lib = api end)
print(lib.getFolder())| Argument | Type | Meaning |
|---|---|---|
cb | function | Called right away with the helper table. |
exports.jrs_core:getLibServerApi()Returns the server helper table: player info, item registration, notifications and Discord logging.
local libServer = exports.jrs_core:getLibServerApi()
print(libServer.getFramework()) -- "jrs_core"TriggerEvent('jrs_lib:getApi', function(lib) ... end)Server version of the same event. Your callback receives the same table as getLibServerApi().
local libServer
TriggerEvent('jrs_lib:getApi', function(api) libServer = api end)| Argument | Type | Meaning |
|---|---|---|
cb | function | Called right away with the server helper table. |
Settings#
All lib options sit under Config.Lib in jrs_core/config/lib.lua.
| Key | Default | What it changes |
|---|---|---|
FolderWithIcons |
'jrs_inventory/html/images/items/' |
Where the fallback notification loads item icons from. |
EnableDevCommands |
true |
Registers the two developer commands listed at the bottom of this page. |
PolyPointCommand |
'polyPoint' |
Name of the polygon tracing command. Empty string turns it off. |
TargetCommand |
'target' |
Name of the aim debug command. Empty string turns it off. |
CharacterTable |
'Characters' |
Value returned by the server helper CharacterTable(). |
JobColumn |
'job' |
Value returned by JobColumn(). |
JobGradeColumn |
'jobgrade' |
Value returned by JobGradeColumn(). |
SteamColumn |
'identifier' |
Value returned by SteamColumn(). |
CharIdColumn |
'charidentifier' |
Value returned by CharIdColumn(). |
Prompt Groups#
Prompts are keyed by their text plus the group id you pass in, so the same text can live in two groups. A group stays on screen while it is switched on with showPrompt. When the player completes a button, the lib disables that button and fires the event you attached to it, so turn it back on with setPromptEnable when you are ready for the next press.
lib.createPrompt(text, key, promptHash, holdMode, event)Registers one button inside a prompt group. Calling it again with the same text and group does nothing, so it is safe inside a loop.
local lib = exports.jrs_core:jrs_lib()
local group = GetRandomIntInRange(0, 0xffffff)
lib.createPrompt('Open shop', 0xC7B5340A, group, 'SHORT_TIMED_EVENT', 'myshop:open')
lib.showPrompt('General Store', group, true)
AddEventHandler('myshop:open', function()
-- open your menu here, then allow the next press
lib.setPromptEnable('Open shop', group, true)
end)| Argument | Type | Meaning |
|---|---|---|
text | string | Label shown on the button. |
key | number | Control hash, for example 0xC7B5340A for Enter. |
promptHash | number | Group id the button belongs to. Any number you pick works, such as GetRandomIntInRange(0, 0xffffff). |
holdMode | string|false | false for a tap, or a hold timing name such as 'SHORT_TIMED_EVENT', 'MEDIUM_TIMED_EVENT' or 'LONG_TIMED_EVENT'. |
event | string | Client event fired with TriggerEvent when the button is completed. |
lib.showPrompt(name, prompt, show)Turns a whole group on or off. While it is on, a background loop draws the group every frame with name as its title and listens for presses.
local lib = exports.jrs_core:jrs_lib()
local inside = lib.playerNearCoords(-322.2, 803.9, 117.9, 2.0)
lib.showPrompt('General Store', group, inside)| Argument | Type | Meaning |
|---|---|---|
name | string | Group title shown above the buttons. |
prompt | number | Group id used in createPrompt. |
show | boolean | false hides the group. Any other value shows it. |
lib.getPrompt(promptHash, text)Draws a group for the current frame only. Use it when you run your own loop instead of showPrompt.
CreateThread(function()
while nearBench do
lib.getPrompt(group, 'Workbench')
if lib.getPromptButton('Craft', group) then
TriggerServerEvent('mycraft:start')
end
Wait(0)
end
end)| Argument | Type | Meaning |
|---|---|---|
promptHash | number | Group id. |
text | string | Group title for this frame. |
lib.getPromptButton(text, promptHash)Checks whether the player has finished holding a button. On success it also resets the hold so the next check starts clean.
if lib.getPromptButton('Craft', group) then
print('crafting started')
end| Argument | Type | Meaning |
|---|---|---|
text | string | Button text used in createPrompt. |
promptHash | number | Group id. |
true on the frame the hold completed.lib.getPromptButtonData(text, promptHash)Gives you the raw prompt handle so you can call prompt natives on it yourself.
local handle = lib.getPromptButtonData('Craft', group)
if handle then PromptSetPriority(handle, 2) end| Argument | Type | Meaning |
|---|---|---|
text | string | Button text. |
promptHash | number | Group id. |
lib.setPromptVisible(text, hash, state)Hides or shows a single button while the rest of its group stays on screen.
lib.setPromptVisible('Sell', group, playerHasItems)| Argument | Type | Meaning |
|---|---|---|
text | string | Button text. |
hash | number | Group id. |
state | boolean | true to show the button. |
lib.setPromptEnable(text, hash, state)Greys a button out or makes it usable again. You need this after every completed press, because the lib disables the button before firing its event.
lib.setPromptEnable('Open shop', group, true)| Argument | Type | Meaning |
|---|---|---|
text | string | Button text. |
hash | number | Group id. |
state | boolean | true to allow presses. |
lib.promptDelete(text, promptHash)Removes one button. When the last button of a group is gone, the group is switched off as well.
AddEventHandler('onResourceStop', function(name)
if name ~= GetCurrentResourceName() then return end
lib.promptDelete('Open shop', group)
end)| Argument | Type | Meaning |
|---|---|---|
text | string | Button text. |
promptHash | number | Group id. |
Peds Vehicles And Blips#
lib.createPed(model, x, y, z, h, dist, scenario)Adds a local, frozen, invincible ped to a pool. The ped spawns when the player comes within dist and is removed again when they leave, checked once per second. Every ped in the pool is cleaned up when jrs_core stops.
lib.createPed('U_M_M_VALGENSTOREOWNER_01', -324.1, 803.6, 116.9, 280.0, 40.0, 'WORLD_HUMAN_STAND_WAITING')| Argument | Type | Meaning |
|---|---|---|
model | string | Ped model name. |
x | number | X position. |
y | number | Y position. |
z | number | Z position. |
h | number | Heading. |
dist | number | Spawn and despawn range in metres. |
scenario | string | Scenario name to play in place, such as 'WORLD_HUMAN_SMOKE'. |
lib.getLastPed()Returns the handle of the most recent ped the pool spawned.
local ped = lib.getLastPed()
if ped and DoesEntityExist(ped) then SetPedScale(ped, 1.05) endlib.createVehicle(model, x, y, z, h)Loads the model, spawns a networked vehicle, places it on the ground and marks it as a mission entity. It waits until the vehicle exists, so call it from a thread.
CreateThread(function()
lib.createVehicle('wagon02x', -280.4, 780.2, 118.5, 10.0)
local wagon = lib.getLastVehicle()
SetVehicleDoorsLocked(wagon, 1)
end)| Argument | Type | Meaning |
|---|---|---|
model | string | Vehicle model name. |
x | number | X position. |
y | number | Y position. |
z | number | Z position. |
h | number | Heading. |
lib.getLastVehicle()Returns the vehicle made by the latest createVehicle call.
local wagon = lib.getLastVehicle()lib.createBlip(text, x, y, z, sprite)Puts a half-size map blip at a position. Blips made here are removed when jrs_core stops.
lib.createBlip('Fishing spot', -1340.6, -1270.2, 40.3, 1595002520)| Argument | Type | Meaning |
|---|---|---|
text | string | Blip name shown on the map. |
x | number | X position. |
y | number | Y position. |
z | number | Z position. |
sprite | number | Blip sprite hash. |
lib.deleteObj(obj)Deletes an object. For networked objects it asks for control first and gives up after about one second.
lib.deleteObj(campfire)| Argument | Type | Meaning |
|---|---|---|
obj | number | Entity handle. |
lib.deletePed(obj)Same as deleteObj but uses DeletePed, which is the right call for peds.
lib.deletePed(guard)| Argument | Type | Meaning |
|---|---|---|
obj | number | Ped handle. |
lib.playAnim(entity, dict, anim, flag, time)Loads an animation dictionary and plays one clip on an entity. It waits for the dictionary, so run it in a thread.
lib.playAnim(PlayerPedId(), 'mech_inventory@crafting@fallbacks', 'full_craft_and_stow', 1, 4000)| Argument | Type | Meaning |
|---|---|---|
entity | number | Ped to animate. |
dict | string | Animation dictionary. |
anim | string | Clip name. |
flag | number | Animation flag. |
time | number | Duration in ms, -1 to loop. |
lib.getAllPeds()Lists every ped the client knows about.
print(('%d peds nearby'):format(#lib.getAllPeds()))lib.getAllEntities()Lists every object the client knows about. Despite the name it only covers objects, not peds or vehicles.
for _, obj in ipairs(lib.getAllEntities()) do
if GetEntityModel(obj) == `p_campfire01x` then print('fire at', GetEntityCoords(obj)) end
endlib.getAllVehicles()Lists every vehicle the client knows about.
local wagons = lib.getAllVehicles()Distance And Position#
lib.playerNearCoords(x, y, z, dist, mark)Tells you if the local player is close to a spot while on foot and alive. Riding a horse or sitting in a vehicle counts as not near.
if lib.playerNearCoords(-322.2, 803.9, 117.9, 1.5, true) then
lib.drawMe(-322.2, 803.9, 118.4, 'Store counter', 3.0)
end| Argument | Type | Meaning |
|---|---|---|
x | number | X position. |
y | number | Y position. |
z | number | Z position. |
dist | number | Range in metres. |
mark | boolean | Draws a ground ring of the same size while the player is inside. |
true when the player is in range.lib.checkPlayersNearEntity(entity, distance)Checks if any other player stands near an entity. The local player is ignored. Handy before spawning or deleting something others might see.
if not lib.checkPlayersNearEntity(crate, 30.0) then lib.deleteObj(crate) end| Argument | Type | Meaning |
|---|---|---|
entity | number | Entity to measure from. |
distance | number | Range in metres. |
true if another player is in range.lib.groundCheck(x, y)Searches upward from height 1 to 1000 for the ground at a map position. The area must be loaded for a hit.
local z = lib.groundCheck(-280.0, 790.0)| Argument | Type | Meaning |
|---|---|---|
x | number | X position. |
y | number | Y position. |
0.0 when nothing was found.lib.getTarget()Returns what the gameplay camera is looking at, up to 5 metres away. The ray only runs while something asks for it, so call it every frame or so while you need it. The first call after a pause may return old values.
local hitPos, hitEntity = lib.getTarget()
if hitEntity ~= 0 and IsEntityAPed(hitEntity) then
lib.drawMe(hitPos.x, hitPos.y, hitPos.z + 0.3, 'Talk', 5.0)
endlib.drawMe(x, y, z, text, dist, marker)Draws a small 3D text label at a world position when the player is within dist. Call it every frame.
CreateThread(function()
while true do
lib.drawMe(-322.2, 803.9, 118.4, 'Press Enter to shop', 3.0, true)
Wait(0)
end
end)| Argument | Type | Meaning |
|---|---|---|
x | number | X position. |
y | number | Y position. |
z | number | Z position. |
text | string | Text to show. |
dist | number | Max distance to draw at. |
marker | any | Any value also draws a small ground ring under the text. |
lib.IsPlayerInsidePolygon(playerPos, polyPoints, debug, issmall)Tests a position against a flat polygon (height is ignored). Use /polyPoint to record the corners in game.
local farm = {
vector3(-850.1, -1290.4, 43.5),
vector3(-830.7, -1290.0, 43.5),
vector3(-830.2, -1270.8, 43.6),
vector3(-851.0, -1271.3, 43.6),
}
if lib.IsPlayerInsidePolygon(GetEntityCoords(PlayerPedId()), farm) then
print('on the farm')
end| Argument | Type | Meaning |
|---|---|---|
playerPos | vector3 | Position to test. |
polyPoints | table | Array of vector3 corners in order. |
debug | boolean | Draws numbered posts at each corner. |
issmall | boolean | Draws thin posts instead. |
true when the position is inside.lib.calculatePolygonLength(polyPoints)Adds up the length of every edge, including the edge from the last corner back to the first.
print('fence needed: ' .. lib.calculatePolygonLength(farm) .. ' m')| Argument | Type | Meaning |
|---|---|---|
polyPoints | table | Array of vector3 corners. |
lib.getPlayers()Lists the server ids of active players in client slots 0 to 32.
for _, id in ipairs(lib.getPlayers()) do print(id) endlib.getTime()Reads the in-game clock.
local h = lib.getTime()
if h >= 22 or h < 5 then print('store closed') endlib.fpsTimer()Picks a short wait time from the current frame rate: lower FPS gives a longer wait. Only in the table from the jrs_lib:getApi event.
Wait(lib.fpsTimer())Dialogs And Notices#
lib.notify(title, text, icon, duration)Shows a notice to the local player. It goes through jrsCore:notify, so it uses the unified JRS toast when that is loaded and the lib's own popup otherwise.
lib.notify('Fishing', 'You caught a bass.', 'bass', 4000)| Argument | Type | Meaning |
|---|---|---|
title | string | Heading. |
text | string | Body text. |
icon | string | Item image name, loaded from Config.Lib.FolderWithIcons in the fallback popup. |
duration | number | Time on screen in ms, 3000 when left out. |
lib.getInput(title, subtext, cb)Opens a one-line text box with mouse focus and waits for the player. It blocks the calling thread until they answer.
lib.getInput('Letters only', 'Name your horse', function(value)
if value == 'close' or value == '' then return end
TriggerServerEvent('mystable:rename', value)
end)| Argument | Type | Meaning |
|---|---|---|
title | string | Small hint text. |
subtext | string | Main heading of the box. |
cb | function | Receives the typed text, or the string 'close' if the player closed the box. |
lib.getAnswer(title, first, second, cb)Opens a two-button question and waits for a choice. Blocks the calling thread like getInput.
lib.getAnswer('Sell this wagon for $40?', 'Sell', 'Keep', function(yes)
if yes then TriggerServerEvent('mywagon:sell') end
end)| Argument | Type | Meaning |
|---|---|---|
title | string | Question text. |
first | string | Label of the yes button. |
second | string | Label of the no button. |
cb | function | Receives true for the first button and false for the second. |
lib.getFolder()Returns the icon folder from Config.Lib.FolderWithIcons. Only in the table from the jrs_lib:getApi event.
local img = 'nui://' .. lib.getFolder() .. 'bread.png''jrs_inventory/html/images/items/'.TriggerClientEvent('jrsCore:notify', source, title, text, icon, duration)The event behind every lib notice. Fire it from the server to reach one player, or with TriggerEvent on the client.
TriggerClientEvent('jrsCore:notify', source, 'Bank', 'Your loan was paid off.', nil, 5000)| Argument | Type | Meaning |
|---|---|---|
title | string | Heading. |
text | string | Body text. |
icon | string | Item image name. |
duration | number | Time on screen in ms. |
TriggerEvent('jrs_lib:createStash', id, size)Legacy stash event kept from the old resource. It forwards to stash events from another inventory style.
Nothing in JRS Core handles the events this one forwards to, so it opens nothing. Use the server helpers createStorage and openStorage on the player object instead.
| Argument | Type | Meaning |
|---|---|---|
id | string | Stash id. |
size | number | Weight limit, multiplied by 1000. |
TriggerEvent('jrs_lib:openStash', id, size)Second legacy stash event, with the same limits as jrs_lib:createStash.
| Argument | Type | Meaning |
|---|---|---|
id | string | Stash id. |
size | number | Weight limit, multiplied by 1000. |
Server Helpers#
Get this table with exports.jrs_core:getLibServerApi(). Inventory calls are passed to jrs_inventory once it is started; before that they quietly do nothing.
libServer.getInformation(source, cb)Builds a player object for one online player and passes it to your callback. The object wraps the active character and jrs_inventory in short method names, listed in the next section.
local libServer = exports.jrs_core:getLibServerApi()
RegisterNetEvent('myshop:buyBread', function()
local src = source
libServer.getInformation(src, function(player)
if not player then return end
if player.getMoney() < 2 then
libServer.notify(src, 'Store', 'Not enough cash.')
return
end
player.removeMoney(2)
player.addItem('bread', 1)
end)
end)| Argument | Type | Meaning |
|---|---|---|
source | number | Player server id. |
cb | function | Receives the player object, or nil when the player has no loaded user. |
libServer.registerItem(itemId, callback)Makes an item usable by passing it to jrs_inventory's RegisterUsableItem.
libServer.registerItem('canteen', function(data)
TriggerClientEvent('mythirst:drink', data.source)
end)| Argument | Type | Meaning |
|---|---|---|
itemId | string | Item name. |
callback | function | Runs when a player uses the item. It receives the data jrs_inventory sends. |
false when jrs_inventory is not started yet.libServer.notify(source, title, message, image, time)Sends a jrsCore:notify notice to one player.
libServer.notify(source, 'Sheriff', 'Your fine was paid.', nil, 4000)| Argument | Type | Meaning |
|---|---|---|
source | number | Player server id. |
title | string | Heading. |
message | string | Body text. |
image | string | Item image name. |
time | number | Time on screen in ms. |
libServer.sendDiscordMessage(webhookLink, title, description, color, steamHex, charIdentifier, firstName, lastName)Posts an embed to a Discord webhook with two side fields: Steam id plus character id, and first plus last name.
libServer.sendDiscordMessage(GetConvar('myshop_webhook', ''), 'Wagon sold',
{ 'Model: wagon02x', 'Price: $40' }, 15105570,
player.getSteamIdentifier(), player.getCharIdentifier(),
player.getFirstname(), player.getLastname())| Argument | Type | Meaning |
|---|---|---|
webhookLink | string | Webhook URL. |
title | string | Embed title. |
description | string|table | Body text, or an array of lines joined with new lines. |
color | number | Embed colour as a decimal number. |
steamHex | string | Steam identifier. The steam: prefix is cut off. |
charIdentifier | number | Character id. |
firstName | string | Character first name. |
lastName | string | Character last name. |
libServer.getFramework()Lets shared scripts confirm which core they run on.
if libServer.getFramework() == 'jrs_core' then print('running on JRS') end'jrs_core'.libServer.CharacterTable()Reads Config.Lib.CharacterTable. Scripts that build their own SQL can use these five readers instead of hard-coding names.
'Characters'.libServer.JobColumn()Reads Config.Lib.JobColumn.
'job'.libServer.JobGradeColumn()Reads Config.Lib.JobGradeColumn.
'jobgrade'.libServer.SteamColumn()Reads Config.Lib.SteamColumn.
'identifier'.libServer.CharIdColumn()Reads Config.Lib.CharIdColumn.
local sql = ('SELECT %s FROM %s WHERE %s = ?'):format(
libServer.JobColumn(), libServer.CharacterTable(), libServer.CharIdColumn())'charidentifier'.Player Object#
Everything below is a method on the object passed to the getInformation callback. Methods take no source, because the object already knows its player. Values such as money are read from the character when you call the getter.
Character Data#
player.getGroup()Reads the staff group of the user account.
'user' or 'admin'.player.getFirstname()Reads the character first name.
player.getLastname()Reads the character last name.
player.getSteamIdentifier()Reads the account identifier saved on the character.
'steam:110000112345678'.player.getCharIdentifier()Reads the database id of the active character.
player.getJob()Reads the active job name.
'unemployed' when none.player.getGrade()Reads the job grade from the jobGrade field of the character.
Character rows store the grade as jobgrade (lower case), so this can return nil. If it does, read the grade through the core object from exports.jrs_core:GetCore().
player.setJob(job, grade, arg)Changes the active job and grade through the core character setJob. The third value is passed along but the core ignores it.
player.setJob('sheriff', 1)| Argument | Type | Meaning |
|---|---|---|
job | string | Job name. |
grade | number | Grade. |
arg | any | Unused. |
player.setGrade(amount)Meant to change only the job grade.
The character object in jrs_core has no setJobGrade method, so this call throws an error. Use player.setJob(player.getJob(), grade) instead.
| Argument | Type | Meaning |
|---|---|---|
amount | number | New grade. |
player.chanceSkin(skin)Saves a full clothing set for the character through jrs_clothing and reloads it on the player. The name is kept from the old resource.
player.chanceSkin({ Hat = 0x1A2B3C4D, Coat = 0x5E6F7A8B })| Argument | Type | Meaning |
|---|---|---|
skin | table|string | Clothing table, or the same as a JSON string. |
true when jrs_clothing saved it; false if jrs_clothing is not started.Money#
player.getMoney()Reads the cash balance.
player.addMoney(amount)Gives cash.
player.addMoney(12.5)| Argument | Type | Meaning |
|---|---|---|
amount | number | Amount to add. |
player.removeMoney(amount)Takes cash. Check getMoney() first; this does not check the balance for you.
| Argument | Type | Meaning |
|---|---|---|
amount | number | Amount to take. |
player.getGold()Reads the gold balance.
player.addGold(amount)Gives gold.
| Argument | Type | Meaning |
|---|---|---|
amount | number | Amount to add. |
player.removeGold(amount)Takes gold.
if player.getGold() >= 5 then player.removeGold(5) end| Argument | Type | Meaning |
|---|---|---|
amount | number | Amount to take. |
Items And Weapons#
player.getCountItem(id)Counts how many of an item the player holds.
if player.getCountItem('pickaxe') == 0 then return end| Argument | Type | Meaning |
|---|---|---|
id | string | Item name. |
player.addItem(id, amount, metadata)Gives an item through jrs_inventory.
player.addItem('letter', 1, { description = 'Sealed letter for the mayor' })| Argument | Type | Meaning |
|---|---|---|
id | string | Item name. |
amount | number | How many. |
metadata | table | Extra data saved on the item. |
player.removeItem(id, amount)Takes items by name.
| Argument | Type | Meaning |
|---|---|---|
id | string | Item name. |
amount | number | How many. |
player.removeItemId(id, amount)Takes items from one exact stack by its inventory id, which matters when stacks carry different metadata.
| Argument | Type | Meaning |
|---|---|---|
id | number | Inventory item id. |
amount | number | How many. |
player.canCarryItem(id, count)Asks jrs_inventory whether the item fits.
if player.canCarryItem('coal', 10) then player.addItem('coal', 10) end| Argument | Type | Meaning |
|---|---|---|
id | string | Item name. |
count | number | How many. |
true when there is room.player.canCarryWeapon(_, count)Asks jrs_inventory whether more weapons fit. The first argument is ignored.
| Argument | Type | Meaning |
|---|---|---|
_ | any | Unused, pass nil. |
count | number | Number of weapons. |
true when there is room.player.createWeapon(weapon, ammo)Creates a new weapon in the player's inventory.
if player.canCarryWeapon(nil, 1) then
player.createWeapon('WEAPON_REVOLVER_CATTLEMAN', { AMMO_REVOLVER = 12 })
end| Argument | Type | Meaning |
|---|---|---|
weapon | string | Weapon name such as 'WEAPON_REVOLVER_CATTLEMAN'. |
ammo | table | Starting ammo, passed straight to jrs_inventory. |
player.giveWeapon(id, playerId)Moves an existing weapon to a player.
| Argument | Type | Meaning |
|---|---|---|
id | number | Weapon id. |
playerId | number | Server id of the receiver. |
player.getInventory()Returns the player's items from jrs_inventory.
for _, item in pairs(player.getInventory()) do print(item.name, item.count) endplayer.getItemNames()Reads every row of the jrs_items table. The query runs async and the method waits only 100 ms, so on a slow database it may return an empty table.
jrs_items.player.getMetadata(id)Meant to read one metadata key from the last item the player used.
It relies on getLastUsedID, which the current jrs_inventory does not provide, so the call fails. Read metadata from the data your usable item callback receives instead.
| Argument | Type | Meaning |
|---|---|---|
id | string | Metadata key. |
player.closeInv()Closes the inventory screen on the player's client.
Storage And Logs#
player.createStorage(id, size)Registers a storage container in jrs_inventory for this player.
player.createStorage('cabin_' .. player.getCharIdentifier(), 100)
player.openStorage('cabin_' .. player.getCharIdentifier(), 'Cabin chest')| Argument | Type | Meaning |
|---|---|---|
id | string | Storage id. |
size | number | Storage size limit. |
player.openStorage(id, label)Opens a registered storage on the player's screen.
| Argument | Type | Meaning |
|---|---|---|
id | string | Storage id. |
label | string | Title shown on the window. |
player.updateStorage(id, size)Changes the size of a registered storage, for example after an upgrade.
| Argument | Type | Meaning |
|---|---|---|
id | string | Storage id. |
size | number | New size limit. |
player.discord(webhookLink, title, description, color, steamHex, charIdentifier, firstName, lastName)Same as sendDiscordMessage, reachable from the player object. You still pass the player fields yourself.
| Argument | Type | Meaning |
|---|---|---|
webhookLink | string | Webhook URL. |
title | string | Embed title. |
description | string|table | Body text or lines. |
color | number | Embed colour. |
steamHex | string | Steam identifier. |
charIdentifier | number | Character id. |
firstName | string | First name. |
lastName | string | Last name. |
Developer Commands#
Both commands are client side and are registered while Config.Lib.EnableDevCommands is on.
| Command | What it does |
|---|---|
/polyPoint |
Starts tracing a polygon at your feet. Press the bound key to add a corner where you stand; the corner list is copied through the NUI. Run it again to stop and clear. |
/target |
Toggles a dot that shows where the camera ray ends, the same ray getTarget reads. |