Skip to main content
Server Built in your resource. No extra export call. 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:
Both lines below do the same thing:

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. Call Get again for fresh fields, such as characterId after a character change.
  • Modules. A method of a disabled module raises UgCore.Jobs belongs to disabled module "jobs". Enable it in config/modules.lua. Check UgCore.Modules.IsEnabled first for optional modules.
  • Dropped players. Methods keep working on a stale object and return what the module returns for an unknown player, usually not_found or not_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. See UgCore.Players.

Identity

Always available. See UgCore.Identity.

Permissions

Always available. See UgCore.Permissions.

Characters

Needs the characters module. See UgCore.Characters.

Money

Needs the accounts module. See UgCore.Accounts.

Job

Needs the jobs module. See UgCore.Jobs.

Gang

Needs the gangs module. See UgCore.Gangs.

Session

Needs the sessions 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.