2025-07-17 02:06:17 -05:00
2024-12-16 03:53:59 -08:00
--[[
effect options
alien
ecstacy
meth
coke
trevor
none
]]
2023-12-07 15:45:48 -08:00
2024-12-16 03:53:59 -08:00
--[[
add = {}
health = number -- amount of health to give
stress = number -- number of stress to give
speed = number -- number of seconds you a fast boi
hunger = number -- number of hunger to fill
thirst = number -- same shit
strength = number -- how long you are strong boi
]]
2025-09-05 21:28:04 -07:00
local Consumables = {}
Consumables.defaulttime = 4000
Consumables.defaultanim = 'pflag2'
Consumables.defaultprogresstext = 'Consuming ' -- it will always show the label of the item being used after what you put here, make sure to keep the space at the end :)
Consumables.defaultstatval = 0
2024-12-16 03:53:59 -08:00
local Consume = {
-- meth
2025-08-09 03:10:00 -06:00
methbags = { time = 4000 , effect = 'meth' , anim = "smoke" , progressbartext = "Injesting" ,
add = { health = - 20 , stress = - 10 , speed = 40 , strength = 10 , thirst = - 30 }},
2024-12-16 03:53:59 -08:00
cokebaggy = { anim = 'smell' , time = 1000 , effect = 'coke' , add = { stress = - 10 }},
cokebaggystagetwo = { anim = 'smell' , time = 1000 , effect = 'coke' , add = { stress = - 10 }},
cokebaggystagethree = { anim = 'smell' , time = 1000 , effect = 'coke' , add = { stress = - 10 }},
-- heroin
heroin_ready = { anim = 'shootup' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
heroin_readystagetwo = { anim = 'shootup' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
heroin_readystagethree = { anim = 'shootup' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
-- crack
baggedcracked = { anim = 'smell' , time = 1000 , effect = 'coke' , add = { stress = - 10 }},
baggedcrackedstagetwo = { anim = 'smell' , time = 1000 , effect = 'coke' , add = { stress = - 10 }},
baggedcrackedstagethree = { anim = 'smell' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
-- xtc
white_playboys = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_playboys2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_playboys3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_playboys4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_playboys = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_playboys2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_playboys3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_playboys4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_playboys = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 , hunger = 10 }},
red_playboys2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_playboys3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_playboys4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_playboys = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_playboy2s = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_playboys3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_playboys4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_aliens = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_aliens2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_aliens3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_aliens4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_aliens = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_aliens2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_aliens3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_aliens4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_aliens = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_aliens3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_aliens2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_aliens4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_aliens = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_aliens2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_aliens3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_aliens4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_pl = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_pl2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_pl3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_pl4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_pl = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_pl2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_pl3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_pl4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_pl = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_pl2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_pl3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_pl4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_pl = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_pl2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_pl3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_pl4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_trolls = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_trolls2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_trolls3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_trolls4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_trolls = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_trolls2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_trolls3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_trolls4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_trolls = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_trolls2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_trolls3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_trolls4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_trolls = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_trolls2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_trolls3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_trolls4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_cats2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_cats3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_cats4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
white_cats = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_cats = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_cats3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_cats2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
blue_cats4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_cats = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_cats2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_cats3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
red_cats4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_cats = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_cats2 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_cats3 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
orange_cats4 = { anim = 'edible' , time = 1000 , effect = 'ecstacy' , add = { stress = - 10 }},
-- weed
specialbrownie = { anim = 'edible' , effect = 'alien' , add = { hunger = 10 , stress = - 10 }},
specialcookie = { anim = 'edible' , effect = 'alien' , add = { hunger = 10 , stress = - 10 }},
specialchocolate = { anim = 'edible' , effect = 'alien' , add = { hunger = 10 , stress = - 10 }},
specialmuffin = { anim = 'edible' , effect = 'alien' , add = { hunger = 10 , stress = - 10 }},
blunt = { anim = 'smokeweed' , effect = 'alien' , add = { stress = - 10 }},
dextroblunts = { anim = 'smokeweed' , effect = 'alien' , add = { stress = - 10 }},
leanblunts = { anim = 'smokeweed' , effect = 'alien' , add = { stress = - 10 }},
chewyblunt = { anim = 'smokeweed' , effect = 'alien' , add = { stress = - 10 }},
-- lean
cupofdextro = { anim = 'cup' , effect = 'alien' , add = { stress = - 10 }},
cupoflean = { anim = 'cup' , effect = 'alien' , add = { stress = - 10 }},
-- lsd
smiley_tabs = { anim = 'edible' , effect = 'trevor' , add = { stress = - 10 }},
wildcherry_tabs = { anim = 'edible' , effect = 'trevor' , add = { stress = - 10 }},
yinyang_tabs = { anim = 'edible' , effect = 'trevor' , add = { stress = - 10 }},
pineapple_tabs = { anim = 'edible' , effect = 'trevor' , add = { stress = - 10 }},
bart_tabs = { anim = 'edible' , effect = 'trevor' , add = { stress = - 10 }},
gratefuldead_tabs = { anim = 'edible' , effect = 'trevor' , add = { stress = - 10 }},
-- pharma
vicodin = { anim = 'pill' , effect = 'none' , add = { health = 20 }},
adderal = { anim = 'pill' , effect = 'none' , add = { stress = - 20 }},
morphine = { anim = 'pill' , effect = 'none' , add = { health = 40 }},
xanax = { anim = 'pill' , effect = 'none' , add = { stress = - 40 }},
}
for k , v in pairs ( Consume ) do
2025-08-09 03:10:00 -06:00
ps.createUseable ( k , function ( source , item )
if not ps.hasItem ( source , k , 1 ) then return end
2024-10-24 19:45:39 -07:00
local time = v.time or Consumables.defaulttime
local effect = v.effect or 0
local anim = v.anim or Consumables.defaultanim
2025-08-09 03:10:00 -06:00
local progressbartext = v.progressbartext or Consumables.defaultprogresstext
2024-10-24 19:45:39 -07:00
local add = v.add or { hunger = 0 }
2025-08-09 03:10:00 -06:00
local done = ps.callback ( 'md-drugs:client:consumedrugs' , source , time , effect , anim , progressbartext , add , k )
2024-12-16 03:53:59 -08:00
if done then
2025-08-09 03:10:00 -06:00
ps.removeItem ( source , k , 1 )
2024-12-16 03:53:59 -08:00
end
2024-10-24 19:45:39 -07:00
end )
2023-12-07 15:45:48 -08:00
end
2024-05-02 18:34:49 -07:00
RegisterNetEvent ( 'md-drugs:server:updatestatus' , function ( stat , statval )
2025-09-05 21:28:04 -07:00
local src = source
local Player = ps.getPlayer ( src )
if GetResourceState ( 'es_extended' ) == 'started' then return end
2024-12-16 03:53:59 -08:00
local hunger , thirst = Player.PlayerData . metadata.hunger , Player.PlayerData . metadata.thirst
2024-05-02 18:34:49 -07:00
if stat == "thirst" then
2024-12-16 03:53:59 -08:00
local value = thirst + statval
2024-05-02 18:34:49 -07:00
Player.Functions . SetMetaData ( 'thirst' , value )
2025-09-05 21:28:04 -07:00
TriggerClientEvent ( 'hud:client:UpdateNeeds' , src , hunger , value )
2024-12-16 03:53:59 -08:00
elseif stat == "hunger" then
local value = hunger + statval
Player.Functions . SetMetaData ( 'hunger' , value )
2025-09-05 21:28:04 -07:00
TriggerClientEvent ( 'hud:client:UpdateNeeds' , src , value , thirst )
elseif stat == "stress" then
2024-10-22 16:44:56 -07:00
local value = Player.PlayerData . metadata.stress + statval
2024-05-02 18:34:49 -07:00
Player.Functions . SetMetaData ( 'stress' , value )
2025-09-05 21:28:04 -07:00
TriggerClientEvent ( 'hud:client:UpdateStress' , src , Player.PlayerData . metadata.stress , value )
2024-05-02 18:34:49 -07:00
elseif stat == "armor" then
local value = Player.PlayerData . metadata.armor + statval
2025-09-05 21:28:04 -07:00
TriggerEvent ( 'hospital:server:SetArmor' , value )
TriggerClientEvent ( 'hud:client:UpdateStress' , src , Player.PlayerData . metadata.armor , value )
2024-05-02 18:34:49 -07:00
end
2024-10-22 16:44:56 -07:00
end )