Create new item drink

how to create a new drinkable item!

You can add any drink in config.lua look for

  • name

    • The name is the item name (not the label) so whatever item name you put there will get registered to that specific item (on standalone it will be command so example: /item)

  • numbersOfSips

    • The number of sips is how many times the player can sip from the bottle he holds.

  • eachSipGiveDrunk

    • This is how much percentage of alcohol each sip gives to the player

{
    -- name of the item
    name = "beer",
    
    -- This number represents how many sips player can take before the beer will be empty
    -- the maximum number of sips for this item will be 5
    numbersOfSips = 5,
    
    -- This represent how much percentage of drunkenness the player will earn per each sip he takes
    -- numbersOfSips * eachSipGiveDrunk. In this case 2 * 5 = 10% of total drunkenness gained
    eachSipGiveDrunk = 2,
    
    -- This handles the prop placement in the player's hand. Leave as default unless you are an advanced user.
    attachmentInfo = DefaultAttachmentPropertiesOfItem,
    
    -- Should we remove the bottle after player will finish the drink?
    -- true = will delete the prop after finishing the drink
    -- false = will let the prop drop on the ground
    removeBottle = false,    
},

Example of the config:

-- Configurable drunk list
-- here you can add your own item that can be drinkable
Config.DrunkList = {
	{
		-- name of the item
		name = "beer",

		-- This number represents how many sips player can take before the beer will be empty
		-- the maximum number of sips for this item will be 5
		numbersOfSips = 5,

		-- This represent how much percentage of drunkenness the player will earn per each sip he takes
		-- numbersOfSips * eachSipGiveDrunk. In this case 2 * 5 = 10% of total drunkenness gained
		eachSipGiveDrunk = 2,

		-- This handles the prop placement in the player's hand. Leave as default unless you are an advanced user.
		attachmentInfo = DefaultAttachmentPropertiesOfItem,

		-- This option is 100% optional, when the player finishes drinking the alcohol bottle
		-- it will give him a specific item on finishing the drink, for this case it will be `empty_bottle`
		-- giveEmptyBottle = "empty_bottle",        
	},
	-------
	{
		-- name of the item
		name = "another item example",

		-- This number represents how many sips player can take before the item will be empty
		-- the maximum number of sips for this item will be 5
		numbersOfSips = 5,

		-- This represent how much percentage of drunkenness the player will earn per each sip he takes
		-- numbersOfSips * eachSipGiveDrunk. In this case 5 * 5 = 25% of total drunkenness gained
		eachSipGiveDrunk = 5,

		-- This handles the prop placement in the player's hand. Leave as default unless you are an advanced user.
		attachmentInfo = DefaultAttachmentPropertiesOfItem,

		-- This option is 100% optional, when the player finishes drinking the alcohol bottle
		-- it will give him a specific item on finishing the drink, for this case it will be `empty_bottle`
		-- giveEmptyBottle = "empty_bottle",       
	},
	-------
	{
		-- name of the item
		name = "yet again another drink!",

		-- This number represents how many sips player can take before the item will be empty
		-- the maximum number of sips for this item will be 5
		numbersOfSips = 10,

		-- This represent how much percentage of drunkenness the player will earn per each sip he takes
		-- numbersOfSips * eachSipGiveDrunk. In this case 1 * 10 = 10% of total drunkenness gained
		eachSipGiveDrunk = 1,

		-- This handles the prop placement in the player's hand. Leave as default unless you are an advanced user.
		attachmentInfo = DefaultAttachmentPropertiesOfItem,

		-- This option is 100% optional, when the player finishes drinking the alcohol bottle
		-- it will give him a specific item on finishing the drink, for this case it will be `empty_bottle`
		-- giveEmptyBottle = "empty_bottle",       
	},
}

Extra settings for ox_inventory item

Whenever you create a new drink and have Config.ox_inv set to true in your config.lua, the resource will use exports. This means each new item for rcore_drunk must use a specific export name in ox_inventory/data/items.lua.

For example, let's say we create a new item called morgan. The new item should look like this:

['morgan'] = {
    label = 'Captain Morgan',
    weight = 250,
    close = true,
    consume = 0,
    client = {},
    server = {
        export = 'rcore_drunk.morgan',
    },
},

The export will always follow the format: rcore_drunk.ITEMNAME.

Few more examples:

['morgan'] = {
    label = 'Captain Morgan',
    weight = 250,
    close = true,
    consume = 0,
    client = {},
    server = {
        export = 'rcore_drunk.morgan',
    },
},
['daniel'] = {
    label = 'Jack Daniel',
    weight = 250,
    close = true,
    consume = 0,
    client = {},
    server = {
        export = 'rcore_drunk.daniel',
    },
},
['gin'] = {
    label = 'Gin 1L',
    weight = 250,
    close = true,
    consume = 0,
    client = {},
    server = {
        export = 'rcore_drunk.gin',
    },
},

Last updated

Was this helpful?