mirror of
https://github.com/jimathy/jim-consumables.git
synced 2026-08-17 06:26:03 +01:00
v1.2 - ps-buffs support / screen effect changes
This commit is contained in:
53
README.md
53
README.md
@@ -14,15 +14,50 @@ It already takes control of default qbcore food and drink, but you would probabl
|
||||
To add an item, you only need to add a new item table in the Config.Consumables like this:
|
||||
```lua
|
||||
["heartstopper"] = {
|
||||
emote = "burger", -- Select an emote from below, it has to be in here
|
||||
time = math.random(5000, 6000), -- Amount of time it takes to consume the item
|
||||
stress = math.random(1,2), -- Amount of stress relief, can be 0
|
||||
heal = 0, -- Set amount to heal by after consuming
|
||||
armor = 5, -- Amount of armor to add
|
||||
type = "food", -- Type: "alcohol" / "drink" / "food"
|
||||
effect = { effect = "healdouble", }, -- The status effect given by the item, "heal" / "healdouble" / "stamina"
|
||||
stats = { hunger = math.random(10,20), }, -- The stats of the item, if not found in the items.lua
|
||||
emote = "burger", -- Select an emote from below, it has to be in here
|
||||
time = math.random(5000, 6000), -- Amount of time it takes to consume the item
|
||||
stress = math.random(1,2), -- Amount of stress relief, can be 0
|
||||
heal = 0, -- Set amount to heal by after consuming
|
||||
armor = 5, -- Amount of armor to add
|
||||
type = "food", -- Type: "alcohol" / "drink" / "food"
|
||||
stats = {
|
||||
screen = "rampage" -- The screen effect to be played when after consuming the item
|
||||
effect = "heal", -- The status effect given by the item, "heal" / "stamina"
|
||||
time = 10000, -- How long the effect should last (if not added it will default to 10000)
|
||||
amount = 2, -- How much the value is changed by per second
|
||||
hunger = math.random(10,20), -- The hunger/thirst stats of the item, if not found in the items.lua
|
||||
thirst = math.random(10,20), -- The hunger/thirst stats of the item, if not found in the items.lua
|
||||
},
|
||||
},
|
||||
```
|
||||
Consuming an item can also manually activate screen effects
|
||||
|
||||
This script supports dpemotes style emotes, so if you have some that you want to be triggered when eating or drinking drop it in the Config.Emotes
|
||||
The example above uses `rampage` as this is what the effect is named after, you can use it for any item you think best
|
||||
```lua
|
||||
--The current list of effects are:
|
||||
"turbo"
|
||||
"focus"
|
||||
"rampage"
|
||||
"weed"
|
||||
"trevor"
|
||||
```
|
||||
|
||||
## PS-Buffs Support
|
||||
This scripts can be expanded with ps-buffs (https://github.com/Project-Sloth/ps-buffs)
|
||||
|
||||
If this script is enabled it will automatically try to use their system to apply buffs:
|
||||
|
||||
```lua
|
||||
--The extra buffs that can be set include:
|
||||
"heal" -- Health recovery buff
|
||||
"stamina" -- Stamina recovery buff
|
||||
"swimming" -- Swimming speed buff
|
||||
"stress" -- Stress recovery buff
|
||||
"armor" -- Armour recovery buff
|
||||
"hacking" -- Hacking effect
|
||||
"intelligence" -- Intelligence effect
|
||||
"luck" -- Luck effect
|
||||
"strength" -- Strength effect
|
||||
```
|
||||
|
||||
This script supports dpemotes style emotes, so if you have some that you want to be triggered when eating or drinking drop it in the Config.Emotes section.
|
||||
@@ -18,13 +18,13 @@ for k in pairs(Config.Emotes) do
|
||||
end
|
||||
end
|
||||
|
||||
--Alcohol Effects
|
||||
--Screen Effects
|
||||
local alienEffect = false
|
||||
function AlienEffect()
|
||||
if alienEffect then return end
|
||||
alienEffect = true
|
||||
if Config.Debug then print("^5Debug^7: ^3AlienEffect^7() ^2activated") end
|
||||
StartScreenEffect("DrugsMichaelAliensFightIn", 3.0, 0)
|
||||
AnimpostfxPlay("DrugsMichaelAliensFightIn", 3.0, 0)
|
||||
Wait(math.random(5000, 8000))
|
||||
local Ped = PlayerPedId()
|
||||
local animDict = "MOVE_M@DRUNK@VERYDRUNK"
|
||||
@@ -47,90 +47,120 @@ function AlienEffect()
|
||||
SetPedMotionBlur(Ped, false)
|
||||
AnimpostfxStopAll()
|
||||
ShakeGameplayCam('DRUNK_SHAKE', 0.0)
|
||||
StartScreenEffect("DrugsMichaelAliensFight", 3.0, 0)
|
||||
AnimpostfxPlay("DrugsMichaelAliensFight", 3.0, 0)
|
||||
Wait(math.random(45000, 60000))
|
||||
StartScreenEffect("DrugsMichaelAliensFightOut", 3.0, 0)
|
||||
StopScreenEffect("DrugsMichaelAliensFightIn")
|
||||
StopScreenEffect("DrugsMichaelAliensFight")
|
||||
StopScreenEffect("DrugsMichaelAliensFightOut")
|
||||
AnimpostfxPlay("DrugsMichaelAliensFightOut", 3.0, 0)
|
||||
AnimpostfxStop("DrugsMichaelAliensFightIn")
|
||||
AnimpostfxStop("DrugsMichaelAliensFight")
|
||||
AnimpostfxStop("DrugsMichaelAliensFightOut")
|
||||
alienEffect = false
|
||||
if Config.Debug then print("^5Debug^7: ^3AlienEffect^7() ^2stopped") end
|
||||
end
|
||||
--Weed Effects
|
||||
local weedEffect = false
|
||||
function WeedEffect()
|
||||
if weedEffect then return end
|
||||
weedEffect = true
|
||||
if Config.Debug then print("^5Debug^7: ^3WeedEffect^7() ^2activated") end
|
||||
StartScreenEffect("DrugsMichaelAliensFightIn", 3.0, 0)
|
||||
AnimpostfxPlay("DrugsMichaelAliensFightIn", 3.0, 0)
|
||||
Wait(math.random(3000, 20000))
|
||||
StartScreenEffect("DrugsMichaelAliensFight", 3.0, 0)
|
||||
AnimpostfxPlay("DrugsMichaelAliensFight", 3.0, 0)
|
||||
Wait(math.random(15000, 20000))
|
||||
StartScreenEffect("DrugsMichaelAliensFightOut", 3.0, 0)
|
||||
StopScreenEffect("DrugsMichaelAliensFightIn")
|
||||
StopScreenEffect("DrugsMichaelAliensFight")
|
||||
StopScreenEffect("DrugsMichaelAliensFightOut")
|
||||
AnimpostfxPlay("DrugsMichaelAliensFightOut", 3.0, 0)
|
||||
AnimpostfxStop("DrugsMichaelAliensFightIn")
|
||||
AnimpostfxStop("DrugsMichaelAliensFight")
|
||||
AnimpostfxStop("DrugsMichaelAliensFightOut")
|
||||
weedEffect = false
|
||||
if Config.Debug then print("^5Debug^7: ^3WeedEffect^7() ^2stopped") end
|
||||
end
|
||||
--Other Effects
|
||||
local trevorEffect = false
|
||||
function TrevorEffect()
|
||||
if trevorEffect then return end
|
||||
if Config.Debug then print("^5Debug^7: ^3TrevorEffect^7() ^2activated") end
|
||||
trevorEffect = true
|
||||
StartScreenEffect("DrugsTrevorClownsFightIn", 3.0, 0)
|
||||
AnimpostfxPlay("DrugsTrevorClownsFightIn", 3.0, 0)
|
||||
Wait(3000)
|
||||
StartScreenEffect("DrugsTrevorClownsFight", 3.0, 0)
|
||||
AnimpostfxPlay("DrugsTrevorClownsFight", 3.0, 0)
|
||||
Wait(30000)
|
||||
StartScreenEffect("DrugsTrevorClownsFightOut", 3.0, 0)
|
||||
StopScreenEffect("DrugsTrevorClownsFight")
|
||||
StopScreenEffect("DrugsTrevorClownsFightIn")
|
||||
StopScreenEffect("DrugsTrevorClownsFightOut")
|
||||
AnimpostfxPlay("DrugsTrevorClownsFightOut", 3.0, 0)
|
||||
AnimpostfxStop("DrugsTrevorClownsFight")
|
||||
AnimpostfxStop("DrugsTrevorClownsFightIn")
|
||||
AnimpostfxStop("DrugsTrevorClownsFightOut")
|
||||
trevorEffect = false
|
||||
if Config.Debug then print("^5Debug^7: ^3TrevorEffect^7() ^2stopped") end
|
||||
end
|
||||
|
||||
local healEffectDouble = false
|
||||
function HealEffectDouble()
|
||||
if healEffectDouble then return end
|
||||
if Config.Debug then print("^5Debug^7: ^3HealEffectDouble^7() ^2activated") end
|
||||
healEffectDouble = true
|
||||
local count = 9
|
||||
while count > 0 do
|
||||
Wait(1000)
|
||||
count = count - 1
|
||||
SetEntityHealth(PlayerPedId(), GetEntityHealth(PlayerPedId()) + 6)
|
||||
end
|
||||
healEffectDouble = false
|
||||
if Config.Debug then print("^5Debug^7: ^3HealEffectDouble^7() ^2stopped") end
|
||||
local turboEffect = false
|
||||
function TurboEffect()
|
||||
if turboEffect then return end
|
||||
if Config.Debug then print("^5Debug^7: ^3TurboEffect^7() ^2activated") end
|
||||
turboEffect = true
|
||||
AnimpostfxPlay('RaceTurbo', 0, true)
|
||||
SetTimecycleModifier('rply_motionblur')
|
||||
ShakeGameplayCam('SKY_DIVING_SHAKE', 0.25)
|
||||
Wait(30000)
|
||||
StopGameplayCamShaking(true)
|
||||
SetTransitionTimecycleModifier('default', 0.35)
|
||||
Wait(1000)
|
||||
ClearTimecycleModifier()
|
||||
AnimpostfxStop('RaceTurbo')
|
||||
turboEffect = false
|
||||
if Config.Debug then print("^5Debug^7: ^3TurboEffect^7() ^2stopped") end
|
||||
end
|
||||
local rampageEffect = false
|
||||
function RampageEffect()
|
||||
if rampageEffect then return end
|
||||
if Config.Debug then print("^5Debug^7: ^3RampageEffect^7() ^2activated") end
|
||||
rampageEffect = true
|
||||
AnimpostfxPlay('Rampage', 0, true)
|
||||
SetTimecycleModifier('rply_motionblur')
|
||||
ShakeGameplayCam('SKY_DIVING_SHAKE', 0.25)
|
||||
Wait(30000)
|
||||
StopGameplayCamShaking(true)
|
||||
SetTransitionTimecycleModifier('default', 0.35)
|
||||
Wait(1000)
|
||||
ClearTimecycleModifier()
|
||||
AnimpostfxStop('Rampage')
|
||||
rampageEffect = false
|
||||
if Config.Debug then print("^5Debug^7: ^3RampageEffect^7() ^2stopped") end
|
||||
end
|
||||
local focusEffect = false
|
||||
function FocusEffect()
|
||||
if focusEffect then return end
|
||||
if Config.Debug then print("^5Debug^7: ^3FocusEffect^7() ^2activated") end
|
||||
focusEffect = true
|
||||
AnimpostfxPlay('FocusIn', 0, true)
|
||||
Wait(30000)
|
||||
Wait(1000)
|
||||
AnimpostfxStop('FocusIn')
|
||||
focusEffect = false
|
||||
if Config.Debug then print("^5Debug^7: ^3FocusEffect^7() ^2stopped") end
|
||||
end
|
||||
|
||||
--Built-in Buff effects
|
||||
local healEffect = false
|
||||
function HealEffect()
|
||||
function HealEffect(data)
|
||||
if healEffect then return end
|
||||
if Config.Debug then print("^5Debug^7: ^3HealEffect^7() ^2activated") end
|
||||
healEffect = true
|
||||
local count = 4
|
||||
local count = (data[1] / 1000)
|
||||
while count > 0 do
|
||||
Wait(1000)
|
||||
count = count - 1
|
||||
SetEntityHealth(PlayerPedId(), GetEntityHealth(PlayerPedId()) + 6)
|
||||
SetEntityHealth(PlayerPedId(), GetEntityHealth(PlayerPedId()) + data[2])
|
||||
end
|
||||
healEffect = false
|
||||
if Config.Debug then print("^5Debug^7: ^3HealEffect^7() ^2stopped") end
|
||||
end
|
||||
|
||||
local staminaEffect = false
|
||||
function StaminaEffect()
|
||||
function StaminaEffect(data)
|
||||
if staminaEffect then return end
|
||||
if Config.Debug then print("^5Debug^7: ^3StaminaEffect^7() ^2activated") end
|
||||
staminaEffect = true
|
||||
local startStamina = 8
|
||||
local startStamina = (data[1] / 1000)
|
||||
SetRunSprintMultiplierForPlayer(PlayerId(), 1.49)
|
||||
while startStamina > 0 do
|
||||
Wait(1000)
|
||||
if math.random(5, 100) < 10 then RestorePlayerStamina(PlayerId(), 1.0) end
|
||||
if math.random(5, 100) < 10 then RestorePlayerStamina(PlayerId(), data[2]) end
|
||||
startStamina = startStamina - 1
|
||||
if math.random(5, 100) < 51 then end
|
||||
end
|
||||
@@ -149,86 +179,17 @@ function StopEffects()
|
||||
ResetPedMovementClipset(PlayerPedId(), 0)
|
||||
SetPedIsDrunk(PlayerPedId(), false)
|
||||
SetPedMotionBlur(PlayerPedId(), false)
|
||||
StopScreenEffect("DrugsMichaelAliensFightIn")
|
||||
StopScreenEffect("DrugsMichaelAliensFight")
|
||||
StopScreenEffect("DrugsMichaelAliensFightOut")
|
||||
StopScreenEffect("DrugsTrevorClownsFight")
|
||||
StopScreenEffect("DrugsTrevorClownsFightIn")
|
||||
StopScreenEffect("DrugsTrevorClownsFightOut")
|
||||
AnimpostfxStop("DrugsMichaelAliensFightIn")
|
||||
AnimpostfxStop("DrugsMichaelAliensFight")
|
||||
AnimpostfxStop("DrugsMichaelAliensFightOut")
|
||||
AnimpostfxStop("DrugsTrevorClownsFight")
|
||||
AnimpostfxStop("DrugsTrevorClownsFightIn")
|
||||
AnimpostfxStop("DrugsTrevorClownsFightOut")
|
||||
AnimpostfxStop('RaceTurbo')
|
||||
AnimpostfxStop('FocusIn')
|
||||
AnimpostfxStop('Rampage')
|
||||
end
|
||||
|
||||
--[[function EcstasyEffect()
|
||||
local startStamina = 30
|
||||
SetFlash(0, 0, 500, 7000, 500)
|
||||
while startStamina > 0 do
|
||||
Wait(1000)
|
||||
startStamina = startStamina - 1
|
||||
RestorePlayerStamina(PlayerId(), 1.0)
|
||||
if math.random(1, 100) < 51 then
|
||||
SetFlash(0, 0, 500, 7000, 500)
|
||||
ShakeGameplayCam('SMALL_EXPLOSION_SHAKE', 0.08)
|
||||
end
|
||||
end
|
||||
if IsPedRunning(PlayerPedId()) then
|
||||
SetPedToRagdoll(PlayerPedId(), math.random(1000, 3000), math.random(1000, 3000), 3, 0, 0, 0)
|
||||
end
|
||||
|
||||
startStamina = 0
|
||||
end
|
||||
|
||||
function CrackBaggyEffect()
|
||||
local startStamina = 8
|
||||
local ped = PlayerPedId()
|
||||
--AlienEffect()
|
||||
SetRunSprintMultiplierForPlayer(PlayerId(), 1.3)
|
||||
while startStamina > 0 do
|
||||
Wait(1000)
|
||||
if math.random(1, 100) < 10 then
|
||||
RestorePlayerStamina(PlayerId(), 1.0)
|
||||
end
|
||||
startStamina = startStamina - 1
|
||||
if math.random(1, 100) < 60 and IsPedRunning(ped) then
|
||||
SetPedToRagdoll(ped, math.random(1000, 2000), math.random(1000, 2000), 3, 0, 0, 0)
|
||||
end
|
||||
if math.random(1, 100) < 51 then
|
||||
--AlienEffect()
|
||||
end
|
||||
end
|
||||
if IsPedRunning(ped) then
|
||||
SetPedToRagdoll(ped, math.random(1000, 3000), math.random(1000, 3000), 3, 0, 0, 0)
|
||||
end
|
||||
|
||||
startStamina = 0
|
||||
SetRunSprintMultiplierForPlayer(PlayerId(), 1.0)
|
||||
end
|
||||
|
||||
function CokeBaggyEffect()
|
||||
local startStamina = 20
|
||||
local ped = PlayerPedId()
|
||||
--AlienEffect()
|
||||
SetRunSprintMultiplierForPlayer(PlayerId(), 1.1)
|
||||
while startStamina > 0 do
|
||||
Wait(1000)
|
||||
if math.random(1, 100) < 20 then
|
||||
RestorePlayerStamina(PlayerId(), 1.0)
|
||||
end
|
||||
startStamina = startStamina - 1
|
||||
if math.random(1, 100) < 10 and IsPedRunning(ped) then
|
||||
SetPedToRagdoll(ped, math.random(1000, 3000), math.random(1000, 3000), 3, 0, 0, 0)
|
||||
end
|
||||
if math.random(1, 300) < 10 then
|
||||
--AlienEffect()
|
||||
Wait(math.random(3000, 6000))
|
||||
end
|
||||
end
|
||||
if IsPedRunning(ped) then
|
||||
SetPedToRagdoll(ped, math.random(1000, 3000), math.random(1000, 3000), 3, 0, 0, 0)
|
||||
end
|
||||
|
||||
startStamina = 0
|
||||
SetRunSprintMultiplierForPlayer(PlayerId(), 1.0)
|
||||
end]]
|
||||
|
||||
local consuming = false
|
||||
local cancelled = false
|
||||
|
||||
@@ -356,61 +317,52 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
|
||||
TriggerEvent("evidence:client:SetStatus", "alcohol", 200)
|
||||
elseif alcoholCount >= 4 then
|
||||
TriggerEvent("evidence:client:SetStatus", "heavyalcohol", 200)
|
||||
CreateThread(function()
|
||||
AlienEffect()
|
||||
end)
|
||||
CreateThread(function() AlienEffect() end) -- Used as overdosing/too drunk effect
|
||||
end
|
||||
end
|
||||
|
||||
stats = Config.Consumables[itemName].stats or nil
|
||||
stats = Config.Consumables[itemName].stats or nil
|
||||
|
||||
if Config.Consumables[itemName].stats then
|
||||
if stats.screen then -- Screen effect activation
|
||||
if stats.screen == "turbo" then CreateThread(function() TurboEffect() end) end
|
||||
if stats.screen == "focus" then CreateThread(function() FocusEffect() end) end
|
||||
if stats.screen == "rampage" then CreateThread(function() RampageEffect() end) end
|
||||
if stats.screen == "weed" then CreateThread(function() WeedEffect() end) end
|
||||
if stats.screen == "trevor" then CreateThread(function() TrevorEffect() end) end
|
||||
end
|
||||
|
||||
if Config.Consumables[itemName].stats then
|
||||
if stats.canOD then
|
||||
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Current ^4drugCount^7: ^6"..(drugCount + 1)) end
|
||||
drugCount = drugCount + 1
|
||||
if drugCount >= 4 then
|
||||
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Current ^4drugCount^7: ^6"..drugCount.."^7 - ^2 removing health") end
|
||||
SetEntityHealth(PlayerPedId(), GetEntityHealth(PlayerPedId()) - math.random(10,15))
|
||||
if drugCount >= 6 then
|
||||
CreateThread(function()
|
||||
AlienEffect()
|
||||
end)
|
||||
if drugCount >= 7 then
|
||||
CreateThread(function() AlienEffect() end) -- If too many drugs, if not dead will make you stumble
|
||||
end
|
||||
end
|
||||
end
|
||||
if stats.effect == "weed" then
|
||||
if drugCount >= 2 then
|
||||
CreateThread(function()
|
||||
TrevorEffect()
|
||||
end)
|
||||
end
|
||||
end
|
||||
if stats.effect == "heal" then
|
||||
CreateThread(function()
|
||||
HealEffect()
|
||||
end)
|
||||
end
|
||||
if stats.effect == "healdouble" then
|
||||
CreateThread(function()
|
||||
HealEffect()
|
||||
end)
|
||||
end
|
||||
if GetResourceState("ps-buffs") == "started" then exports["ps-buffs"]:AddHealthBuff((stats.effect.time or 10000), (stats.amount or 6))
|
||||
else CreateThread(function() HealEffect({(stats.effect.time or 10000), (stats.amount or 6)}) end) end
|
||||
end
|
||||
if stats.effect == "stamina" then
|
||||
CreateThread(function()
|
||||
StaminaEffect()
|
||||
end)
|
||||
if drugCount >= 4 then
|
||||
CreateThread(function()
|
||||
TrevorEffect()
|
||||
end)
|
||||
end
|
||||
end
|
||||
if stats.widepupils then
|
||||
TriggerEvent("evidence:client:SetStatus", "widepupils", 200)
|
||||
--EcstasyEffect()
|
||||
if GetResourceState("ps-buffs") == "started" then exports["ps-buffs"]:StaminaBuffEffect((stats.effect.time or 10000), (stats.amount or 6))
|
||||
else CreateThread(function() StaminaEffect({(stats.effect.time or 10000), (stats.amount or 6)}) end) end
|
||||
end
|
||||
if GetResourceState("ps-buffs") == "started" then --PS-BUFFS ONLY
|
||||
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^4PS^7-^4Buffs ^2found^7, ^2hooking in to get buffs") end
|
||||
if stats.effect == "armor" then exports["ps-buffs"]:AddArmorBuff((stats.effect.time or 10000), (stats.amount or 6)) end
|
||||
if stats.effect == "stress" then exports["ps-buffs"]:AddStressBuff((stats.time or 10000), (stats.amount or 6)) end
|
||||
if stats.effect == "swimming" then exports["ps-buffs"]:SwimmingBuffEffect((stats.effect.time or 10000), (stats.amount or 6)) end
|
||||
if stats.effect == "hacking" then exports["ps-buffs"]:AddBuff("hacking", (stats.effect.time or 10000)) end
|
||||
if stats.effect == "intelligence" then exports["ps-buffs"]:AddBuff("intelligence", (stats.effect.time or 10000)) end
|
||||
if stats.effect == "luck" then exports["ps-buffs"]:AddBuff("luck", (stats.time or 10000)) end
|
||||
if stats.effect == "strength" then exports["ps-buffs"]:AddBuff("strength", (stats.time or 10000)) end
|
||||
end
|
||||
if stats.widepupils then TriggerEvent("evidence:client:SetStatus", "widepupils", 200) end
|
||||
end
|
||||
|
||||
end
|
||||
cancelled = false
|
||||
consuming = false
|
||||
|
||||
38
config.lua
38
config.lua
@@ -1,4 +1,4 @@
|
||||
print("^2Jim^7-^2Consumables v^41^7.^41 ^7- ^2Consumables Script by ^1Jimathy^7")
|
||||
print("^2Jim^7-^2Consumables v^41^7.^42 ^7- ^2Consumables Script by ^1Jimathy^7")
|
||||
|
||||
-- If you need support I now have a discord available, it helps me keep track of issues and give better support.
|
||||
|
||||
@@ -8,7 +8,9 @@ Config = {
|
||||
Debug = false,
|
||||
Consumables = {
|
||||
-- Default QB food and drink item override
|
||||
["vodka"] = { emote = "vodkab", time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "alcohol", stats = { thirst = math.random(10,20), canOD = true }},
|
||||
|
||||
--Effects can be applied here, like stamina on coffee for example
|
||||
["vodka"] = { emote = "vodkab", time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
|
||||
["beer"] = { emote = "beer", time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "alcohol", stats = { thirst = math.random(10,20), canOD = true }},
|
||||
["whiskey"] = { emote = "whiskey", time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "alcohol", stats = { thirst = math.random(10,20), canOD = true }},
|
||||
|
||||
@@ -17,37 +19,43 @@ Config = {
|
||||
["snikkel_candy"] = { emote = "egobar", time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,20), }},
|
||||
["tosti"] = { emote = "sandwich", time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,20), }},
|
||||
|
||||
["coffee"] = { emote = "coffee", time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(10,20), }},
|
||||
["coffee"] = { emote = "coffee", time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { effect = "stamina", time = 10000, thirst = math.random(10,20), }},
|
||||
["water_bottle"] = { emote = "drink", time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(10,20), }},
|
||||
["kurkakola"] = { emote = "ecola", time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(10,20), }},
|
||||
|
||||
--[[----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Items that effect status changes, like bleeding can cause problems as they are all handled in their own scripts
|
||||
-- Testing these but they may be best left handled by default scripts
|
||||
["ifaks"] = { emote = "oxy", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 10, armor = 0, type = "drug", },
|
||||
["bandage"] = { emote = "oxy", time = math.random(5000, 6000), stress = 0, heal = 10, armor = 0, type = "drug", },
|
||||
["ifaks"] = { emote = "oxy", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 10, armor = 0, type = "drug", stats = { effect = "heal", amount = 6, widepupils = false, canOD = false } },
|
||||
["bandage"] = { emote = "oxy", time = math.random(5000, 6000), stress = 0, heal = 10, armor = 0, type = "drug", stats = { effect = "heal", amount = 3, widepupils = false, canOD = false } }, },]]
|
||||
|
||||
--Testing effects & armor with small functionality to drugs - This may be another one left to default scripts
|
||||
["joint"] = { emote = "smoke3", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", stats = { effect = "weed", widepupils = false, canOD = false } },
|
||||
["joint"] = { emote = "smoke3", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", stats = { screen = "weed", effect = "armor", widepupils = false, canOD = false } },
|
||||
|
||||
["cokebaggy"] = { emote = "coke", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", stats = { effect = "stamina", widepupils = false, canOD = true } },
|
||||
["crackbaggy"] = { emote = "coke", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", stats = { effect = "heal", widepupils = false, canOD = true } },
|
||||
["xtcbaggy"] = { emote = "oxy", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", stats = { effect = "stamina", widepupils = true, canOD = true } },
|
||||
["oxy"] = { emote = "oxy", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", stats = { effect = "heal", widepupils = false, canOD = false } },
|
||||
["cokebaggy"] = { emote = "coke", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 0, type = "drug", stats = { screen = "focus", effect = "stamina", widepupils = false, canOD = true } },
|
||||
--["crackbaggy"] = { emote = "coke", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 0, type = "drug", stats = { effect = "heal", widepupils = false, canOD = true } },
|
||||
["xtcbaggy"] = { emote = "oxy", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", stats = { effect = "strength", widepupils = true, canOD = true } },
|
||||
["oxy"] = { emote = "oxy", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 0, type = "drug", stats = { effect = "heal", widepupils = false, canOD = false } },
|
||||
["meth"] = { emote = "coke", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", stats = { effect = "stamina", widepupils = false, canOD = true } },
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]]
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--[[
|
||||
Example item
|
||||
--Example item
|
||||
["heartstopper"] = {
|
||||
emote = "burger", -- Select an emote from below, it has to be in here
|
||||
time = math.random(5000, 6000), -- Amount of time it takes to consume the item (if nil, this is the default)
|
||||
time = math.random(5000, 6000), -- Amount of time it takes to consume the item
|
||||
stress = math.random(1,2), -- Amount of stress relief, can be 0
|
||||
heal = 0, -- Set amount to heal by after consuming
|
||||
armor = 5, -- Amount of armor to add
|
||||
type = "food", -- Type: "alcohol" / "drink" / "food"
|
||||
effect = { effect = "healdouble", }, -- The status effect given by the item, "heal" / "healdouble" / "stamina"
|
||||
stats = { hunger = math.random(10,20), }, -- The stats of the item, if not found in the items.lua
|
||||
stats = {
|
||||
screen = "rampage" -- The screen effect to be played when after consuming the item
|
||||
effect = "heal", -- The status effect given by the item, "heal" / "stamina"
|
||||
time = 10000, -- How long the effect should last (if not added it will default to 10000)
|
||||
amount = 6, -- How much the value is changed by per second
|
||||
hunger = math.random(10,20), -- The hunger/thirst stats of the item, if not found in the items.lua
|
||||
thirst = math.random(10,20), -- The hunger/thirst stats of the item, if not found in the items.lua
|
||||
},
|
||||
},
|
||||
]]
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name "Jim-Consumables"
|
||||
author "Jimathy"
|
||||
version "v1.1"
|
||||
version "v1.2"
|
||||
description "Consumable Script By Jimathy"
|
||||
fx_version "cerulean"
|
||||
game "gta5"
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
--Consumables
|
||||
CreateThread(function()
|
||||
for k in pairs(Config.Consumables) do
|
||||
QBCore.Functions.CreateUseableItem(k, function(source, item)
|
||||
TriggerClientEvent('jim-consumables:Consume', source, item.name)
|
||||
end)
|
||||
end
|
||||
for k, v in pairs(Config.Consumables) do
|
||||
QBCore.Functions.CreateUseableItem(k, function(source, item) TriggerClientEvent('jim-consumables:Consume', source, item.name) end)
|
||||
if not QBCore.Shared.Items[k] then print("Item check - '"..k.."' not found in the shared lua") end
|
||||
if not Config.Emotes[v.emote] then print("Emote check - '"..k.."' requested emote '"..v.emote.."' - not found in config.lua") end
|
||||
end
|
||||
end)
|
||||
for k in pairs(Config.Consumables) do
|
||||
QBCore.Functions.CreateUseableItem(k, function(source, item)
|
||||
TriggerClientEvent('jim-consumables:Consume', source, item.name)
|
||||
end)
|
||||
end
|
||||
for k, v in pairs(Config.Consumables) do
|
||||
QBCore.Functions.CreateUseableItem(k, function(source, item) TriggerClientEvent('jim-consumables:Consume', source, item.name) end)
|
||||
if not QBCore.Shared.Items[k] then print("Item check - '"..k.."' not found in the shared lua") end
|
||||
if not Config.Emotes[v.emote] then print("Emote check - '"..k.."' requested emote '"..v.emote.."' - not found in config.lua") end
|
||||
end
|
||||
Reference in New Issue
Block a user