Sentinel: Tamper Guard
The Sentinel stops a player's game from forging the facts WHIP shares through statebags: who is dead, on duty or escorted, damage taken, a car's stats. It's on out of the box, with nothing to write.
FiveM lets a player's game change the statebags about them and their car. When one changes a WHIP key, the Sentinel puts the right value back and strikes that player. Honest games never write these keys, so a detection is a modified client.
When it catches oneServer owners
The Monitor shows a red Tampered with <key> row and the console prints TAMPER. At 3 strikes the player is kicked, with a note signed Sentinel in the Player Manager as the lasting record. Strikes wear off after an hour, and reset when they rejoin. A kick isn't a ban: ban them from the Player Manager once you're sure.
Config.Sentinel | Default | What it does |
|---|---|---|
enabled | true | false turns the Sentinel off |
autoKick | 3 | Strikes before a kick. false records them and kicks nobody |
strikesForgetMinutes | 60 | Minutes without a strike before the count resets. false: never |
logDebounceMs | 1000 | Repeats of one key by one player within this many ms count as one |
bootSweep | true | At start, put back values left wrong before the restart, with no strikes |
damageModifierClamp | { min = 0.05, max = 4.0 } | The range damage and melee modifiers are held to (0.05: 5% of the damage) |
The first three can be changed live in /whip → Settings → Config → Server (changing a setting in game), where a saved value wins over config.lua and an empty Kick after box turns kicking off.
What it watches
Every WHIP key starts with whip:
- Players:
whipDead,whipJob,whipEscorted,whipEscortedBy,whipDamageMod,whipMeleeMod,whipMood. - Cars:
whipVehicleId,whipVehicleSession,whipStats,whipLive,whipAppearance,whipVehData,whipVehDoors,whipEngineHold. - Object Viewer holds:
whipOvHold.
For resource developers
- On the server, read the player sheet or
GetSentinelTruth, never the statebag. Names are never in one: useGetPlayerFullName. - Never write WHIP's keys with
Player(src).state:set: the player is struck. Use WHIP's calls (its revive, forwhipDead). - Guard your own statebag facts with the exports below, or send them as server events.
Puts one of your statebag keys under the Sentinel. A player key's truth is what you last wrote with SetSentinelPlayerKey; an entity key's comes from your truth function, since entities come and go.
| Field | Type | Description |
|---|---|---|
| def.key | string | The key. One another resource watches is refused |
| def.family | string | 'player' or 'entity' |
| def.truth | function? | Required for entity keys: function(entity) → value|nil, run when the key changes. nil removes the key: return it at the default, not {} |
true, or false, reason. Watches go when your resource stopsWhip.core:RegisterSentinelKey({ key = 'mygang_tag', family = 'player' }) -- inside Whip.register
Set records a value on the server, then writes the statebag. Truth reads that record, never the statebag: gate server checks on it. It reads WHIP's keys too.
| Param | Type | Description |
|---|---|---|
| src | number | Server id; to set, they must be connected |
| key | string | To set: your keys or unwatched ones; another resource's and WHIP's are refused |
| value | any | Set only. nil for "off", not false: an absent key costs nothing |
true, or false, reason ('no such player', 'key "whipDead" is owned by whip_core') · truth: the value written (false and nil differ)Writes one of your entity keys. Update the table your truth reads first; if they disagree, the console warns, nobody is struck, and the key is set back to your truth.
| Param | Type | Description |
|---|---|---|
| entity | number | The entity (it must exist) |
| key | string | Your keys or unwatched ones; another resource's and WHIP's are refused |
| value | any | nil removes it |
true, or false, reason ('no such entity', 'key "x" is owned by …')tunes[plate] = t -- your table, first
exports.whip_core:SetSentinelEntityKey(veh, 'mytune_data', t) -- then the key
Entity(e).state:set. A bare write strikes whoever runs the entity: for a car, its driver.