> For the complete documentation index, see [llms.txt](https://batscripts.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://batscripts.gitbook.io/docs/utility-scripts/bat_bucketmanager/setup/configuration-file.md).

# Configuration file

The configuration file (e.g. `config.server.lua`) has 3 main variables:

### **IsAdmin**: `function(source) -> boolean`&#x20;

Executed to validate if a source (e.g. user) can execute any [commands](/docs/utility-scripts/bat_bucketmanager/commands.md). You may change this function to whatever validation you prefer,  but it must return a boolean: `true` if user is allowed, `false` if not.

***

### **OnBucketChange**: `function(source, bucketId) -> boolean`&#x20;

Executed when somebody warps to a bucket via command or UI. Useful when you have your own implementation of events that are emitted when the user is in a different bucket.

***

### **StoreTimeInGlobalState**: `boolean`

If `true`, the latest time for each bucket will be stored in `GlobalState`.

* The key will follow the pattern `"bucketId-time"`.
* The value will follow the pattern `{ hours, minutes }`.
* Examples:
  * Key `"0-time"` will contain the current time for bucket `0`.
  * Key `"12-time"` will contain the current time for bucket `12` and so on.

***

### **DefaultBuckets**: `table`

The initial state for specific buckets. These values will be used once, only when the resource is started.

* The key is the `bucketId` as a `string` (e.g. `"0"`, `"1"`, `"25"` etc).
* Each table may contain the following properties (all optional):
  * **Time**: `table`
    * **Hours**: `number` (`0` to `23` / defaults to `12`)
    * **Minutes**: `number` (`0` to `59` / defaults to `0`)
    * **FreezeTime**: `boolean` (defaults to `false`)
      * If `true`, time increment will be stopped for this specific bucket.
  * **Weather**: `table`
    * **WeatherType**: `string` (defaults to `EXTRASUNNY`)
      * Check the [FiveM documentation](https://docs.fivem.net/natives/?_0x29B487C359E19889) for the list of all available options.
    * **RainLevel**: `number` (defaults to `-1`)
      * `-1` means rain level will change according to the weather (GTA's default values).
      * `0` means no rain at all.
  * **Lights**: `table`
    * **Blackout**: `boolean` (defaults to `false`)
    * **BlackoutVehicles**: `boolean` (defaults to `false`)

***

## Example file

```lua
BatBucketManagerConfig = {
  IsAdmin = function(source)
    -- This is just an example. You may put here any authorization method you prefer.
    return IsPlayerAceAllowed(source, "bucketmanager")
  end,
  OnBucketChange = function(source, bucketId)
    -- Executed when somebody warps to a bucket via command or UI. Example:
    -- Player(source).state.route = bucketId
  end,
  StoreTimeInGlobalState = true,
  DefaultBuckets = {
    ["0"] = {
      Time = {
        Hours = 22,
        Minutes = 30,
        FreezeTime = false
      },
      Weather = {
        WeatherType = "XMAS",
        RainLevel = 0.0
      },
      Lights = {
        Blackout = false,
        BlackoutVehicles = false
      }
    }
  }
}
```
