Configuration
Every config option for pixel-consumables, with examples.
On this page9
Basic explanation
The in-game editor
/consumables, or Config.UIKey, opens an editor for Config.ConsumablesCustom. It is
gated behind the same pixel.admin ace, on every action rather than only on opening,
and it can add, rename, delete and edit items.
Prop aligner
coords and rotation are meant to be found in-world rather than typed in. The prop and
prop2 blocks each have an align button in the editor, which spawns the prop on the bone
you picked, plays the item's animation, freezes the player and puts you on a script camera
until you leave. The button only does anything once the block has a model and the item
has an animDict and anim.
Saving hands the coords and rotation back to the item's form. They reach config.lua
when you save the item itself, on the same rewrite the callout above describes.
Examples and lists
-- Below is an example of removing a cola and receiving back an empty can.
['item'] = {
remove = {
{ item = 'pixelcola', amount = 1 }, -- Item and amount to remove upon consumable use
},
receive = {
{ item = 'emptycan', amount = 1 }, -- Item and amount to receive upon consumable use (set to nil for no item)
},
},Both are lists, so an item can remove or hand back more than one thing. They are also the
security allowlist: on startup the server reads every remove and receive in the config
and will not remove an item no remove names, or hand out an item no receive names.
-- Below is an example of one item raising both needs by the same amount.
['replenish'] = {
type = { 'Hunger', 'Thirst' },
amount = 10, -- Amount to replenish
max = nil, -- The max threshold to replenish to
},-- Below is an example of raising both needs by different amounts.
['replenish'] = {
{ type = 'Hunger', amount = 20, max = nil },
{ type = 'Thirst', amount = 5, max = nil },
},'Hunger' and 'Thirst' are the only two values, capitalisation included, and anything
else is ignored. deplete takes both of the same forms with min in place of max. The
two blocks are merged into one write, so a single item can raise thirst and lower hunger.
-- Below is an example of drinking 5 to get light effects and 7 for heavy effects.
['alcohol'] = {
lightalcohol = 5, -- Amount drank where light alcohol effects start
heavyalcohol = 7, -- Amount drank where heavy alcohol effects start
duration = 120, -- Duration of alcohol effects (1 = 1 second)
},Set both values. The count is drinks taken this session, shared across every alcoholic item rather than tracked per item, and it resets to zero once an effect has run its course.
-- Below is a list of all possible drug effects.
['drug'] = {
drugeffect = {
'psychedelic',
'brightpsychedelic',
'foggy',
'flicker',
'dizzy',
'shaking',
'hallucination',
'focus'
},
duration = 120, -- Duration of drug effects (1 = 1 second)
},Every effect on the list shares the one duration.
hallucination re-dresses nearby peds into appearances read from
Config.HallucinationAppearances, and puts them back exactly as they were when the effect
ends. config.lua ships six placeholder entries so the effect works out of the box.
Peds are re-dressed, not remodelled. Changing a ped's model means deleting and
respawning it, which is not safe to do to networked world entities. So an entry only
applies to peds already wearing its model. In practice that means other players and
freemode NPCs; stock ambient peds (a_m_y_hipster_01 and friends) are left alone unless
you add entries for their models.
Writing appearances
Do not write these by hand. Dress up in-game, run /copyped
from pixel-utils, and paste the block it prints:
Config.HallucinationAppearances = {
['suit_m'] = {
model = 'mp_m_freemode_01',
components = {
{ component_id = 4, drawable = 10, texture = 0 },
{ component_id = 11, drawable = 4, texture = 0 },
},
props = {
{ prop_id = 1, drawable = 5, texture = 0 },
},
hair = { style = 4, texture = 0, color = 0, highlight = 0 },
eyeColor = 2,
},
}Capture and playback both go through pixel-utils' appearance module, so anything /copyped
emits is understood here: headBlend, faceFeatures, headOverlays, hair, eyeColor,
tattoos, components and props.
A capture records clothing as a collection name plus a local index, which survives you adding, removing or reordering DLC clothing packs later. Plain numbers written by hand are treated as legacy global indices and still work, but they shift when your pack list changes. That is another reason to capture rather than type.
Keys are cosmetic: both a named table and a plain list work.
The in-game editor regenerates config.lua on every save, and it rewrites
Config.HallucinationAppearances verbatim, so captures you paste in survive editing items.
Comments you add around them do not.
-- Below is a list of all possible buff effects with and without values
['buffs'] = {
novaluebuff = {
'nostress', -- No stress will be received from this resource.
'stamina', -- No stamina will be drained.
'superjump', -- Will be able to do super jumps.
'energy' -- Sets a flag for the exports to read, no game effect of its own.
},
valuebuff = {
strength = 2.0, -- Melee damage multiplier, applied while unarmed.
running = 1.2, -- Sprint multiplier. The game ignores anything above 1.49.
swimming = 1.2, -- Swim multiplier. The game ignores anything above 1.49.
health = 2, -- Health added every 2 seconds
armor = 2 -- Armour added every 2 seconds
},
duration = 120, -- Duration of the buffs (1 = 1 second)
}duration is shared by both lists, and it is required. nostress only suppresses the
stress this resource applies while it is running, so stress from other resources still
lands.
Integration with other scripts
Below is a guide with everything needed to add or change for integration with r14-evidence.
- You will need to download the latest version of our consumables in order for this to work.
- You must replace the specified lines in the specified files with the code below.
pixel-consumables:alcohol and pixel-consumables:drugs are declared in
client/editable.lua and fire on the client with the item name as their only argument,
which is what alcoholArgPos and drugArgPos point at. An item fires the alcohol event
when its alcohol block sets either value, and the drug event when its drug block sets
drugeffect.
Config.Breathalyzer
In r14-evidence/config.lua, around line 210.
Config.Breathalyzer = {
Enabled = true,
UsingESX = false,
EventTriggers = {
[1] = {
event = 'pixel-consumables:alcohol',
type = 'client',
alcoholArgPos = 1,
alcoholArgValue = {
['pixelbeer'] = 10,
['pixelwhiskey'] = 300,
['pixelvodka'] = 300,
['pixelchampagne'] = 120,
['pixeltequilla'] = 300,
['pixelwine'] = 150,
},
},
},
}Config.DrugTesting
In r14-evidence/config.lua, around line 256.
Drug status trigger
In r14-evidence/client/main.lua, around line 1217.
local drugType = checkValue[checkArg]
local positiveTime = v.positiveTime or Config.DrugTesting.DefaultPositiveTime
TriggerServerEvent('evidence:server:SetDrugStatus', {drug = drugType, hours = positiveTime})