mirror of
https://github.com/jimathy/jim-consumables.git
synced 2026-08-17 06:26:03 +01:00
Linting
This commit is contained in:
@@ -255,11 +255,13 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
|
||||
if not QBCore.Shared.Items[itemName].thirst and not QBCore.Shared.Items[itemName].hunger then
|
||||
local hunger = 0
|
||||
local thirst = 0
|
||||
if if Config.Consumables[itemName].stats then
|
||||
if Config.Consumables[itemName].stats.hunger then hunger = Config.Consumables[itemName].stats.hunger end
|
||||
TriggerServerEvent("QBCore:Server:SetMetaData", "hunger", QBCore.Functions.GetPlayerData().metadata["hunger"] + hunger)
|
||||
if Config.Consumables[itemName].stats.thirst then thirst = Config.Consumables[itemName].stats.thirst end
|
||||
TriggerServerEvent("QBCore:Server:SetMetaData", "thirst", QBCore.Functions.GetPlayerData().metadata["thirst"] + thirst)
|
||||
end
|
||||
end
|
||||
|
||||
if stress then TriggerServerEvent('hud:server:RelieveStress', stress) end
|
||||
|
||||
|
||||
19
config.lua
19
config.lua
@@ -4,11 +4,9 @@ print("Jim-Consumables v1.0 - Consumables Script by Jimathy")
|
||||
|
||||
-- https://discord.gg/xKgQZ6wZvS
|
||||
|
||||
Config = {}
|
||||
|
||||
Config.Debug = false -- false to remove green boxes
|
||||
|
||||
Config.Consumables = {
|
||||
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), }},
|
||||
@@ -52,11 +50,11 @@ Config.Consumables = {
|
||||
stats = { hunger = math.random(10,20), }, -- The stats of the item, if not found in the items.lua
|
||||
},
|
||||
]]
|
||||
}
|
||||
|
||||
Config.Emotes = {
|
||||
["drink"] = {"mp_player_inteat@pnq", "loop", "Drink", AnimationOptions =
|
||||
{ EmoteMoving = true, EmoteDuration = 2500, }},
|
||||
},
|
||||
Emotes = {
|
||||
["drink"] = {"mp_player_intdrink", "loop_bottle", "Drink", AnimationOptions =
|
||||
{ Prop = "prop_ld_flow_bottle", PropBone = 18905, PropPlacement = {0.12, 0.008, 0.03, 240.0, -60.0},
|
||||
EmoteMoving = true, EmoteLoop = true, }},
|
||||
["whiskeyb"] = {"mp_player_intdrink", "loop_bottle", "(Don't Use) Whiskey Bottle", AnimationOptions =
|
||||
{ Prop = "prop_cs_whiskey_bottle", PropBone = 60309, PropPlacement = {0.0, 0.0, 0.0, 0.0, 0.0},
|
||||
EmoteMoving = true, EmoteLoop = true }},
|
||||
@@ -262,4 +260,5 @@ Config.Emotes = {
|
||||
{ EmoteLoop = true, EmoteMoving = true, }},
|
||||
["oxy"] = { "mp_suicide", "pill", "Oxy", AnimationOptions =
|
||||
{ EmoteLoop = true, EmoteMoving = true, }},
|
||||
},
|
||||
}
|
||||
@@ -1,18 +1,10 @@
|
||||
name "Jim-Consumables"
|
||||
author "Jimathy"
|
||||
version "v1"
|
||||
version "v1.0"
|
||||
description "Consumable Script By Jimathy"
|
||||
fx_version "cerulean"
|
||||
game "gta5"
|
||||
|
||||
client_scripts {
|
||||
'client/*.lua',
|
||||
}
|
||||
|
||||
server_scripts {
|
||||
'server/*.lua'
|
||||
}
|
||||
|
||||
shared_scripts {
|
||||
'config.lua',
|
||||
}
|
||||
client_scripts { 'client/*.lua', }
|
||||
server_scripts { 'server/*.lua' }
|
||||
shared_scripts { 'config.lua', }
|
||||
@@ -7,11 +7,9 @@ CreateThread(function()
|
||||
TriggerClientEvent('jim-consumables:Consume', source, item.name)
|
||||
end)
|
||||
end
|
||||
local itemcheck = {}
|
||||
local emotecheck = {}
|
||||
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") elseif QBCore.Shared.Items[k] then end
|
||||
if not Config.Emotes[v.emote] then print("Emote check - '"..k.."' requested emote '"..v.emote.."' - not found in config.lua") elseif Config.Emotes[v.emote] then 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)
|
||||
Reference in New Issue
Block a user