UgCore.Players.Get, GetAll, GetByIdentifier and GetByCharacterId return UgPlayer objects. Each method is a shortcut to a module function with the player’s source filled in:
How it behaves
- Same results. A method returns exactly what the function it calls returns, including error codes. It validates and raises the same way.
- Live methods, snapshot fields. Fields are copied when you call
Get. Methods always act on the live player. CallGetagain for fresh fields, such ascharacterIdafter a character change. - Modules. A method of a disabled module raises
UgCore.Jobs belongs to disabled module "jobs". Enable it in config/modules.lua.CheckUgCore.Modules.IsEnabledfirst for optional modules. - Dropped players. Methods keep working on a stale object and return what the module returns for an unknown player, usually
not_foundornot_loaded.player:IsOnline()tells you. - Threads. Methods that touch the database MUST run in a thread, like the functions they call. They are marked below.
Fields
Methods
Player
Always available. SeeUgCore.Players.
Identity
Always available. SeeUgCore.Identity.
Permissions
Always available. SeeUgCore.Permissions.
Characters
Needs thecharacters module. See UgCore.Characters.
Money
Needs theaccounts module. See UgCore.Accounts.
Job
Needs thejobs module. See UgCore.Jobs.
Gang
Needs thegangs module. See UgCore.Gangs.
Session
Needs thesessions module. See UgCore.Sessions.
Security and network
Always available.Example
A paycheck loop for on-duty players:server.lua
Groups are FiveM ACE principals, not a ug-core feature. Check them with
player:HasPermission, after you give the group the permission in server.cfg, such as add_ace group.admin my-shop.manage allow.