Events#
This event is triggered when a player has successfully selected a character and joined the server. It provides an opportunity to execute custom logic or initialize player-specific data based on the chosen character. The event is fired on both the client and server side.
Client Side
RegisterNetEvent("jrs:SelectedCharacter", function(charid)
print(charid)
end)Server Side
AddEventHandler("jrs:SelectedCharacter", function(source, character)
print(character)
end)For new code prefer jrs_core:server:characterReady / jrs_core:client:characterReady, see the core page.
Exports#
Exports to be used in your scripts. All of them live in jrs_core.
Server Side
GetAppearanceForSource#
Returns the saved appearance (skin, clothes, tints) of the character a player is using.
sourcenumberrequiredThe player source.
returntableThe appearance data.
local look = exports.jrs_core:GetAppearanceForSource(source)GetAppearance#
Same as above but by character id, works for offline characters.
local look = exports.jrs_core:GetAppearance(charId)SaveAppearance#
characterIdnumberrequiredThe character id.
datatablerequiredThe appearance data to store.
exports.jrs_core:SaveAppearance(charId, look)RegisterCharacterDeleteHook#
Run your own cleanup when a character is deleted (for example remove its house or horses).
exports.jrs_core:RegisterCharacterDeleteHook('myscript', function(charId, identifier, phase)
MySQL.update('DELETE FROM my_table WHERE charid = ?', { charId })
end)RegisterCharacterStarterHook#
Give something to every newly created character.
exports.jrs_core:RegisterCharacterStarterHook('myscript', function(source, characterId)
exports.jrs_inventory:addItem(source, 'bread', 2)
end)GetCharacterCount / GetMaxCharacters / CanCreateCharacter#
local count = exports.jrs_core:GetCharacterCount(source)
local max = exports.jrs_core:GetMaxCharacters(source)
if exports.jrs_core:CanCreateCharacter(source) then endStateBags#
Check if the player is in a session (selected a character):
LocalPlayer.state.IsInSessionRead the character data from the state (client and server):
LocalPlayer.state.Character.Job
Player(source).state.Character.Money