Skip to content

API

You can find many data extraction and update methods here to adapt to your other scripts.

Optimization solution for HUD's#

You need to add your hud this event handlers

Client-side / Server-side

lua
s4-breathalyser:onUpdate

It will give you two arguments, argument 1 is Alcohol and argument 2 is Narco data.

Example use

text
```lua
RegisterNetEvent('s4-breathalyser:onUpdate')
AddEventHandler('s4-breathalyser:onUpdate', function(Alcohol, Narco)
```

Exports#

Whether the menu is open

lua
exports["s4-breathalyser"].IsMenuOpen()

Returns the alcohol value in float data

lua
exports["s4-breathalyser"].GetAlcohol()

Returns the narco value in float data

lua
exports["s4-breathalyser"].GetNarco()

Should be used to add alcohol data

lua
exports["s4-breathalyser"].UpdateAlcohol(value)

Should be used to add narco data

lua
exports["s4-breathalyser"].UpdateNarco(value)

It removes alcohol and narcos from the player.

lua
exports["s4-breathalyser"].ClearPlayer()

Returns alcohol data as a percentage

lua
exports["s4-breathalyser"].GetAlcoholPercentage()

Returns narco data as a percentage

lua
exports["s4-breathalyser"].GetNarcoPercentage()