Without this module, players are loaded as soon as they join, and
accounts, jobs and gangs cannot be enabled.GetAll
Create
invalid_args instead of raising, since it usually comes from a player. New characters get the starting balances of every account.
Load
ug-core:Loaded becomes true, and ug-core:Players:Loaded fires.
Unload
Delete
ug_characters. The loaded character cannot be deleted.
GetActive
UgCore.Players.Get(source).characterId or the ug-core:Player statebag when you only need the id.
GetPosition
vector4 (x, y, z, heading), or nil before the first save. MUST run in a thread.
- The position is read from the ped on the server, never from the client.
- It is saved on unload, disconnect and resource stop, and every
positionIntervalms while playing. - A ped at the map origin has not spawned yet: the saved position is kept.
persistPosition = falseinconfig/characters.luastops saving.
Errors
Events
Unloaded also fires when the player drops.
Hooks
Statebags
The loaded character id is inUgCore.Enums.StateBags.Player as characterId. See Players.