> For the complete documentation index, see [llms.txt](https://docs.kojascripts.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kojascripts.eu/koja-lib/frameworks/custom-framework.md).

# Custom Framework

If you run a framework other than ESX or QBCore, set `Config.Framework = "custom"` and fill in the stub files.

***

## Setup

```lua
-- editable/shared/config.lua
Config.Framework = "custom"
```

Two stub files are then loaded automatically:

| File                                   | Side   |
| -------------------------------------- | ------ |
| `editable/custom/framework_server.lua` | Server |
| `editable/custom/framework_client.lua` | Client |

***

## Server Stubs

Open `editable/custom/framework_server.lua` and implement each function:

```lua
CustomFramework.Server = {}

-- Return a table of online player server IDs.
CustomFramework.Server.GetPlayers = function()
    return {}
end

-- Return the player object for the given source, or nil.
CustomFramework.Server.GetPlayer = function(src)
    return nil
end

-- Return the unique character/player identifier string.
CustomFramework.Server.GetIdentifier = function(src)
    return nil
end

-- Return the display name of the player.
CustomFramework.Server.GetPlayerName = function(src)
    return 'Unknown'
end

-- Return the job name and grade level.
-- @return string|nil, number
CustomFramework.Server.GetPlayerJob = function(src)
    return nil, 0
end

-- Return the permission group of the player (e.g. "admin", "user").
CustomFramework.Server.GetPlayerGroup = function(src)
    return nil
end

-- Return the money amount for the given type ("cash", "bank", "black").
CustomFramework.Server.GetMoney = function(src, mtype)
    return 0
end

-- Add money. Return true on success.
CustomFramework.Server.AddMoney = function(src, amount, mtype, reason)
    return false
end

-- Remove money. Return true on success.
CustomFramework.Server.RemoveMoney = function(src, amount, mtype, reason)
    return false
end
```

***

## Client Stubs

Open `editable/custom/framework_client.lua` and implement each function:

```lua
CustomFramework.Client = {}

-- Return the local player's data table.
CustomFramework.Client.GetPlayerData = function()
    return {}
end

-- Return the local player's job name.
CustomFramework.Client.GetPlayerJob = function()
    return nil
end

-- Return the local player's job label.
CustomFramework.Client.GetPlayerJobLabel = function()
    return nil
end
```

***

## Example (OX Core)

```lua
-- framework_server.lua
CustomFramework.Server.GetPlayer = function(src)
    return Ox.GetPlayer(src)
end

CustomFramework.Server.GetIdentifier = function(src)
    local p = Ox.GetPlayer(src)
    return p and tostring(p.charId) or nil
end

CustomFramework.Server.GetPlayerJob = function(src)
    local p = Ox.GetPlayer(src)
    if not p then return nil, 0 end
    local job = p.get('job')
    return job and job.name, job and job.grade or 0
end
```


---

# 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://docs.kojascripts.eu/koja-lib/frameworks/custom-framework.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.
