> For the complete documentation index, see [llms.txt](https://piotreq-scripts.gitbook.io/piotreq-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://piotreq-scripts.gitbook.io/piotreq-scripts/assets-and-guides/police-mdt/setup-server.md).

# Setup Server

## SSN / Citizen ID System \[FOR ESX]

If you already use system like this just skip this part

1. Go to your es\_extended / server / main.lua and find variable "loadPlayer"
2. if you find that, add in this `id` like on screenshot below.

<figure><img src="/files/pEg7xPwGQ3JjAFrEAJ8g" alt=""><figcaption><p>Example</p></figcaption></figure>

3. Next scroll to function LoadESXPlayer and add `ssn = nil` in userData table
4. Next add `userData.ssn = tonumber(result.id)` below `result`

<figure><img src="/files/uinm73YxDEqxKxThOChm" alt=""><figcaption><p>Example</p></figcaption></figure>

5. Next scroll to `local xPlayer = CreateExtendedPlayer` and add `userData.ssn` in arguments
6. Next add `Core.playersBySsn[userData.ssn] = xPlayer` like on screenshot

<figure><img src="/files/xtm1frz6izyKCz72mq7T" alt=""><figcaption><p>Example</p></figcaption></figure>

7. Next scroll to `playerDropped` event handler and add `Core.playersBySsn[xPlayer.ssn] = nil` also do it in `esx:playerLogout`

<figure><img src="/files/OtxyjeMHn6OIUoaouLo0" alt=""><figcaption><p>Example</p></figcaption></figure>

8. Next go to server / common.lua and add `Core.playersBySsn = {}`

<figure><img src="/files/5mQgeHwip5jVxwOxoOxs" alt=""><figcaption><p>Example</p></figcaption></figure>

10. Next go to server / functions.lua and add new function like on screenshot

<figure><img src="/files/NG0r0xESqLMQkZ3JiCwo" alt=""><figcaption><p>Example</p></figcaption></figure>

11. Next go to server / classes / player.lua and add `ssn` argument in function `CreateExtendedPlayer`
12. Next add `self.ssn = ssn` and add statebag `stateBag:set("ssn", self.ssn, true)`

<figure><img src="/files/tw7J1iiv95eO2c655gAn" alt=""><figcaption><p>Example</p></figcaption></figure>

13. Thats all, at the end make sure ur column `id` in users are auto increment

***

## VIN System

You can skip this part if you already use one.

1. Go to your vehicle shop server side file and find MySQL execute to database like on screenshot.

<figure><img src="/files/o2vxzQm7eiwoPgkyprx1" alt=""><figcaption><p>Example</p></figcaption></figure>

2. Next add vin in columns and values like on screenshot below.

<figure><img src="/files/3oLuAn1VQ4OR1DbUSRg2" alt=""><figcaption><p>Example</p></figcaption></figure>

3. And thats all, if you want to add vin for givecar script, its very similiar.

```lua
exports['piotreq_gpt']:GenerateVIN() -- only server side
```


---

# 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://piotreq-scripts.gitbook.io/piotreq-scripts/assets-and-guides/police-mdt/setup-server.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.
