🛠️Setup

This is a detailed setup guide for Drunk System. If you have any questions before making a purchase, you can contact us on Discord

Setting Up the Script

  1. The script is standalone in nature, and you can find the required information in the config itself

  2. You can use BreathAnalyzer with commands or as an item:

    • qb-core/shared/items.lua
      ["alcohol_tester"] = {
      	["name"] = "alcohol_tester",                                                        
      	["label"] = "Alcohol Tester",
      	["weight"] = 0,
      	["type"] = "item",
      	["image"] = "alcohol_tester.png",
      	["unique"] = false,
      	["useable"] = true,
      	["shouldClose"] = true,
      	["combinable"] = nil,
      	["description"] = ""
      },
    • ox_inventory/data/items.lua
      ['alcohol_tester'] = {
          label = 'Alcohol Tester',
          weight = 0,
          stack = true,
          close = true,
          description = ""
      },

Events and Exports

Client Sided

  1. Open UI
    TriggerEvent(cs:drunk:openUI)
  2. Close UI
    TriggerEvent(cs:drunk:closeUI)
  3. Triggered Event when drunk level updates:

    RegisterNetEvent('cs:drunk:updateLevel', function(updatedLevel)
        print(updatedLevel)
    end)
  4. Check If Player is Drunk
    exports['cs_drunk']:isDrunk()
  5. Get Player Drunk Value
    exports['cs_drunk']:GetDrunkLevel()
  6. Set Player Drunk Value
    exports['cs_drunk']:SetDrunkLevel(value)
  7. Add Player Drunk Value
    exports['cs_drunk']:AddDrunkLevel(value)
  8. Remove Player Drunk Value
    exports['cs_drunk']:RemoveDrunkLevel(value)

Server Sided

  • Get Player Drunk Value
    exports['cs_drunk']:GetDrunkLevel(Player_ID)
  • Set Player Drunk Value
    exports['cs_drunk']:SetDrunkLevel(Player_ID, value)
  • Add Player Drunk Value
    exports['cs_drunk']:AddDrunkLevel(Player_ID, value)
  • Remove Player Drunk Value
    exports['cs_drunk']:RemoveDrunkLevel(Player_ID, value)

Example

Make your items show the drunk percentage in the drunk tester

ESX

Example of how you can increase the drunk percentage when using an item. You can implement the same logic to other items. I have shown you with the beer item under esx_optionalneeds/server/main.lua

QBCore

Example of how you can increase the drunk percentage when using an item. You can implement the same logic for other items or events. I've demonstrated this with the alcohol use item under qb-smallresources/client/consumables.lua

Last updated