diff --git a/README.md b/README.md index c2145d0..f266e63 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ To add an item, you only need to add a new item table in the Config.Consumables ```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 diff --git a/client/client.lua b/client/client.lua index a443148..554e840 100644 --- a/client/client.lua +++ b/client/client.lua @@ -1,37 +1,50 @@ local QBCore = exports['qb-core']:GetCoreObject() PlayerJob = {} -local onDuty = false local alcoholCount = 0 local drugCount = 0 -local function loadAnimDict(dict) while (not HasAnimDictLoaded(dict)) do RequestAnimDict(dict) Wait(5) end end +local time = 40 +function loadModel(model) if not HasModelLoaded(model) then if Config.Debug then print("^5Debug^7: ^2Loading Model^7: '^6"..model.."^7'") end while not HasModelLoaded(model) do if time > 0 then time = time - 1 RequestModel(model) else time = 40 break end Wait(10) end end end +function unloadModel(model) if Config.Debug then print("^5Debug^7: ^2Removing Model^7: '^6"..model.."^7'") end SetModelAsNoLongerNeeded(model) end +function loadAnimDict(dict) if Config.Debug then print("^5Debug^7: ^2Loading Anim Dictionary^7: '^6"..dict.."^7'") end while not HasAnimDictLoaded(dict) do RequestAnimDict(dict) Wait(5) end end +function unloadAnimDict(dict) if Config.Debug then print("^5Debug^7: ^2Removing Anim Dictionary^7: '^6"..dict.."^7'") end RemoveAnimDict(dict) end +function destroyProp(entity) if Config.Debug then print("^5Debug^7: ^2Destroying Prop^7: '^6"..entity.."^7'") end SetEntityAsMissionEntity(entity) Wait(5) DetachEntity(entity, true, true) Wait(5) DeleteObject(entity) end + +--Convert Prop Model Names to Model HashKeys now to be more optimized when loading later +for k in pairs(Config.Emotes) do + if Config.Emotes[k].AnimationOptions.Prop then + Config.Emotes[k].AnimationOptions.Prop = GetHashKey(Config.Emotes[k].AnimationOptions.Prop) + end +end --Alcohol 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) Wait(math.random(5000, 8000)) - local ped = PlayerPedId() - RequestAnimSet("MOVE_M@DRUNK@VERYDRUNK") - while not HasAnimSetLoaded("MOVE_M@DRUNK@VERYDRUNK") do - Citizen.Wait(0) - end - SetPedCanRagdoll( ped, true ) + local Ped = PlayerPedId() + local animDict = "MOVE_M@DRUNK@VERYDRUNK" + loadAnimDict(animDict) + SetPedCanRagdoll(Ped, true) ShakeGameplayCam('DRUNK_SHAKE', 2.80) SetTimecycleModifier("Drunk") - SetPedMovementClipset(ped, "MOVE_M@DRUNK@VERYDRUNK", true) - SetPedMotionBlur(ped, true) - SetPedIsDrunk(ped, true) + SetPedMovementClipset(Ped, animDict, 1) + SetPedMotionBlur(Ped, true) + SetPedIsDrunk(Ped, true) Wait(1500) - SetPedToRagdoll(ped, 5000, 1000, 1, false, false, false ) + SetPedToRagdoll(Ped, 5000, 1000, 1, 0, 0, 0) Wait(13500) - SetPedToRagdoll(ped, 5000, 1000, 1, false, false, false ) + SetPedToRagdoll(Ped, 5000, 1000, 1, 0, 0, 0) Wait(120500) ClearTimecycleModifier() ResetScenarioTypesEnabled() - ResetPedMovementClipset(ped, 0) - SetPedIsDrunk(ped, false) - SetPedMotionBlur(ped, false) + ResetPedMovementClipset(Ped, 0) + SetPedIsDrunk(Ped, false) + SetPedMotionBlur(Ped, false) AnimpostfxStopAll() ShakeGameplayCam('DRUNK_SHAKE', 0.0) StartScreenEffect("DrugsMichaelAliensFight", 3.0, 0) @@ -40,9 +53,15 @@ function AlienEffect() StopScreenEffect("DrugsMichaelAliensFightIn") StopScreenEffect("DrugsMichaelAliensFight") StopScreenEffect("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) Wait(math.random(3000, 20000)) StartScreenEffect("DrugsMichaelAliensFight", 3.0, 0) @@ -51,9 +70,15 @@ function WeedEffect() StopScreenEffect("DrugsMichaelAliensFightIn") StopScreenEffect("DrugsMichaelAliensFight") StopScreenEffect("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) Wait(3000) StartScreenEffect("DrugsTrevorClownsFight", 3.0, 0) @@ -62,30 +87,45 @@ function TrevorEffect() StopScreenEffect("DrugsTrevorClownsFight") StopScreenEffect("DrugsTrevorClownsFightIn") StopScreenEffect("DrugsTrevorClownsFightOut") + trevorEffect = false + if Config.Debug then print("^5Debug^7: ^3TrevorEffect^7() ^2stopped") end end +local healEffectDouble = false function HealEffectDouble() - if not healing then healing = true else return end + 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 - healing = false + healEffectDouble = false + if Config.Debug then print("^5Debug^7: ^3HealEffectDouble^7() ^2stopped") end end + +local healEffect = false function HealEffect() - if not healing then healing = true else return end + if healEffect then return end + if Config.Debug then print("^5Debug^7: ^3HealEffect^7() ^2activated") end + healEffect = true local count = 4 while count > 0 do Wait(1000) count = count - 1 SetEntityHealth(PlayerPedId(), GetEntityHealth(PlayerPedId()) + 6) end - healing = false + healEffect = false + if Config.Debug then print("^5Debug^7: ^3HealEffect^7() ^2stopped") end end +local staminaEffect = false function StaminaEffect() + if staminaEffect then return end + if Config.Debug then print("^5Debug^7: ^3StaminaEffect^7() ^2activated") end + staminaEffect = true local startStamina = 8 SetRunSprintMultiplierForPlayer(PlayerId(), 1.49) while startStamina > 0 do @@ -96,6 +136,25 @@ function StaminaEffect() end startStamina = 0 SetRunSprintMultiplierForPlayer(PlayerId(), 1.0) + staminaEffect = false + if Config.Debug then print("^5Debug^7: ^3StaminaEffect^7() ^2stopped") end +end + +function StopEffects() + if Config.Debug then print("^5Debug^7: ^2All screen effects stopped") end + ShakeGameplayCam('DRUNK_SHAKE', 0.0) + SetPedToRagdoll(PlayerPedId(), 5000, 1000, 1, 0, 0, 0) + ClearTimecycleModifier() + ResetScenarioTypesEnabled() + ResetPedMovementClipset(PlayerPedId(), 0) + SetPedIsDrunk(PlayerPedId(), false) + SetPedMotionBlur(PlayerPedId(), false) + StopScreenEffect("DrugsMichaelAliensFightIn") + StopScreenEffect("DrugsMichaelAliensFight") + StopScreenEffect("DrugsMichaelAliensFightOut") + StopScreenEffect("DrugsTrevorClownsFight") + StopScreenEffect("DrugsTrevorClownsFightIn") + StopScreenEffect("DrugsTrevorClownsFightOut") end --[[function EcstasyEffect() @@ -174,29 +233,31 @@ local consuming = false local cancelled = false RegisterNetEvent('jim-consumables:Consume', function(itemName) + if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Starting event, locking inventory and grabbing data^7..") end LocalPlayer.state:set("inv_busy", true, true) - local time = math.random(5000, 6000) -- How long it takes to consume something local Player = PlayerPedId() local emote = Config.Emotes[Config.Consumables[itemName].emote] local animDict = tostring(emote[1]) local anim = tostring(emote[2]) - local model, bone, drugeffect, stress = nil + local model, bone, drugeffect, stress local P1, P2, P3, P4, P5, P6 = table.unpack({0.0, 0.0, 0.0, 0.0, 0.0, 0.0}) if emote.AnimationOptions.Prop then - model = tostring(emote.AnimationOptions.Prop) + model = emote.AnimationOptions.Prop bone = GetPedBoneIndex(PlayerPedId(), emote.AnimationOptions.PropBone) P1, P2, P3, P4, P5, P6 = table.unpack(emote.AnimationOptions.PropPlacement) end - local type = Config.Consumables[itemName].type - local stress = Config.Consumables[itemName].stress - local heal = Config.Consumables[itemName].heal - local armor = Config.Consumables[itemName].armor + local time = Config.Consumables[itemName].time or math.random(5000, 6000) + local type = Config.Consumables[itemName].type or "food" + local stress = Config.Consumables[itemName].stress or 0 + local heal = Config.Consumables[itemName].heal or 0 + local armor = Config.Consumables[itemName].armor or 0 if type == "drink" or type == "alcohol" then string = "Drinking " end if type == "food" then string = "Eating " end if type == "drug" then string = "Using " end if consuming then cancelled = true + if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Event already started^7, ^1Cancelling^7.") end LocalPlayer.state:set("inv_busy", false, true) TriggerEvent("QBCore:Notify", "Stopped "..string, "error") consuming = not consuming @@ -204,6 +265,7 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName) end --Emote Stuff + if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Grabbing Emote Animation Options^7...") end if emote.AnimationOptions then if emote.AnimationOptions.EmoteLoop then MovementType = 1 if emote.AnimationOptions.EmoteMoving then MovementType = 51 @@ -214,31 +276,27 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName) end else MovementType = 0 end - InVehicle = IsPedInAnyVehicle(PlayerPedId(), true) + if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Checking if player is in a vehicle^7...") end + local InVehicle = IsPedInAnyVehicle(PlayerPedId(), true) if InVehicle == 1 then MovementType = 51 end --Load and Start animation + if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Playing Animation^7...") end loadAnimDict(animDict) - TaskPlayAnim(Player, animDict, anim, 1.0, 1.0, -1, MovementType, 0, 0, 0, 0) - + TaskPlayAnim(PlayerPedId(), animDict, anim, 1.0, 1.0, -1, MovementType, 0, 0, 0, 0) + TriggerEvent("QBCore:Notify", string..QBCore.Shared.Items[itemName].label.."..", "success", (time + 1000)) consuming = true CreateThread(function() --Prop Spawning if model then - RequestModel(GetHashKey(model)) - while not HasModelLoaded(GetHashKey(model)) do Citizen.Wait(1) end - local attachProp = CreateObject(GetHashKey(model), 1.0, 1.0, 1.0, 1, 1, 0) + if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Spawning consumable prop^7.") end + loadModel(model) + local attachProp = CreateObject(model, 1.0, 1.0, 1.0, 1, 1, 0) AttachEntityToEntity(attachProp, PlayerPedId(), bone, P1, P2, P3, P4, P5, P6, true, true, false, true, 1, true) - while consuming do - Wait(10) - end - DeleteObject(attachProp) - DetachEntity(attachProp, 0, 0) - SetEntityAsMissionEntity(attachProp, true, true) - Wait(100) - DeleteEntity(attachProp) + while consuming do Wait(100) end + destroyProp(attachProp) end end) @@ -253,11 +311,12 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName) time = time - 10 end - StopEntityAnim(Player, anim, animDict, 1.0) + StopEntityAnim(PlayerPedId(), anim, animDict, 1.0) + unloadAnimDict(animDict) if not cancelled then - TriggerEvent("inventory:client:ItemBox", QBCore.Shared.Items[itemName], "remove", 1) TriggerServerEvent("QBCore:Server:RemoveItem", itemName, 1) + TriggerEvent("inventory:client:ItemBox", QBCore.Shared.Items[itemName], "remove", 1) if QBCore.Shared.Items[itemName].thirst then TriggerServerEvent("QBCore:Server:SetMetaData", "thirst", QBCore.Functions.GetPlayerData().metadata["thirst"] + QBCore.Shared.Items[itemName].thirst) end @@ -275,52 +334,78 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName) end end - if stress then TriggerServerEvent('hud:server:RelieveStress', stress) end + if stress and stress ~= 0 then + if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Reliving ^6"..stress.." ^2stress^7.") end + TriggerServerEvent('hud:server:RelieveStress', stress) + end - if heal then SetEntityHealth(Player, GetEntityHealth(Player) + heal) end + if heal and heal ~= 0 then + if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Healing player by^7: ^6"..heal) end + SetEntityHealth(PlayerPedId(), GetEntityHealth(PlayerPedId()) + heal) + end - if armor then TriggerServerEvent('hospital:server:SetArmor', (GetPedArmour(Player) + armor)) SetPedArmour(Player, (GetPedArmour(Player) + armor)) end + if armor and armor ~= 0 then + if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Adding ^6"..armor.." ^2armour^7.") end + TriggerServerEvent('hospital:server:SetArmor', (GetPedArmour(PlayerPedId()) + armor)) SetPedArmour(PlayerPedId(), (GetPedArmour(PlayerPedId()) + armor)) + end if type == "alcohol" then + if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Current ^4alcoholCount^7: ^6"..(alcoholCount + 1)) end alcoholCount = alcoholCount + 1 if alcoholCount > 1 and alcoholCount < 4 then TriggerEvent("evidence:client:SetStatus", "alcohol", 200) elseif alcoholCount >= 4 then TriggerEvent("evidence:client:SetStatus", "heavyalcohol", 200) - AlienEffect() - end + CreateThread(function() + AlienEffect() + end) + end end - effect = Config.Consumables[itemName].effect + stats = Config.Consumables[itemName].stats or nil - if effect ~= nil then - if effect.canOD then + 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 - AlienEffect() + CreateThread(function() + AlienEffect() + end) end end end - if effect.effect == "weed" then + if stats.effect == "weed" then if drugCount >= 2 then - TrevorEffect() + CreateThread(function() + TrevorEffect() + end) end end - if effect.effect == "heal" then - HealEffect() + if stats.effect == "heal" then + CreateThread(function() + HealEffect() + end) end - if effect.effect == "healdouble" then - HealEffect() + if stats.effect == "healdouble" then + CreateThread(function() + HealEffect() + end) end - if effect.effect == "stamina" then - StaminaEffect() - if drugCount >= 4 then + if stats.effect == "stamina" then + CreateThread(function() + StaminaEffect() + end) + if drugCount >= 4 then + CreateThread(function() TrevorEffect() + end) end end - if effect.widepupils then + if stats.widepupils then TriggerEvent("evidence:client:SetStatus", "widepupils", 200) --EcstasyEffect() end @@ -330,16 +415,7 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName) cancelled = false consuming = false - --[[for k, v in pairs(GetGamePool('CObject')) do - if IsEntityAttachedToEntity(PlayerPedId(), v) then - DeleteObject(v) - DetachEntity(v, 0, 0) - SetEntityAsMissionEntity(v, true, true) - Wait(100) - DeleteEntity(v) - end - end]] - + if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Finished, unlocking inventory^7..") end LocalPlayer.state:set("inv_busy", false, true) end) @@ -365,3 +441,7 @@ CreateThread(function() end end end) + +AddEventHandler('onResourceStop', function(r) if r ~= GetCurrentResourceName() then return end + StopEffects() +end) \ No newline at end of file diff --git a/config.lua b/config.lua index a1e9643..b434106 100644 --- a/config.lua +++ b/config.lua @@ -1,4 +1,4 @@ -print("Jim-Consumables v1.0 - Consumables Script by Jimathy") +print("^2Jim^7-^2Consumables v^41^7.^41 ^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,40 +8,40 @@ Config = { Debug = false, Consumables = { -- Default QB food and drink item override - ["vodka"] = { emote = "vodkab", stress = math.random(2, 4), heal = 0, armor = 0, type = "alcohol", stats = { thirst = math.random(10,20), }}, - ["beer"] = { emote = "beer", stress = math.random(2, 4), heal = 0, armor = 0, type = "alcohol", stats = { thirst = math.random(10,20), }}, - ["whiskey"] = { emote = "whiskey", stress = math.random(2, 4), heal = 0, armor = 0, type = "alcohol", stats = { thirst = math.random(10,20), }}, + ["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 }}, + ["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 }}, - ["sandwich"] = { emote = "sandwich", stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,20), }}, - ["twerks_candy"] = { emote = "egobar", stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,20), }}, - ["snikkel_candy"] = { emote = "egobar", stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,20), }}, - ["tosti"] = { emote = "sandwich", stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,20), }}, + ["sandwich"] = { emote = "sandwich", time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,20), }}, + ["twerks_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), }}, + ["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", stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(10,20), }}, - ["water_bottle"] = { emote = "drink", stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(10,20), }}, - ["kurkakola"] = { emote = "ecola", 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 = { 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", stress = math.random(12, 24), heal = 10, armor = 0, type = "drug", }, - ["bandage"] = { emote = "oxy", stress = 0, heal = 10, armor = 0, type = "drug", }, + -- 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", }, --Testing effects & armor with small functionality to drugs - This may be another one left to default scripts - ["joint"] = { emote = "smoke3", stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", effect = { 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 = { effect = "weed", widepupils = false, canOD = false } }, - ["cokebaggy"] = { emote = "coke", stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", effect = { effect = "stamina", widepupils = false, canOD = true } }, - --["crackbaggy"] = { emote = "coke", stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", effect = { effect = "heal", widepupils = false, canOD = true } }, - ["xtcbaggy"] = { emote = "oxy", stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", effect = { effect = "stamina", widepupils = true, canOD = true } }, - ["oxy"] = { emote = "oxy", stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", effect = { effect = "heal", widepupils = false, canOD = false } }, - ["meth"] = { emote = "coke", stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", effect = { effect = "stamina", widepupils = false, canOD = true } },]] - ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + ["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 } }, + ["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 - --["heartstopper"] = { + ["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) 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 diff --git a/fxmanifest.lua b/fxmanifest.lua index e2d9f44..e027aae 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,6 +1,6 @@ name "Jim-Consumables" author "Jimathy" -version "v1.0" +version "v1.1" description "Consumable Script By Jimathy" fx_version "cerulean" game "gta5" diff --git a/server/server.lua b/server/server.lua index bc459c4..a4f4dca 100644 --- a/server/server.lua +++ b/server/server.lua @@ -2,12 +2,12 @@ local QBCore = exports['qb-core']:GetCoreObject() --Consumables CreateThread(function() - for k,v in pairs(Config.Consumables) do + 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 + 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