# Community Service Settings

Community Service is a physical punishment system. The player is **teleported to a work zone**, dressed in a prisoner outfit, and must complete a set number of tasks at marked locations.

***

### Config Variables

```lua
Config.MaxActionscomserv        = 200  -- Max tasks staff can assign
Config.MinActions               = 1    -- Minimum tasks (shared with Stopfire)
Config.ServiceExtensionOnEscape = 8    -- Extra tasks added if player escapes

Config.CommunityTextPos = { 0.175, 0.955 }  -- HUD counter position
```

| Variable                          | Default            | Description                           |
| --------------------------------- | ------------------ | ------------------------------------- |
| `Config.MaxActionscomserv`        | `200`              | Maximum tasks in one sentence         |
| `Config.MinActions`               | `1`                | Minimum tasks (shared with Stopfire)  |
| `Config.ServiceExtensionOnEscape` | `8`                | Penalty tasks added on escape attempt |
| `Config.CommunityTextPos`         | `{ 0.175, 0.955 }` | HUD counter screen position           |

***

### How Community Service Works

1. Staff applies Community Service from the panel (enters a task count)
2. Player is:
   * Teleported to `Config.ServiceLocation`
   * Dressed in the prisoner outfit (see Clothing)
   * Shown blue markers on the map
3. Player walks to a marker and presses **E** (`INPUT_CONTEXT`)
4. A cleaning or gardening animation plays for \~10 seconds
5. Task count decrements by 1
6. New markers appear to replace completed ones (always 5 active at a time)
7. When all tasks are complete, the player is:
   * Released from service
   * Teleported to `Config.ReleaseLocation`
   * Their original clothing is restored

***

### Task Types

Each location in `Config.ServiceLocations` has a `type` field that controls the animation:

| Type          | Animation                | Prop                                 |
| ------------- | ------------------------ | ------------------------------------ |
| `"cleaning"`  | Janitor sweep animation  | Broom (`prop_tool_broom`)            |
| `"gardening"` | Gardener plant animation | Spatula (`bkr_prop_coke_spatula_04`) |

```lua
Config.ServiceLocations = {
    { type = "cleaning",  coords = vector3(3072.54, -4759.73, 15.26) },
    { type = "gardening", coords = vector3(3043.99, -4683.34, 15.26) },
}
```

> You can add as many locations as you want. The script randomly picks 5 at a time.

***

### Escape Detection

If the player leaves the work area, the script **automatically**:

1. Teleports them back to `Config.ServiceLocation`
2. Shows an error notification: *"Escape attempt detected. Service extended."*
3. Adds `Config.ServiceExtensionOnEscape` tasks to their sentence

The work area is defined by multiple overlapping zones — see Locations & Markers for details.

***

### Database Table

Active Community Service sentences are stored in `communityservice`:

```sql
SELECT * FROM communityservice;
```

To manually end a player's Community Service:

```sql
DELETE FROM communityservice WHERE identifier = 'citizenid_here';
```

***


---

# 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://mohssins.gitbook.io/mohscriptsdocs/moh-stoptroll/community-service-settings.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.
