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

# Tickets (Exports)

Server exports for ticket creation and management.

### SERVER

Get the export object

```lua
local Tickets = exports['mrc-metermaid']:Tickets()
```

***

### Tickets.Get

`Tickets.Get(ticketNumber)`

Retrieve a ticket by its ticket number.

**Parameters**

* `ticketNumber` (string) Example: `"PKT-202501-123456"`

**Returns**

* Ticket table, or `nil` if not found.

```lua
local ticket = Tickets.Get("PKT-202501-123456")
if ticket then
    print("Fine: " .. ticket.fine)
    print("Owner: " .. ticket.owner)
end
```

***

### Tickets.Create

`Tickets.Create(plate, infractionId, issuedBySrc, coords)`

Create a new ticket for a vehicle.

**Parameters**

* `plate` (string) Vehicle license plate.
* `infractionId` (string) Infraction type ID from config.
* `issuedBySrc` (number) Server ID of the issuing officer.
* `coords` (vector3) Issue location.

**Returns**

* Ticket table on success, or `nil` on failure.

```lua
local ticket = Tickets.Create("ABC1234", "speeding", 1, vector3(100.5, 200.3, 40.0))
if ticket then
    print("Ticket created: " .. ticket.ticketNumber)
end
```

***

### Tickets.Remove

`Tickets.Remove(ticketNumber)`

Remove a ticket from the system and database.

**Parameters**

* `ticketNumber` (string)

**Returns**

* `true` on success.
* `false` if not found.

```lua
if Tickets.Remove("PKT-202501-123456") then
    print("Ticket removed")
end
```

***

### Tickets.SetFine

`Tickets.SetFine(ticketNumber, amount)`

Set the fine amount on a ticket.

The value is clamped to `0` minimum.

**Parameters**

* `ticketNumber` (string)
* `amount` (number) New fine amount.

**Returns**

* `true` on success.
* `false` if not found.

```lua
local Tickets = exports['mrc-metermaid']:Tickets()

Tickets.SetFine("PKT-202501-123456", 250)
Tickets.SetFine("PKT-202501-123456", -50) -- becomes 0
```

***

### Tickets.SetCustomMessage

`Tickets.SetCustomMessage(ticketNumber, message)`

Add or update a custom message on a ticket.

**Parameters**

* `ticketNumber` (string)
* `message` (string)

**Returns**

* `true` on success.
* `false` if not found.

```lua
Tickets.SetCustomMessage("PKT-202501-123456", "Contact PD for details")
```

***

### Tickets.AddDispute

`Tickets.AddDispute(src, ticketNumber, reason)`

Mark a ticket as disputed and create a dispute entry.

**Parameters**

* `src` (number) Server ID of the disputing player.
* `ticketNumber` (string) Example: `"PKT-202501-123456"`
* `reason` (string) Dispute reason text.

**Returns**

* true on success.
* false if not found.

```lua
local Tickets = exports['mrc-metermaid']:Tickets()

-- Example: inside a server event where `source` is the player
Tickets.AddDispute(source, "PKT-202501-123456", "Meter was paid. Ticket is incorrect.")
```

***

### Tickets.RemoveDispute

`Tickets.RemoveDispute(ticketNumber)`

Remove an active dispute from a ticket and restore normal status.

**Parameters**

* `ticketNumber` (string)

**Returns**

* `true` on success.
* `false` if not found.

```lua
Tickets.RemoveDispute("PKT-202501-123456")
```


---

# 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 following URL with the `ask` and `goal` query parameters:

```
GET https://mrcscripts.gitbook.io/docs/scripts/metermaid/exports/server/tickets-exports.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

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.
