2 Commits

Author SHA1 Message Date
Jim Shield
f1cf454687 buff time fix + notify fixes + New effects 2022-08-29 10:26:48 +01:00
Jim Shield
a6f6492d5b debug mode. 2022-08-24 09:25:05 +01:00
5 changed files with 53 additions and 28 deletions

View File

@@ -29,7 +29,7 @@ To add an item, you only need to add a new item table in the Config.Consumables
armor = 5, -- Amount of armor to add armor = 5, -- Amount of armor to add
type = "food", -- Type: "alcohol" / "drink" / "food" type = "food", -- Type: "alcohol" / "drink" / "food"
stats = { stats = {
screen = "rampage" -- The screen effect to be played when after consuming the item screen = "rampage", -- The screen effect to be played when after consuming the item
effect = "heal", -- The status effect given by the item, "heal" / "stamina" 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) 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 amount = 2, -- How much the value is changed by per second
@@ -42,12 +42,14 @@ Consuming an item can also manually activate screen effects
The example above uses `rampage` as this is what the effect is named after, you can use it for any item you think best 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 ```lua
--The current list of effects are: --The current list of screen effects are:
"turbo" "turbo"
"focus" "focus"
"rampage" "rampage"
"weed" "weed"
"trevor" "trevor"
"nightvision"
"thermal"
``` ```
## PS-Buffs Support ## PS-Buffs Support

View File

@@ -150,6 +150,8 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
if stats.screen == "rampage" then CreateThread(function() RampageEffect() 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 == "weed" then CreateThread(function() WeedEffect() end) end
if stats.screen == "trevor" then CreateThread(function() TrevorEffect() end) end if stats.screen == "trevor" then CreateThread(function() TrevorEffect() end) end
if stats.screen == "nightvision" then CreateThread(function() NightVisionEffect() end) end
if stats.screen == "thermal" then CreateThread(function() ThermalEffect() end) end
end end
if stats.canOD then if stats.canOD then
@@ -164,11 +166,11 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
end end
end end
if stats.effect == "heal" then if stats.effect == "heal" then
if GetResourceState("ps-buffs") == "started" then exports["ps-buffs"]:AddHealthBuff((stats.effect.time or 10000), (stats.amount or 6)) if GetResourceState("ps-buffs") == "started" then exports["ps-buffs"]:AddHealthBuff((stats.time or 10000), (stats.amount or 6))
else CreateThread(function() HealEffect({(stats.effect.time or 10000), (stats.amount or 6)}) end) end else CreateThread(function() HealEffect({(stats.effect.time or 10000), (stats.amount or 6)}) end) end
end end
if stats.effect == "stamina" then if stats.effect == "stamina" then
if GetResourceState("ps-buffs") == "started" then exports["ps-buffs"]:StaminaBuffEffect((stats.effect.time or 10000), (stats.amount or 6)) if GetResourceState("ps-buffs") == "started" then exports["ps-buffs"]:StaminaBuffEffect((stats.time or 10000), (stats.amount or 6))
else CreateThread(function() StaminaEffect({(stats.effect.time or 10000), (stats.amount or 6)}) end) end else CreateThread(function() StaminaEffect({(stats.effect.time or 10000), (stats.amount or 6)}) end) end
end end
if GetResourceState("ps-buffs") == "started" then --PS-BUFFS ONLY if GetResourceState("ps-buffs") == "started" then --PS-BUFFS ONLY

View File

@@ -1,11 +1,12 @@
print("^2Jim^7-^2Consumables v^41^7.^43 ^7- ^2Consumables Script by ^1Jimathy^7") print("^2Jim^7-^2Consumables ^7v^41^7.^43^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. -- If you need support I now have a discord available, it helps me keep track of issues and give better support.
-- https://discord.gg/xKgQZ6wZvS -- https://discord.gg/xKgQZ6wZvS
Config = { Config = {
Debug = true, Debug = false,
Notify = "qb",
Consumables = { Consumables = {
-- Default QB food and drink item override -- Default QB food and drink item override
@@ -40,9 +41,9 @@ Config = {
["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 } }, ["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"] = { --[[ ["heartstopper"] = {
emote = "burger", -- Select an emote from below, it has to be in here 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 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 stress = math.random(1,2), -- Amount of stress relief, can be 0
@@ -50,15 +51,15 @@ Config = {
armor = 5, -- Amount of armor to add armor = 5, -- Amount of armor to add
type = "food", -- Type: "alcohol" / "drink" / "food" type = "food", -- Type: "alcohol" / "drink" / "food"
stats = { stats = {
screen = "rampage" -- The screen effect to be played when after consuming the item screen = "rampage", -- The screen effect to be played when after consuming the item
effect = "heal", -- The status effect given by the item, "heal" / "stamina" 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) 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 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 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 thirst = math.random(10,20), -- The hunger/thirst stats of the item, if not found in the items.lua
}, },
}, }, ]]
]]
}, },
Emotes = { Emotes = {
["drink"] = {"mp_player_intdrink", "loop_bottle", "Drink", AnimationOptions = ["drink"] = {"mp_player_intdrink", "loop_bottle", "Drink", AnimationOptions =

View File

@@ -1,10 +1,10 @@
name "Jim-Consumables" name "Jim-Consumables"
author "Jimathy" author "Jimathy"
version "v1.3" version "v1.3.1"
description "Consumable Script By Jimathy" description "Consumable Script By Jimathy"
fx_version "cerulean" fx_version "cerulean"
game "gta5" game "gta5"
shared_scripts { 'config.lua', 'shared/*.lua' }
client_scripts { 'client/*.lua', } client_scripts { 'client/*.lua', }
server_scripts { 'server/*.lua' } server_scripts { 'server/*.lua' }
shared_scripts { 'config.lua', 'shared/*.lua' }

View File

@@ -58,8 +58,7 @@ function toggleItem(give, item, amount) TriggerServerEvent("jim-consumables:serv
--Screen Effects --Screen Effects
local alienEffect = false local alienEffect = false
function AlienEffect() function AlienEffect()
if alienEffect then return end if alienEffect then return else alienEffect = true end
alienEffect = true
if Config.Debug then print("^5Debug^7: ^3AlienEffect^7() ^2activated") end if Config.Debug then print("^5Debug^7: ^3AlienEffect^7() ^2activated") end
AnimpostfxPlay("DrugsMichaelAliensFightIn", 3.0, 0) AnimpostfxPlay("DrugsMichaelAliensFightIn", 3.0, 0)
Wait(math.random(5000, 8000)) Wait(math.random(5000, 8000))
@@ -95,7 +94,7 @@ function AlienEffect()
end end
local weedEffect = false local weedEffect = false
function WeedEffect() function WeedEffect()
if weedEffect then return end if weedEffect then return else weedEffect = true end
weedEffect = true weedEffect = true
if Config.Debug then print("^5Debug^7: ^3WeedEffect^7() ^2activated") end if Config.Debug then print("^5Debug^7: ^3WeedEffect^7() ^2activated") end
AnimpostfxPlay("DrugsMichaelAliensFightIn", 3.0, 0) AnimpostfxPlay("DrugsMichaelAliensFightIn", 3.0, 0)
@@ -111,9 +110,8 @@ function WeedEffect()
end end
local trevorEffect = false local trevorEffect = false
function TrevorEffect() function TrevorEffect()
if trevorEffect then return end if trevorEffect then return else trevorEffect = true end
if Config.Debug then print("^5Debug^7: ^3TrevorEffect^7() ^2activated") end if Config.Debug then print("^5Debug^7: ^3TrevorEffect^7() ^2activated") end
trevorEffect = true
AnimpostfxPlay("DrugsTrevorClownsFightIn", 3.0, 0) AnimpostfxPlay("DrugsTrevorClownsFightIn", 3.0, 0)
Wait(3000) Wait(3000)
AnimpostfxPlay("DrugsTrevorClownsFight", 3.0, 0) AnimpostfxPlay("DrugsTrevorClownsFight", 3.0, 0)
@@ -127,9 +125,8 @@ function TrevorEffect()
end end
local turboEffect = false local turboEffect = false
function TurboEffect() function TurboEffect()
if turboEffect then return end if turboEffect then return else turboEffect = true end
if Config.Debug then print("^5Debug^7: ^3TurboEffect^7() ^2activated") end if Config.Debug then print("^5Debug^7: ^3TurboEffect^7() ^2activated") end
turboEffect = true
AnimpostfxPlay('RaceTurbo', 0, true) AnimpostfxPlay('RaceTurbo', 0, true)
SetTimecycleModifier('rply_motionblur') SetTimecycleModifier('rply_motionblur')
ShakeGameplayCam('SKY_DIVING_SHAKE', 0.25) ShakeGameplayCam('SKY_DIVING_SHAKE', 0.25)
@@ -144,9 +141,8 @@ function TurboEffect()
end end
local rampageEffect = false local rampageEffect = false
function RampageEffect() function RampageEffect()
if rampageEffect then return end if rampageEffect then return else rampageEffect = true end
if Config.Debug then print("^5Debug^7: ^3RampageEffect^7() ^2activated") end if Config.Debug then print("^5Debug^7: ^3RampageEffect^7() ^2activated") end
rampageEffect = true
AnimpostfxPlay('Rampage', 0, true) AnimpostfxPlay('Rampage', 0, true)
SetTimecycleModifier('rply_motionblur') SetTimecycleModifier('rply_motionblur')
ShakeGameplayCam('SKY_DIVING_SHAKE', 0.25) ShakeGameplayCam('SKY_DIVING_SHAKE', 0.25)
@@ -161,16 +157,38 @@ function RampageEffect()
end end
local focusEffect = false local focusEffect = false
function FocusEffect() function FocusEffect()
if focusEffect then return end if focusEffect then return else focusEffect = true end
if Config.Debug then print("^5Debug^7: ^3FocusEffect^7() ^2activated") end if Config.Debug then print("^5Debug^7: ^3FocusEffect^7() ^2activated") end
focusEffect = true Wait(1000)
AnimpostfxPlay('FocusIn', 0, true) AnimpostfxPlay('FocusIn', 0, true)
Wait(30000) Wait(30000)
Wait(1000)
AnimpostfxStop('FocusIn') AnimpostfxStop('FocusIn')
focusEffect = false focusEffect = false
if Config.Debug then print("^5Debug^7: ^3FocusEffect^7() ^2stopped") end if Config.Debug then print("^5Debug^7: ^3FocusEffect^7() ^2stopped") end
end end
local NightVisionEffect = false
function NightVisionEffect()
if NightVisionEffect then return else NightVisionEffect = true end
if Config.Debug then print("^5Debug^7: ^3NightVisionEffect^7() ^2activated") end
SetNightvision(true)
Wait(math.random(3000, 4000)) -- FEEL FREE TO CHANGE THIS
SetNightvision(false)
SetSeethrough(false)
NightVisionEffect = false
if Config.Debug then print("^5Debug^7: ^3NightVisionEffect^7() ^2stopped") end
end
local thermalEffect = false
function ThermalEffect()
if thermalEffect then return else thermalEffect = true end
if Config.Debug then print("^5Debug^7: ^3ThermalEffect^7() ^2activated") end
SetNightvision(true)
SetSeethrough(true)
Wait(math.random(2000, 3000)) -- FEEL FREE TO CHANGE THIS
SetNightvision(false)
SetSeethrough(false)
thermalEffect = false
if Config.Debug then print("^5Debug^7: ^3ThermalEffect^7() ^2stopped") end
end
--Built-in Buff effects --Built-in Buff effects
local healEffect = false local healEffect = false
@@ -207,7 +225,7 @@ function StaminaEffect(data)
if Config.Debug then print("^5Debug^7: ^3StaminaEffect^7() ^2stopped") end if Config.Debug then print("^5Debug^7: ^3StaminaEffect^7() ^2stopped") end
end end
function StopEffects() function StopEffects() -- Used to clear up any effects stuck on screen
if Config.Debug then print("^5Debug^7: ^2All screen effects stopped") end if Config.Debug then print("^5Debug^7: ^2All screen effects stopped") end
ShakeGameplayCam('DRUNK_SHAKE', 0.0) ShakeGameplayCam('DRUNK_SHAKE', 0.0)
SetPedToRagdoll(PlayerPedId(), 5000, 1000, 1, 0, 0, 0) SetPedToRagdoll(PlayerPedId(), 5000, 1000, 1, 0, 0, 0)
@@ -216,6 +234,8 @@ function StopEffects()
ResetPedMovementClipset(PlayerPedId(), 0) ResetPedMovementClipset(PlayerPedId(), 0)
SetPedIsDrunk(PlayerPedId(), false) SetPedIsDrunk(PlayerPedId(), false)
SetPedMotionBlur(PlayerPedId(), false) SetPedMotionBlur(PlayerPedId(), false)
SetNightvision(false)
SetSeethrough(false)
AnimpostfxStop("DrugsMichaelAliensFightIn") AnimpostfxStop("DrugsMichaelAliensFightIn")
AnimpostfxStop("DrugsMichaelAliensFight") AnimpostfxStop("DrugsMichaelAliensFight")
AnimpostfxStop("DrugsMichaelAliensFightOut") AnimpostfxStop("DrugsMichaelAliensFightOut")