> For the complete documentation index, see [llms.txt](https://zloma-scripts.gitbook.io/zloma-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zloma-scripts.gitbook.io/zloma-scripts/zloma_core-free/api-reference/server-exports.md).

# Server Exports

All server exports are called via `exports['zloma_core']`.

***

## Framework

### GetPlayer

Returns the raw framework player object.

```lua
local player = exports['zloma_core']:GetPlayer(source)
```

| Param       | Type       | Description                                         |
| ----------- | ---------- | --------------------------------------------------- |
| source      | number     | Player server ID                                    |
| **Returns** | object/nil | xPlayer (ESX) or Player (QB/QBox), nil if not found |

***

### GetPlayerMoney

```lua
local amount = exports['zloma_core']:GetPlayerMoney(source, account)
```

| Param       | Type   | Description                            |
| ----------- | ------ | -------------------------------------- |
| source      | number | Player server ID                       |
| account     | string | `'cash'`, `'bank'`, or `'black_money'` |
| **Returns** | number | Money amount, 0 if unavailable         |

***

### AddMoney

```lua
local success = exports['zloma_core']:AddMoney(source, amount, account)
```

| Param       | Type    | Description                            |
| ----------- | ------- | -------------------------------------- |
| source      | number  | Player server ID                       |
| amount      | number  | Amount to add                          |
| account     | string  | `'cash'`, `'bank'`, or `'black_money'` |
| **Returns** | boolean | true if successful                     |

***

### RemoveMoney

```lua
local success = exports['zloma_core']:RemoveMoney(source, amount, account)
```

| Param       | Type    | Description                            |
| ----------- | ------- | -------------------------------------- |
| source      | number  | Player server ID                       |
| amount      | number  | Amount to remove                       |
| account     | string  | `'cash'`, `'bank'`, or `'black_money'` |
| **Returns** | boolean | true if successful                     |

***

### GetPlayerJob

```lua
local job = exports['zloma_core']:GetPlayerJob(source)
```

Returns a normalized job table:

```lua
{
    name = "police",       -- Job name
    label = "Police",      -- Display name
    grade = 3,             -- Grade level (number)
    grade_name = "Sergeant", -- Grade label
    grade_label = "Sergeant"
}
```

***

### GetPlayerGang

QBCore/QBox only. Returns `nil` on ESX.

```lua
local gang = exports['zloma_core']:GetPlayerGang(source)
```

Returns same format as `GetPlayerJob`.

***

### GetIdentifier

```lua
local id = exports['zloma_core']:GetIdentifier(source)
```

\| **Returns** | string | Player's primary identifier (license, citizenid, etc.) |

***

### GetCharacterName

```lua
local name = exports['zloma_core']:GetCharacterName(source)
```

\| **Returns** | string | Character's first + last name |

***

### GetPlayerGroup

```lua
local group = exports['zloma_core']:GetPlayerGroup(source)
```

\| **Returns** | string | `'user'`, `'mod'`, `'admin'`, `'god'`, etc. |

***

### IsAdmin

```lua
local isAdmin = exports['zloma_core']:IsAdmin(source, groups)
```

| Param       | Type             | Description                                     |
| ----------- | ---------------- | ----------------------------------------------- |
| source      | number           | Player server ID                                |
| groups      | table (optional) | Groups to check, e.g. `{'admin', 'superadmin'}` |
| **Returns** | boolean          | true if player matches any group                |

Falls back to ACE permission check if no framework group matches.

***

### GetAllJobs

```lua
local jobs = exports['zloma_core']:GetAllJobs()
```

\| **Returns** | table | All framework jobs |

***

### GetAllGangs

QBCore/QBox only.

```lua
local gangs = exports['zloma_core']:GetAllGangs()
```

***

### GetJobGrades

```lua
local grades = exports['zloma_core']:GetJobGrades(jobName)
```

***

### GetOnlinePlayers

```lua
local players = exports['zloma_core']:GetOnlinePlayers()
```

Returns a table of all online players with basic info (source, name, job, identifier).

***

### SetPlayerJob

```lua
exports['zloma_core']:SetPlayerJob(source, jobName, grade)
```

***

### GetFrameworkType

```lua
local fw = exports['zloma_core']:GetFrameworkType()
-- Returns: 'ESX', 'QBCore', or 'QBox'
```

***

## Inventory

### HasItem

```lua
local has = exports['zloma_core']:HasItem(source, item, count)
```

| Param       | Type    | Description                         |
| ----------- | ------- | ----------------------------------- |
| source      | number  | Player server ID                    |
| item        | string  | Item name                           |
| count       | number  | Minimum count (default: 1)          |
| **Returns** | boolean | true if player has >= count of item |

***

### GetItemCount

```lua
local count = exports['zloma_core']:GetItemCount(source, item)
```

***

### AddItem

```lua
local success = exports['zloma_core']:AddItem(source, item, count, metadata)
```

| Param       | Type             | Description        |
| ----------- | ---------------- | ------------------ |
| source      | number           | Player server ID   |
| item        | string           | Item name          |
| count       | number           | Amount to add      |
| metadata    | table (optional) | Item metadata/info |
| **Returns** | boolean          | true if successful |

***

### RemoveItem

```lua
local success = exports['zloma_core']:RemoveItem(source, item, count)
```

***

### GetItemMetadata

```lua
local meta = exports['zloma_core']:GetItemMetadata(source, item)
```

\| **Returns** | table/nil | Item metadata or nil |

***

### GetInventory

```lua
local items = exports['zloma_core']:GetInventory(source)
```

\| **Returns** | table | All items in player's inventory |

***

## Billing

### SendBill

```lua
local success = exports['zloma_core']:SendBill(source, target, amount, reason, society)
```

| Param   | Type   | Description      |
| ------- | ------ | ---------------- |
| source  | number | Sender server ID |
| target  | number | Target server ID |
| amount  | number | Bill amount      |
| reason  | string | Bill description |
| society | string | Society/job name |

***

### GetBills

```lua
local bills = exports['zloma_core']:GetBills(source)
```

> Note: Not all billing systems support fetching bills. Returns empty table if unsupported.

***

## Society / Banking

### GetSocietyMoney

```lua
local balance = exports['zloma_core']:GetSocietyMoney(job)
```

***

### AddSocietyMoney

```lua
exports['zloma_core']:AddSocietyMoney(job, amount)
```

***

### RemoveSocietyMoney

```lua
exports['zloma_core']:RemoveSocietyMoney(job, amount)
```

***

## Fuel (Server-Side)

### SetVehicleFuel

```lua
exports['zloma_core']:SetVehicleFuel(vehicle, fuelLevel)
```

***

### GetVehicleFuel

```lua
local fuel = exports['zloma_core']:GetVehicleFuel(vehicle)
```

***

### GetFuelSystem

```lua
local system = exports['zloma_core']:GetFuelSystem()
-- Returns: 'lc_fuel', 'ox_fuel', nil, etc.
```

***

## Utility

### Notify (Server → Client)

Send a notification from server to a specific client:

```lua
exports['zloma_core']:Notify(source, 'Message', 'success', 5000)
```

### CreateUseableItem

Register a useable item callback (works across ESX and QBCore):

```lua
exports['zloma_core']:CreateUseableItem('bandage', function(source)
    -- Item used by player
end)
```

***

### GiveVehicleKeys / RemoveVehicleKeys

Server-side key management (triggers client events):

```lua
exports['zloma_core']:GiveVehicleKeys(source, plate)
exports['zloma_core']:RemoveVehicleKeys(source, plate)
```

***

### GetPlayerFromIdentifier

Get an online player's server ID from their identifier:

```lua
local source = exports['zloma_core']:GetPlayerFromIdentifier(identifier)
```

| Param       | Type       | Description                            |
| ----------- | ---------- | -------------------------------------- |
| identifier  | string     | Player identifier (license, citizenid) |
| **Returns** | number/nil | Player source ID, nil if offline       |

***

### GetOfflinePlayerJob / SetOfflinePlayerJob

Read/write job data for offline players via database:

```lua
local job = exports['zloma_core']:GetOfflinePlayerJob(identifier)
-- Returns: { name = 'police', grade = 2, label = 'Police' }

exports['zloma_core']:SetOfflinePlayerJob(identifier, 'mechanic', 1)
```

***

### GetSocietySystem

```lua
local system = exports['zloma_core']:GetSocietySystem()
-- Returns: 'esx_addonaccount', 'qb-banking', etc.
```

***

### GetInventorySystem

```lua
local system = exports['zloma_core']:GetInventorySystem()
-- Returns: 'ox_inventory', 'qb-inventory', etc.
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zloma-scripts.gitbook.io/zloma-scripts/zloma_core-free/api-reference/server-exports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
