For the complete documentation index, see llms.txt. This page is also available as Markdown.

Helpers

What they are

Helpers is a global server-side table defined in configs/s.helpers.lua. It wraps common framework operations (jobs, items, money, identifiers, admin) so your handlers don't have to deal with framework-specific code.

These are NOT exports β€” they're globals available inside Config.UnlockHandlerForSkills, Config.CategoryVisibilityHandler, Config.PremiumCurrency.handler, and any other server-side config hook.

The underlying framework calls (Core.GetJob, Core.GetItemCount, etc.) are provided by devhub_lib β€” so as long as devhub_lib is configured for your framework, all helpers work the same way regardless of whether you use ESX, QBCore, or a custom core.


Functions

Helpers.CheckJob(source, job, grade)

Check if a player has a specific job, optionally with a minimum grade.

Parameters:

  • source (number): Player server ID

  • job (string): Job name (e.g. 'police')

  • grade (number | nil): Minimum grade required (optional)

Returns: boolean

if Helpers.CheckJob(source, 'police', 2) then
    -- player is at least a grade 2 police officer
end

Helpers.HasItem(source, item, amount)

Check if the player has at least amount of an item in their inventory.

Parameters:

  • source (number): Player server ID

  • item (string): Item name

  • amount (number | nil): Amount required (defaults to 1)

Returns: boolean


Helpers.CheckIdentifier(source, identifier)

Check if the player's identifier matches an exact value.

Parameters:

  • source (number): Player server ID

  • identifier (string): Identifier to match (e.g. 'license:abc...')

Returns: boolean


Helpers.IsAdmin(source)

Convenience wrapper for Core.IsPlayerAdmin(source).

Returns: boolean


Helpers.HasEnoughMoney(source, amount)

Check if the player has at least amount cash on hand.

Parameters:

  • source (number): Player server ID

  • amount (number): Required amount of cash

Returns: boolean


Helpers.CheckUnlockedSkill(source, categoryUid, skillUid)

Check if a specific skill is already unlocked. Useful for chaining unlocks (require a previous skill).

Parameters:

  • source (number): Player server ID

  • categoryUid (string): Category UID

  • skillUid (string): Skill UID

Returns: boolean


Helpers.RemoveItem(source, item, amount)

Remove an item from the player's inventory.

Parameters:

  • source (number): Player server ID

  • item (string): Item name

  • amount (number | nil): Amount to remove (defaults to 1)


Helpers.RemoveMoney(source, amount)

Remove cash from the player.

Parameters:

  • source (number): Player server ID

  • amount (number): Amount of cash to remove


Example β€” combined unlock requirement

A skill that requires the player to be a grade 2+ police officer, hold an energy drink, and pay $500 in cash:


Example β€” premium currency handler

The same helpers can power a premium currency handler that uses regular cash as the "premium" payment:

Last updated