Where a player's blood alcohol comes from, how it rises and falls, and the exports and commands for it.
On this page
GTA has no alcohol level, so Police Breathalyzer keeps its own blood alcohol (BAC) for each character. It never changes how a player walks, sees or drives: other scripts can do that, this one only measures.
How it rises and falls
A drink adds perDrink (0.02 % BAC per standard drink), taken up over absorbMinutes (20 minutes), so a test right after drinking reads low.
The body clears burnPerHour (0.015 % BAC an hour, in real time).
Logging out doesn't sober anyone up: the time keeps counting, so it comes down while they're away the same as in the city.
A reading is off by up to deviceError (0.003), as a real device's is.
Your drinks
List your server's drink items in drinks in shared/config.lua, in standard drinks per use:
They are seen without changing the scripts that give them:
Your server has
How a drink is seen
ox_inventory
Its usingItem hook, when one of the drinks items is used
qb-smallresources
Its alcohol event
ESX's drunk status (esx_optionalneeds and the like)
The drunk status it adds: esxDrunkPerDrink points (250000) make one drink, esxMostPerUse (2.0) is the most one use counts as
Exports
For any other script, on the server:
lua
exports.tr_breathalyzer:addAlcohol(source, 1.5) -- standard drinks; false if the player isn't loadedexports.tr_breathalyzer:getBAC(source) -- their BAC now, in % BACexports.tr_breathalyzer:setBAC(source, 0.0) -- sets it, 0 to 0.6
Admin commands
For the tr.admin ace, or your framework's admins:
Command
What it does
/bac [id]
Shows a player's BAC, and what is still to be taken up (yours without an id)
/setbac <id> <value>
Sets a player's BAC, in % BAC (0 to 0.6)
/br_dummy [bac] [car]
A stand-in to test on alone (0.09 by default; car puts him in the nearest car). Again to send him away