From 7492531621caad01eb69f41f4cfca4767253e320 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Tue, 1 Apr 2025 19:39:26 +0100 Subject: [PATCH] Version 2.0 Bump + readability changes --- client/client.lua | 73 +++++++++++++++++++++++++++++++++-------------- config.lua | 14 +++++---- fxmanifest.lua | 1 - version.txt | 2 +- 4 files changed, 61 insertions(+), 29 deletions(-) diff --git a/client/client.lua b/client/client.lua index 05bddb7..2daa4f5 100644 --- a/client/client.lua +++ b/client/client.lua @@ -28,7 +28,9 @@ RegisterNetEvent(getScript()..":client:syncEmotes", function(NewEmotes) Emotes = NewEmotes end) -onPlayerLoaded(function() syncConsumables() end, true) +onPlayerLoaded(function() + syncConsumables() +end, true) RegisterNetEvent(getScript()..':Consume', function(itemName) @@ -170,10 +172,15 @@ RegisterNetEvent(getScript()..':Consume', function(itemName) if InVehicle == 1 then MovementType = 51 elseif emote.AnimationOptions then - if emote.AnimationOptions.EmoteMoving then MovementType = 51 - elseif emote.AnimationOptions.EmoteLoop then MovementType = 1 - elseif emote.AnimationOptions.EmoteStuck then MovementType = emote.AnimationOptions.EmoteMoving and 50 or 2 - elseif emote.AnimationOptions.EmoteMoving == false then MovementType = 0 end + if emote.AnimationOptions.EmoteMoving then + MovementType = 51 + elseif emote.AnimationOptions.EmoteLoop then + MovementType = 1 + elseif emote.AnimationOptions.EmoteStuck then + MovementType = emote.AnimationOptions.EmoteMoving and 50 or 2 + elseif emote.AnimationOptions.EmoteMoving == false then + MovementType = 0 + end end --Load and Start animation @@ -208,9 +215,17 @@ RegisterNetEvent(getScript()..':Consume', function(itemName) else print("^5Debug^7: ^3PropSpawn^7: ^2Second prop model isn't valid/found^7.") end end while consuming do Wait(50) end - if DoesEntityExist(attachProp) then destroyProp(attachProp) attachProp = nil end - if DoesEntityExist(attachProp2) then destroyProp(attachProp2) attachProp2 = nil end - else print("^5Debug^7: ^3PropSpawn^7: ^2Prop model isn't valid/found^7.") end + if DoesEntityExist(attachProp) then + destroyProp(attachProp) + attachProp = nil + end + if DoesEntityExist(attachProp2) then + destroyProp(attachProp2) + attachProp2 = nil + end + else + print("^5Debug^7: ^3PropSpawn^7: ^2Prop model isn't valid/found^7.") + end end end) while consuming do @@ -226,7 +241,9 @@ RegisterNetEvent(getScript()..':Consume', function(itemName) } or { "[BackSpace] Stop Consuming", } drawText(nil, drawTable, nil, nil) - if time <= 0 then consuming = false end + if time <= 0 then + consuming = false + end if (IsControlJustPressed(0, 21) and not canRun) or IsPedRagdoll(Player) or IsControlJustPressed(0, 177) then consuming = false cancelled = true @@ -309,13 +326,27 @@ RegisterNetEvent(getScript()..':Consume', function(itemName) end if 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 - if stats.screen == "nightvision" then CreateThread(function() NightVisionEffect() end) end - if stats.screen == "thermal" then CreateThread(function() ThermalEffect() end) end + 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 + if stats.screen == "nightvision" then + CreateThread(function() NightVisionEffect() end) + end + if stats.screen == "thermal" then + CreateThread(function() ThermalEffect() end) + end end if stats.canOD then drugCount += 1 @@ -329,7 +360,7 @@ RegisterNetEvent(getScript()..':Consume', function(itemName) end end if stats.effect == "heal" then - if GetResourceState("ps-buffs"):find("start") then + if isStarted("ps-buffs") then debugPrint("^5Debug^7: ^3Consume^7: ^4PS^7-^4Buffs ^2found^7, ^2hooking in to get buffs and applying ^6Health Buff ^2for ^6"..stats.time.."^7ms") exports["ps-buffs"]:AddHealthBuff((tonumber(stats.time) or 10000), (stats.amount or 6)) else @@ -339,12 +370,12 @@ RegisterNetEvent(getScript()..':Consume', function(itemName) end end if stats.effect == "stamina" then - if GetResourceState("ps-buffs"):find("start") then + if isStarted("ps-buffs") then debugPrint("^5Debug^7: ^3Consume^7: ^4PS^7-^4Buffs ^2found^7, ^2hooking in to get buffs and applying ^6Stamina Buff ^2for ^6"..stats.time.."^7ms") exports["ps-buffs"]:StaminaBuffEffect((tonumber(stats.time) or 10000), (stats.amount or 6)) else CreateThread(function() StaminaEffect({(tonumber(stats.time) or 10000), (stats.amount or 6)}) end) end end - if GetResourceState("ps-buffs"):find("start") then --PS-BUFFS ONLY + if isStarted("ps-buffs") then --PS-BUFFS ONLY if stats.effect then debugPrint("^5Debug^7: ^3Consume^7: ^4PS^7-^4Buffs ^2found^7, ^2hooking in to get buffs and applying ^6"..stats.effect.." Buff ^2for ^6"..(stats.time or "nil").."^7ms") end if stats.effect == "armor" then exports["ps-buffs"]:AddArmorBuff((tonumber(stats.time) or 10000), (stats.amount or 6)) end if stats.effect == "stress" then exports["ps-buffs"]:AddStressBuff((tonumber(stats.time) or 10000), (stats.amount or 6)) end @@ -371,8 +402,8 @@ CreateThread(function() end end) -AddEventHandler('onResourceStop', function(r) if r ~= GetCurrentResourceName() then return end +onResourceStop(function() lockInv(false) StopEffects() -end) \ No newline at end of file +end, true) \ No newline at end of file diff --git a/config.lua b/config.lua index a34e9a5..fed18ec 100644 --- a/config.lua +++ b/config.lua @@ -1,17 +1,19 @@ Config = { System = { - Debug = false, + Debug = true, EventDebug = false, - Notify = "qb", - Menu = "qb", - ProgressBar = "qb", - drawText = "gta", + Menu = "qb", -- "qb", "ox" + Notify = "gta", -- "qb", "ox", "gta" + ProgressBar = "gta", -- "qb", "ox", "gta" + drawText = "gta", -- "qb", "ox", "gta" + }, Main = { UseProgbar = false, -- Disabled this, progress bars stop all anims when complete. + -- This is intended to create a progressbar to show consuming but it was usually forces animations to end weirdly }, Crafting = { - showItemBox = true + showItemBox = true -- Display "use" item boxes on some inventories that need to be told to } } \ No newline at end of file diff --git a/fxmanifest.lua b/fxmanifest.lua index 8408ec7..896ceec 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -27,7 +27,6 @@ shared_scripts { } client_scripts { - --'@warmenu/warmenu.lua', 'client/*.lua', } diff --git a/version.txt b/version.txt index 400122e..415b19f 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.5 \ No newline at end of file +2.0 \ No newline at end of file