πŸ‘€Player Object

The NovaPlayer object represents a connected player and provides methods to manage their data.

Getting a Player

-- Server-side
local player = Nova.Functions.GetPlayer(source)
-- or
local player = exports['nova_core']:GetPlayer(source)

Properties

Property
Type
Description

source

number

FiveM server ID

identifier

string

Unique license identifier

charId

number

Character ID in database

name

string

First name

lastname

string

Last name

fullname

string

First + Last name

dob

string

Date of birth

nationality

string

Nationality

gender

number

0 = male, 1 = female

money

number

Cash on hand

bank

number

Bank balance

job

string

Job name

jobGrade

number

Job grade level

jobLabel

string

Job display name

group

string

Admin group

Methods

Economy

player:GetMoney()

Returns the player's cash amount.

player:GetBank()

Returns the player's bank balance.

player:AddMoney(amount)

Adds cash to the player.

Parameter
Type
Description

amount

number

Amount to add

player:RemoveMoney(amount)

Removes cash from the player. Returns false if insufficient funds.

player:AddBank(amount)

Adds money to the player's bank account.

player:RemoveBank(amount)

Removes money from the player's bank account.

player:SetMoney(amount)

Sets the player's cash to an exact amount.

player:SetBank(amount)

Sets the player's bank balance to an exact amount.

Inventory

player:GetInventory()

Returns the player's full inventory table.

player:AddItem(name, count)

Adds items to the player's inventory.

Parameter
Type
Description

name

string

Item name from config

count

number

Amount to add

player:RemoveItem(name, count)

Removes items from the player's inventory.

player:HasItem(name, returnCount)

Checks if the player has an item. Returns boolean or count.

player:GetItem(name)

Gets a specific item's data from inventory.

Job

player:GetJob()

Returns the player's job information.

player:SetJob(name, grade)

Sets the player's job.

Parameter
Type
Description

name

string

Job name from config

grade

number

Job grade level

Groups & Permissions

player:GetGroup()

Returns the player's admin group.

player:SetGroup(group)

Sets the player's admin group.

player:HasPermission(node)

Checks if the player has a specific permission. Uses O(1) cached lookup.

Status

player:GetHunger()

Returns hunger level (0-100).

player:GetThirst()

Returns thirst level (0-100).

player:SetHunger(value)

Sets hunger level.

player:SetThirst(value)

Sets thirst level.

Persistence

player:Save()

Saves all player data to the database immediately.

::: info Player data is automatically saved every Config.AutoSaveInterval seconds and on disconnect. :::

Last updated