Police BreathalyzerBlood alcohol

Blood alcohol

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:

shared/config.lua
drinks = {
    beer = 1.0, wine = 1.0, whiskey = 1.5, vodka = 1.5,
},

They are seen without changing the scripts that give them:

Your server hasHow a drink is seen
ox_inventoryIts usingItem hook, when one of the drinks items is used
qb-smallresourcesIts 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 loaded
exports.tr_breathalyzer:getBAC(source)            -- their BAC now, in % BAC
exports.tr_breathalyzer:setBAC(source, 0.0)       -- sets it, 0 to 0.6

Admin commands

For the tr.admin ace, or your framework's admins:

CommandWhat 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
Was this page helpful?

Still stuck? Open a ticket on Discord.Privacy