# API

## other exports

All exports are used from the client side only.

* SetBlockingStatusForDrunk(bool)

  ```
  This will block all drunk event (drunk walking, drunk screen, echo, everything)
  ```
* IsDrunkBlocked()

  ```
  This will return true/false if the status were blocked
  ```

### Headache

All exports are used from the client side only.

* GetPlayerHeadachePercentage()

  ```
  return value between 0-100.
  ```
* HasPlayerHeadache()

  ```
  return true/false if the player has a headache.
  ```
* IsPlayerHeadacheAtPercentage(<mark style="color:orange;">**number**</mark>)

  ```
  return true/false if the player has the above "number".
  ```
* AddPlayerHeadachePercentage(<mark style="color:orange;">**number**</mark>)

  ```
  will add a percentage to the headache status.
  ```
* RemovePlayerHeadachePercentage(<mark style="color:orange;">**number**</mark>)

  ```
  will do the opposite of the one above.
  ```
* SetPlayerHeadachePercentage(<mark style="color:orange;">**number**</mark>)

  ```
   will set the headache percentage level.
  ```

### Drunk

* GetPlayerDrunkPercentage()

  ```
  return value between 0-100
  ```
* IsPlayerDrunkAtLevel(<mark style="color:orange;">**number**</mark>)

  ```
  return true/false if the player has the above "number".
  ```
* GetPlayerDrunkLevel()

  ```
  return a value between 0-4 which represents this enum

  DrunkLevel = {
      NONE = 0,
      LITTLE = 1,
      MODERATELY = 2,
      HIGH = 3,
      MAXIMUM = 4,
  }
  ```
* IsPlayerDrunk()

  ```
  return true/false if the player has more than 20% percentage
  ```
* IsPlayerDrunkAtPercentage(<mark style="color:orange;">**number**</mark>)

  ```
  return true/false if the player has the above "number".
  ```
* AddPlayerDrunkPercentage(<mark style="color:orange;">**number**</mark>)

  ```
  will add a percentage to the headache status.
  ```
* RemovePlayerDrunkPercentage(<mark style="color:orange;">**number**</mark>)

  ```
  will do the opposite of the one above
  ```
* SetPlayerDrunkPercentage(<mark style="color:orange;">**number**</mark>)

  ```
  will set the drunk percentage level.
  ```
* GetMilligramsAlcoholInBlood()

  ```
  will return milligrams of alcohol in the blood 
  it is the same value as in the breath tester
  ```

### Events (server/client sided)

```lua
-- when a player sips from the bottle this event gets called
AddEventHandler("rcore_drunk:PlayerSippedDrink", function(drinkName)
   print(drinkName)
end)

-- when play finishes drinking a bottle this event gets called
AddEventHandler("rcore_drunk:OnBottleFinish", function(drinkName)
    print(drinkName)
end)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.rcore.cz/paid-resources/rcore_drunk/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
