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

# Server exports

## Server exports

Call these exports from a server script.

### CreatePoster(data)

Creates a poster, selects the first free slot, writes the SQL row, and synchronizes every client.

```lua
local success, result = exports['cactus_poster_creator']:CreatePoster(data)
```

#### Required parameters

| Field      | Type   | Description                      |
| ---------- | ------ | -------------------------------- |
| `boardId`  | string | Existing key in `Config.Boards`. |
| `coords`   | table  | Position: `{ x, y, z }`.         |
| `rotation` | table  | Rotation: `{ x, y, z }`.         |

#### Optional parameters

| Field               | Type   | Description                                          |
| ------------------- | ------ | ---------------------------------------------------- |
| `poster`            | table  | Poster content. Fields can be at the root of `data`. |
| `creatorIdentifier` | string | SQL identifier. Default: `server`.                   |
| `creatorName`       | string | SQL name. Default: `Administration`.                 |

Accepted `poster` fields: `type`, `nativeFamily`, `nativeType`, `nativeDifficulty`, `nativeDifficultyVisible`, `nativeTxd`, `nativeTex`, `jurisdiction`, `title`, `subject`, `body`, `reward`, and `footer`.

`title`, `subject`, and `body` are required. Other fields can use defaults.

| Return                    | Meaning                              |
| ------------------------- | ------------------------------------ |
| `true, posterId`          | Poster created.                      |
| `false, 'invalid_data'`   | Invalid required data.               |
| `false, 'family_full'`    | All three family slots are occupied. |
| `false, 'database_error'` | MySQL failure.                       |

```lua
local success, posterId = exports['cactus_poster_creator']:CreatePoster({
    boardId = 'rhodes_sheriff',
    coords = { x = 1353.80, y = -1303.90, z = 76.20 },
    rotation = { x = 0.0, y = 1.0, z = -20.0 },
    creatorIdentifier = 'event:train_robbery',
    creatorName = 'Rhodes Sheriff Office',
    poster = {
        type = 'standard',
        nativeFamily = 'normal',
        nativeType = 2,
        nativeTxd = 'bounty_target_06',
        nativeTex = 'bounty_target_06',
        jurisdiction = 'LEMOYNE',
        title = 'WANTED',
        subject = 'ARTHUR CALLAHAN',
        body = 'Wanted for questioning after the Rhodes train robbery.',
        reward = '$100',
        footer = 'REPORT TO THE RHODES SHERIFF',
    },
})

if not success then
    print(('Poster creation failed: %s'):format(tostring(posterId)))
end
```

### UpdatePoster(posterId, changes)

Updates active poster content and native rendering, then synchronizes clients.

```lua
local success, reason = exports['cactus_poster_creator']:UpdatePoster(42, {
    reward = '$250',
    body = 'Reward increased by order of the sheriff.',
    nativeType = 4,
})
```

| Return                    | Meaning                         |
| ------------------------- | ------------------------------- |
| `true`                    | Poster updated.                 |
| `false, 'not_found'`      | Poster not found.               |
| `false, 'invalid_data'`   | Data is invalid after merging.  |
| `false, 'family_full'`    | No free slot in the new family. |
| `false, 'database_error'` | MySQL failure.                  |

Change family:

```lua
local success, reason = exports['cactus_poster_creator']:UpdatePoster(42, {
    poster = {
        nativeFamily = 'legendary',
        nativeDifficulty = 4,
        nativeDifficultyVisible = true,
    },
})
```

{% hint style="info" %}
`UpdatePoster` changes content and native rendering. It does not move the prop or change its board.
{% endhint %}

### RemovePoster(posterId)

Logically removes an active poster and synchronizes clients.

```lua
local success, reason = exports['cactus_poster_creator']:RemovePoster(42)
```

| Return                    | Meaning                                      |
| ------------------------- | -------------------------------------------- |
| `true`                    | Poster removed.                              |
| `false, 'not_found'`      | Poster does not exist or is already removed. |
| `false, 'database_error'` | MySQL failure.                               |

### Integration example

```lua
RegisterNetEvent('my_bounty:server:publishPoster', function(bounty)
    local success, posterId = exports['cactus_poster_creator']:CreatePoster({
        boardId = 'valentine_sheriff',
        coords = bounty.posterCoords,
        rotation = bounty.posterRotation,
        creatorIdentifier = ('bounty:%s'):format(bounty.id),
        creatorName = 'Valentine Sheriff Office',
        poster = {
            title = 'WANTED',
            subject = bounty.targetName,
            body = bounty.description,
            reward = ('$%s'):format(bounty.reward),
            nativeFamily = bounty.legendary and 'legendary' or 'normal',
            nativeDifficulty = bounty.difficulty or 1,
            nativeDifficultyVisible = bounty.legendary == true,
            nativeTxd = bounty.txd or 'bounty_target_01',
            nativeTex = bounty.tex or 'bounty_target_01',
        },
    })

    if success then
        bounty.posterId = posterId
    end
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, and the optional `goal` query parameter:

```
GET https://cactus-code.gitbook.io/cactus-code-docs/documentation/scripts/cactus-poster-creator/server-exports.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
