# Configure CXG-GTFAT

Edit `config.lua` and restart `CXG_GTFAT`. Weight values are declared in kilograms and must fit the configured step grid.

## Language and weight

~~~lua
Config.Locale = 'en'

Config.Weight = {
    minKg = 50,
    maxKg = 180,
    defaultKg = 75,
    fatThresholdKg = 100,
    stepKg = 0.5,
}
~~~

Available languages: en, es, `pt-BR`, fr, de, it, pl, ru, tr, th, ar, sv, and br. br retains older Brazilian Portuguese text; `pt-BR` is recommended for normal selection.

The initial weight range is 50–180 kg, the default is 75 kg, and Fat activates at 100 kg inclusive. `minKg` must be at least zero; `stepKg` must be positive; and `minKg` <= `defaultKg` <= `maxKg` must hold. The threshold must be above the minimum and no higher than the maximum. The default, threshold, and maximum must fit the grid that starts at `minKg`; for example, with a 50 kg minimum and a 0.5 kg step, 75 and 100 kg are valid. An invalid configuration disables weight operations.

The LB unit converts the display only. The server stores and validates values in kg.

## Commands and permissions

~~~lua
Config.Commands = {
    enabled = true,
    access = 'ace',
    ace = 'cxg_gtfat.use',
    job = nil,
    group = nil,
    custom = nil,
    open = 'fatweight',
    control = 'fatdecal',
}
~~~

When enabled, the configured commands are registered. The default open command is `/fatweight`; the control command is `/fatdecal`. Control accepts on, off, status, or ui. on adjusts weight to at least the Fat threshold; off sets it no higher than one step below. These are not separate visual toggles.

| access | Behavior |
| --- | --- |
| ace | Requires the `ACE` permission specified by ace. This is the default. |
| everyone | Allows any player who passes server checks to use it. |
| jobs, groups, custom | Requires a policy implementation in `bridge/server.lua`; it is not automatically connected to the framework. |

To grant `ACE` access to administrators:

~~~cfg
add_ace group.admin cxg_gtfat.use allow
~~~

A menu or target can request the interface to open, but authorization is still checked by the server. Disabling command registration does not prevent another server resource from calling the `OpenWeightUI` export.

## Stations

No physical scales are enabled after installation. Copy the `gym` entry into `Config.Stations`, use a unique key, enter actual coordinates, and enable it.

~~~lua
Config.Interaction = {
    key = 'E',
    streamDistance = 60.0,
}

Config.Stations = {
    gym = {
        enabled = true,
        coords = { x = 0.0, y = 0.0, z = 0.0 },
        heading = 0.0,
        distance = 1.8,
        bucket = 0,
        access = 'ace',
        ace = 'cxg_gtfat.use',
        job = nil,
        group = nil,
        custom = nil,
        model = false,
        spawnProp = false,
    },
}
~~~

Replace the example coordinates. The `distance` range supports up to 5 meters. `bucket` must match the station's routing bucket; it is usually 0. Each station has its own `access` policy.

| Mode | Settings | Result |
| --- | --- | --- |
| Point without an object | model = false, `spawnProp` = false | Invisible interaction at the configured coordinates. |
| Existing object | model = 'model_name', `spawnProp` = false | Requires that model within 1 meter of the coordinates. The resource does not remove it. |
| Locally created object | model = 'model_name', `spawnProp` = true | Creates a frozen local object when nearby and removes it when you leave or stop the resource. |

The interaction point does not automatically place the object on the ground. Set `coords` to the object's actual origin and `heading` to its orientation. The prompt uses E by default, and players can rebind “Use scale” in FiveM Settings > Key Bindings.

The default adapter allows ace and everyone. Other modes require a server implementation. Showing a prompt or prop does not grant permission; the server checks access and proximity again.

## Per-character persistence

~~~lua
Config.Persistence = { framework = 'none' }
~~~

| Mode | Use |
| --- | --- |
| none | Default. Session only; reconnecting or restarting uses `defaultKg`. |
| qb | Resolves the character through qb-core and its citizenid. |
| esx | Resolves the character through es_extended and its identifier. |
| custom | Uses `GTFatCustomCharacterId(source)` in `identity.lua`. |

The resource does not detect Qbox automatically. For multicharacter servers, configure a stable, unique identifier for each character through a compatible option or your own adapter. Do not share an identifier across characters or accept an identity sent by the client. In custom mode, return nil until the character has loaded.

Persisted weight is stored separately from clothing and outfits. Keep the resource name `CXG_GTFAT` and back up the server's `KVP` storage with the rest of its persistent data.
