mirror of
https://github.com/jimathy/jim-consumables.git
synced 2026-08-16 22:16:02 +01:00
Version 2.0 Bump + readability changes
This commit is contained in:
@@ -28,7 +28,9 @@ RegisterNetEvent(getScript()..":client:syncEmotes", function(NewEmotes)
|
|||||||
Emotes = NewEmotes
|
Emotes = NewEmotes
|
||||||
end)
|
end)
|
||||||
|
|
||||||
onPlayerLoaded(function() syncConsumables() end, true)
|
onPlayerLoaded(function()
|
||||||
|
syncConsumables()
|
||||||
|
end, true)
|
||||||
|
|
||||||
|
|
||||||
RegisterNetEvent(getScript()..':Consume', function(itemName)
|
RegisterNetEvent(getScript()..':Consume', function(itemName)
|
||||||
@@ -170,10 +172,15 @@ RegisterNetEvent(getScript()..':Consume', function(itemName)
|
|||||||
if InVehicle == 1 then
|
if InVehicle == 1 then
|
||||||
MovementType = 51
|
MovementType = 51
|
||||||
elseif emote.AnimationOptions then
|
elseif emote.AnimationOptions then
|
||||||
if emote.AnimationOptions.EmoteMoving then MovementType = 51
|
if emote.AnimationOptions.EmoteMoving then
|
||||||
elseif emote.AnimationOptions.EmoteLoop then MovementType = 1
|
MovementType = 51
|
||||||
elseif emote.AnimationOptions.EmoteStuck then MovementType = emote.AnimationOptions.EmoteMoving and 50 or 2
|
elseif emote.AnimationOptions.EmoteLoop then
|
||||||
elseif emote.AnimationOptions.EmoteMoving == false then MovementType = 0 end
|
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
|
end
|
||||||
--Load and Start animation
|
--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
|
else print("^5Debug^7: ^3PropSpawn^7: ^2Second prop model isn't valid/found^7.") end
|
||||||
end
|
end
|
||||||
while consuming do Wait(50) end
|
while consuming do Wait(50) end
|
||||||
if DoesEntityExist(attachProp) then destroyProp(attachProp) attachProp = nil end
|
if DoesEntityExist(attachProp) then
|
||||||
if DoesEntityExist(attachProp2) then destroyProp(attachProp2) attachProp2 = nil end
|
destroyProp(attachProp)
|
||||||
else print("^5Debug^7: ^3PropSpawn^7: ^2Prop model isn't valid/found^7.") end
|
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
|
||||||
end)
|
end)
|
||||||
while consuming do
|
while consuming do
|
||||||
@@ -226,7 +241,9 @@ RegisterNetEvent(getScript()..':Consume', function(itemName)
|
|||||||
} or
|
} or
|
||||||
{ "[BackSpace] Stop Consuming", }
|
{ "[BackSpace] Stop Consuming", }
|
||||||
drawText(nil, drawTable, nil, nil)
|
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
|
if (IsControlJustPressed(0, 21) and not canRun) or IsPedRagdoll(Player) or IsControlJustPressed(0, 177) then
|
||||||
consuming = false
|
consuming = false
|
||||||
cancelled = true
|
cancelled = true
|
||||||
@@ -309,13 +326,27 @@ RegisterNetEvent(getScript()..':Consume', function(itemName)
|
|||||||
end
|
end
|
||||||
if stats then
|
if stats then
|
||||||
if stats.screen then -- Screen effect activation
|
if stats.screen then -- Screen effect activation
|
||||||
if stats.screen == "turbo" then CreateThread(function() TurboEffect() end) end
|
if stats.screen == "turbo" then
|
||||||
if stats.screen == "focus" then CreateThread(function() FocusEffect() end) end
|
CreateThread(function() TurboEffect() end)
|
||||||
if stats.screen == "rampage" then CreateThread(function() RampageEffect() end) end
|
end
|
||||||
if stats.screen == "weed" then CreateThread(function() WeedEffect() end) end
|
if stats.screen == "focus" then
|
||||||
if stats.screen == "trevor" then CreateThread(function() TrevorEffect() end) end
|
CreateThread(function() FocusEffect() end)
|
||||||
if stats.screen == "nightvision" then CreateThread(function() NightVisionEffect() end) end
|
end
|
||||||
if stats.screen == "thermal" then CreateThread(function() ThermalEffect() 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
|
end
|
||||||
if stats.canOD then
|
if stats.canOD then
|
||||||
drugCount += 1
|
drugCount += 1
|
||||||
@@ -329,7 +360,7 @@ RegisterNetEvent(getScript()..':Consume', function(itemName)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if stats.effect == "heal" then
|
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")
|
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))
|
exports["ps-buffs"]:AddHealthBuff((tonumber(stats.time) or 10000), (stats.amount or 6))
|
||||||
else
|
else
|
||||||
@@ -339,12 +370,12 @@ RegisterNetEvent(getScript()..':Consume', function(itemName)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if stats.effect == "stamina" then
|
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")
|
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))
|
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
|
else CreateThread(function() StaminaEffect({(tonumber(stats.time) or 10000), (stats.amount or 6)}) end) 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 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 == "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
|
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
|
||||||
end)
|
end)
|
||||||
|
|
||||||
AddEventHandler('onResourceStop', function(r) if r ~= GetCurrentResourceName() then return end
|
onResourceStop(function()
|
||||||
lockInv(false)
|
lockInv(false)
|
||||||
|
|
||||||
StopEffects()
|
StopEffects()
|
||||||
end)
|
end, true)
|
||||||
14
config.lua
14
config.lua
@@ -1,17 +1,19 @@
|
|||||||
Config = {
|
Config = {
|
||||||
System = {
|
System = {
|
||||||
Debug = false,
|
Debug = true,
|
||||||
EventDebug = false,
|
EventDebug = false,
|
||||||
|
|
||||||
Notify = "qb",
|
Menu = "qb", -- "qb", "ox"
|
||||||
Menu = "qb",
|
Notify = "gta", -- "qb", "ox", "gta"
|
||||||
ProgressBar = "qb",
|
ProgressBar = "gta", -- "qb", "ox", "gta"
|
||||||
drawText = "gta",
|
drawText = "gta", -- "qb", "ox", "gta"
|
||||||
|
|
||||||
},
|
},
|
||||||
Main = {
|
Main = {
|
||||||
UseProgbar = false, -- Disabled this, progress bars stop all anims when complete.
|
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 = {
|
Crafting = {
|
||||||
showItemBox = true
|
showItemBox = true -- Display "use" item boxes on some inventories that need to be told to
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,6 @@ shared_scripts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client_scripts {
|
client_scripts {
|
||||||
--'@warmenu/warmenu.lua',
|
|
||||||
'client/*.lua',
|
'client/*.lua',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.5
|
2.0
|
||||||
Reference in New Issue
Block a user