# Configuration

`Advanced Graffiti System` uses a configuration file located in:

* `data/config.lua`

This file controls localization, upload settings, required items, spray cleanup, rendering, placement behavior, admin access, and debug options.

### Localization

```lua
Locale = 'en' -- 'en' or 'pl'
```

Defines which language should be used.

Supported values:

* `en`
* `pl`

To add a new language, create a new file inside `locales/` using the same structure as `en.json`.

***

### Main Configuration

Example:

```lua
Locale = 'en',

Upload = {
    Type = 'custom',

    Custom = {
        Url = 'https://upload.domain.pl/upload',
        Field = 'file',
        ResponseUrlKey = 'url',
    },

    Fivemanage = {
        Token = 'YOUR_FIVEMANAGE_API_TOKEN',
    },
},

Item = 'spray_can',
Cleaner = 'sponge',

CleaningTime = 30,
DeleteAfter = 24,
TickInterval = 5,

RenderDistance = 50.0,
DuiResolution = 1024,
ThreadSleep = 1500,

MaxSprayDistance = 50.0,
InteractionDistance = 3.0,
RaycastDistance = 5000,

AdminCommand = 'sprayadmin',
AdminPermissions = { 'admin', 'developer' },

DebugMode = false,
```

***

### Upload Configuration

Controls which upload provider is used for spray images.

```lua
Upload = {
    Type = 'custom',
}
```

#### `Type`

Supported values:

* `custom`
* `fivemanage`

***

#### Custom Upload

Use this option if you have your own upload server or image host that accepts multipart uploads.

```lua
Custom = {
    Url = 'https://upload.domain.pl/upload',
    Field = 'file',
    ResponseUrlKey = 'url',
}
```

**`Url`**

Defines the upload endpoint.

**`Field`**

Defines the multipart form field name used for the file.

**`ResponseUrlKey`**

Defines the JSON response key that contains the final image URL.

***

#### Fivemanage Upload

Use this option if you want to upload spray images through Fivemanage.

```lua
Fivemanage = {
    Token = 'YOUR_FIVEMANAGE_API_TOKEN',
}
```

**`Token`**

Defines your Fivemanage API token.

***

### Items

Controls which items are required for spray placement and cleaning.

```lua
Item = 'spray_can'
Cleaner = 'sponge'
```

#### `Item`

The item required to place a new spray.

#### `Cleaner`

The item required to remove an existing spray.

***

### Timing Configuration

Controls spray cleaning time, automatic deletion, and cleanup checks.

```lua
CleaningTime = 30
DeleteAfter = 24
TickInterval = 5
```

#### `CleaningTime`

Defines how long it takes to erase a spray in seconds.

```lua
CleaningTime = 30
```

#### `DeleteAfter`

Defines how many hours a spray remains in the database before it is deleted automatically.

```lua
DeleteAfter = 24
```

#### `TickInterval`

Defines how often the server checks for expired sprays.

```lua
TickInterval = 5
```

This value is measured in minutes.

***

### Rendering Configuration

Controls spray visibility, DUI resolution, and client performance behavior.

```lua
RenderDistance = 50.0
DuiResolution = 1024
ThreadSleep = 1500
```

#### `RenderDistance`

Defines how close a player must be to see sprays.

```lua
RenderDistance = 50.0
```

This value is measured in meters.

#### `DuiResolution`

Defines the texture resolution used for spray rendering.

```lua
DuiResolution = 1024
```

Higher values improve image quality but also increase VRAM usage.

#### `ThreadSleep`

Defines how long the render thread sleeps when no sprays are nearby.

```lua
ThreadSleep = 1500
```

Higher values reduce CPU usage when far away from sprays.

***

### Placement Configuration

Controls placement distance, interaction range, and raycasting.

```lua
MaxSprayDistance = 50.0
InteractionDistance = 3.0
RaycastDistance = 5000
```

#### `MaxSprayDistance`

Defines the maximum distance allowed between the two placement corner points.

```lua
MaxSprayDistance = 50.0
```

#### `InteractionDistance`

Defines how close a player must be to interact with a spray.

```lua
InteractionDistance = 3.0
```

This affects erase and confirm interaction range.

#### `RaycastDistance`

Defines how far the placement raycast can reach.

```lua
RaycastDistance = 5000
```

***

### Admin Configuration

Controls the admin command and allowed permission groups.

```lua
AdminCommand = 'sprayadmin'
AdminPermissions = { 'admin', 'developer' }
```

#### `AdminCommand`

Defines the command used to open the spray admin panel.

```
AdminCommand = 'sprayadmin'
```

#### `AdminPermissions`

Defines which groups are allowed to use the admin panel.

```lua
AdminPermissions = { 'admin', 'developer' }
```

***

### Admin Panel

The admin panel can be opened with:

```lua
/sprayadmin
```

It allows staff to:

* view all active sprays
* search by author or spray ID
* preview spray entries
* teleport to sprays
* delete sprays

Access is controlled by `AdminPermissions`.

***

### Debug Mode

```lua
DebugMode = false
```

When enabled, the system shows additional debug information above sprays in the world.

This includes:

* database ID
* character ID

This is useful during development and testing.

***

### Notes

* `DuiResolution` directly affects VRAM usage
* `ThreadSleep` affects idle render performance
* `DebugMode = true` is useful for testing and admin inspection
* Sprays are stored in the `sprays` database table
* Expired sprays are deleted automatically


---

# Agent Instructions: 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://mskscripts.gitbook.io/mskscripts/scripts/advanced-graffiti-system/configuration.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.
