2.0Beta upload

This commit is contained in:
Jim Shield
2025-04-01 19:34:44 +01:00
committed by GitHub
parent 11f479d8f8
commit 531c93377a
9 changed files with 962 additions and 750 deletions

252
README.md
View File

@@ -1,126 +1,126 @@
# Jim-Consumables
Consumables script for QBCore
# What is this?
This script is designed as a replacement/override for food and drink consumables in `qb-smallresources`
It's main purpose was to make it so players did not stand up while sitting with my scripts due to lazy events such as ClearPedTasks in progressbar and dpemotes, this one is designed to cancel the animation you have chosen, not all animations.
It's recommended to set `Config.UseProgBar` to `false` to get this effect.
# THIS DOESN'T USE DPEMOTES OR RPEMOTES
# YOU **NEED** TO PUT THE EMOTES IN THE BOTTOM OF THE CONFIG.LUA
## v1.5 Update Information
I've added a export system that allows scripts to easily add new foods and drinks to be usable and then sync them between players
This should work but may have issues.
But because of the export system being used, Jim-Consumables **NEEDS** to start before any scripts that use it.
This will be built into my scripts that use consumables to make it more plug and play
# Installation
- I always recommend starting my scripts **AFTER** `[qb]` not inside it as it can mess with any dependancies on server load
- I have a separate folder called `[jimextras]` (that is also in the resources folder) that starts before any scripts would use it.
- This ensure's it has everything it requires before trying to load
- Example of my load order:
```CSS
# QBCore & Extra stuff
ensure qb-core
ensure [qb]
ensure [standalone]
ensure [voice]
ensure [defaultmaps]
ensure [vehicles]
# Extra Jim Stuff
ensure [jimextras]
ensure [jim]
```
## QB-SmallResources
- It should already take control of default qbcore food, drink and drugs.
- If it fails to do this and attempts to use qb-smallresources still you will need to:
- `[qb]` > `qb-smallresources` > `server` > `consumables.lua`
- Remove or comment out the `CreateUseableItem` events for *alcohol*, *eat*, *drink* and *drug* in this file
- Not all of them! (such as armour related items)
- This ***should*** stop `qb-smallresources` taking control and confusing `jim-consumables`
## New Items
To add an item, you only need to add a new item table in the Config.Consumables like this:
```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
type = "food", -- Type: "alcohol" / "drink" / "food"
returnItem = { -- Item that will be given when the item is used
item = "plastic", -- eg. Plastic bottles can give "plastic"
amount = 1,
},
stats = {
screen = "rampage", -- The screen effect to be played when after consuming the item
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)
amount = 2, -- 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
thirst = math.random(10,20), -- The hunger/thirst stats of the item, if not found in the items.lua
},
},
```
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
```lua
--The current list of screen effects are:
"turbo"
"focus"
"rampage"
"weed"
"trevor"
"nightvision"
"thermal"
```
## PS-Buffs Support
This scripts can be expanded with ps-buffs (https://github.com/Project-Sloth/ps-buffs)
If this script is enabled it will automatically try to use their system to apply buffs:
```lua
--The extra buffs that can be set include:
"heal" -- Health recovery buff
"stamina" -- Stamina recovery buff
"swimming" -- Swimming speed buff
"stress" -- Stress recovery buff
"armor" -- Armour recovery buff
"hacking" -- Hacking effect
"intelligence" -- Intelligence effect
"luck" -- Luck effect
"strength" -- Strength effect
```
This script supports dpemotes style emotes, so if you have some that you want to be triggered when eating or drinking drop it in the Config.Emotes section.
## Add consumables from external scripts
A small example of a server-sided snippet for this imports the item and the emote, then syncs it to players before and after they connect.
```lua
local foodTable = {
["shotfries"] = { emote = "bsfries", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(55,65), }},
}
local emoteTable = {
["bsfries"] = {"mp_player_inteat@burger", "mp_player_int_eat_burger_fp", "Fries", AnimationOptions = { Prop = "prop_food_bs_chips", PropBone = 18905, PropPlacement = {0.09, -0.06, 0.05, 300.0, 150.0}, EmoteMoving = true, EmoteLoop = true, }},
}
for k, v in pairs(foodTable) do TriggerEvent("jim-consumables:server:syncAddItem", k, v) end
for k, v in pairs(emoteTable) do TriggerEvent("jim-consumables:server:syncAddEmote", k, v) end
```
This will grab the `shotfries` item info and add it to the `Config.Consumables` while the servers running and the same with the built-in emote system
# Jim-Consumables
Consumables script for QBCore
# What is this?
This script is designed as a replacement/override for food and drink consumables in `qb-smallresources`
It's main purpose was to make it so players did not stand up while sitting with my scripts due to lazy events such as ClearPedTasks in progressbar and dpemotes, this one is designed to cancel the animation you have chosen, not all animations.
It's recommended to set `Config.UseProgBar` to `false` to get this effect.
# THIS DOESN'T USE DPEMOTES OR RPEMOTES
# YOU **NEED** TO PUT THE EMOTES IN THE BOTTOM OF THE CONFIG.LUA
## v1.5 Update Information
I've added a export system that allows scripts to easily add new foods and drinks to be usable and then sync them between players
This should work but may have issues.
But because of the export system being used, Jim-Consumables **NEEDS** to start before any scripts that use it.
This will be built into my scripts that use consumables to make it more plug and play
# Installation
- I always recommend starting my scripts **AFTER** `[qb]` not inside it as it can mess with any dependancies on server load
- I have a separate folder called `[jimextras]` (that is also in the resources folder) that starts before any scripts would use it.
- This ensure's it has everything it requires before trying to load
- Example of my load order:
```CSS
# QBCore & Extra stuff
ensure qb-core
ensure [qb]
ensure [standalone]
ensure [voice]
ensure [defaultmaps]
ensure [vehicles]
# Extra Jim Stuff
ensure [jimextras]
ensure [jim]
```
## QB-SmallResources
- It should already take control of default qbcore food, drink and drugs.
- If it fails to do this and attempts to use qb-smallresources still you will need to:
- `[qb]` > `qb-smallresources` > `server` > `consumables.lua`
- Remove or comment out the `CreateUseableItem` events for *alcohol*, *eat*, *drink* and *drug* in this file
- Not all of them! (such as armour related items)
- This ***should*** stop `qb-smallresources` taking control and confusing `jim-consumables`
## New Items
To add an item, you only need to add a new item table in the Config.Consumables like this:
```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
type = "food", -- Type: "alcohol" / "drink" / "food"
returnItem = { -- Item that will be given when the item is used
item = "plastic", -- eg. Plastic bottles can give "plastic"
amount = 1,
},
stats = {
screen = "rampage", -- The screen effect to be played when after consuming the item
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)
amount = 2, -- 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
thirst = math.random(10,20), -- The hunger/thirst stats of the item, if not found in the items.lua
},
},
```
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
```lua
--The current list of screen effects are:
"turbo"
"focus"
"rampage"
"weed"
"trevor"
"nightvision"
"thermal"
```
## PS-Buffs Support
This scripts can be expanded with ps-buffs (https://github.com/Project-Sloth/ps-buffs)
If this script is enabled it will automatically try to use their system to apply buffs:
```lua
--The extra buffs that can be set include:
"heal" -- Health recovery buff
"stamina" -- Stamina recovery buff
"swimming" -- Swimming speed buff
"stress" -- Stress recovery buff
"armor" -- Armour recovery buff
"hacking" -- Hacking effect
"intelligence" -- Intelligence effect
"luck" -- Luck effect
"strength" -- Strength effect
```
This script supports dpemotes style emotes, so if you have some that you want to be triggered when eating or drinking drop it in the Config.Emotes section.
## Add consumables from external scripts
A small example of a server-sided snippet for this imports the item and the emote, then syncs it to players before and after they connect.
```lua
local foodTable = {
["shotfries"] = { emote = "bsfries", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(55,65), }},
}
local emoteTable = {
["bsfries"] = {"mp_player_inteat@burger", "mp_player_int_eat_burger_fp", "Fries", AnimationOptions = { Prop = "prop_food_bs_chips", PropBone = 18905, PropPlacement = {0.09, -0.06, 0.05, 300.0, 150.0}, EmoteMoving = true, EmoteLoop = true, }},
}
for k, v in pairs(foodTable) do TriggerEvent("jim-consumables:server:syncAddItem", k, v) end
for k, v in pairs(emoteTable) do TriggerEvent("jim-consumables:server:syncAddEmote", k, v) end
```
This will grab the `shotfries` item info and add it to the `Config.Consumables` while the servers running and the same with the built-in emote system

View File

@@ -1,58 +1,128 @@
local QBCore = exports[Config.Core]:GetCoreObject()
local alcoholCount, drugCount, consuming, cancelled = 0, 0, false, false
local Consumables, Emotes = {}, {}
Consumables, Emotes = {}, {}
local function propConvert() --Convert Prop Model Names to Model HashKeys now to be more optimized when loading later
for k in pairs(Emotes) do
if Emotes[k].AnimationOptions.Prop then
Emotes[k].AnimationOptions.Prop = GetHashKey(Emotes[k].AnimationOptions.Prop)
if Emotes[k].AnimationOptions.SecondProp then
Emotes[k].AnimationOptions.SecondProp = GetHashKey(Emotes[k].AnimationOptions.SecondProp)
local function syncConsumables()
Consumables = triggerCallback(getScript()..":server:syncConsumables")
Emotes = triggerCallback(getScript()..":server:syncEmotes")
debugPrint("^5Debug^7: ^2Retrieved ^6"..countTable(Consumables).." ^2Items and ^6"..countTable(Emotes).." ^2Emotes^7")
end
RegisterNetEvent(getScript()..":client:syncConsumables", function(NewConsumables)
if debugMode then
for k, v in pairs(NewConsumables) do
if not Consumables[k] then
print("^5Debug^7: ^2New Item Info added^7: ^6"..k.."^7")
end
end
end
end
local function syncConsumables()
local p = promise.new() QBCore.Functions.TriggerCallback('jim-consumables:server:syncConsumables', function(cb) p:resolve(cb) end) Consumables = Citizen.Await(p)
local p2 = promise.new() QBCore.Functions.TriggerCallback('jim-consumables:server:syncEmotes', function(cb) p2:resolve(cb) end) Emotes = Citizen.Await(p2)
if Config.Debug then print("^5Debug^7: ^2Retrieved ^6"..countTable(Consumables).." ^2Items and ^6"..countTable(Emotes).." ^2Emotes^7") end
propConvert()
end
RegisterNetEvent("jim-consumables:client:syncConsumables", function(NewConsumables)
if Config.Debug then for k, v in pairs(NewConsumables) do if not Consumables[k] then print("^5Debug^7: ^2New Item Info added^7: ^6"..k.."^7") end end end
Consumables = NewConsumables
end)
RegisterNetEvent("jim-consumables:client:syncEmotes", function(NewEmotes)
if Config.Debug then for k, v in pairs(NewEmotes) do if not Emotes[k] then print("^5Debug^7: ^2New Emote Info added^7: ^6"..k.."^7") end end end
RegisterNetEvent(getScript()..":client:syncEmotes", function(NewEmotes)
if debugMode then
for k, v in pairs(NewEmotes) do
if not Emotes[k] then
print("^5Debug^7: ^2New Emote Info added^7: ^6"..k.."^7")
end
end
end
Emotes = NewEmotes
propConvert()
end)
AddEventHandler('onResourceStart', function(r) if GetCurrentResourceName() ~= r then return end syncConsumables() end)
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() syncConsumables() end)
onPlayerLoaded(function() syncConsumables() end, true)
RegisterNetEvent('jim-consumables:Consume', function(itemName)
if not HasItem(itemName, 1) then print("^5Debug^7: ^1Error^7: ^2Item not found in inventory^7, ^2stopping^7..") end
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) TriggerEvent('inventory:client:busy:status', true) TriggerEvent('canUseInventoryAndHotbar:toggle', false)
local Player = PlayerPedId()
RegisterNetEvent(getScript()..':Consume', function(itemName)
if not hasItem(itemName, 1) then
print("^5Debug^7: ^1Error^7: ^2Item not found in inventory^7, ^2stopping^7..")
end
local requiredItem = Consumables[itemName].requiredItem or nil
if requiredItem then
if not hasItem(requiredItem, 1) then
triggerNotify(nil, "You need a "..Items[requiredItem].label, "error")
return
else
-- if requiredItem == "lighter" then breakTool({ item = "lighter", damage = math.random(0, 1) }) end
end
end
debugPrint("^5Debug^7: ^3Consume^7: ^2Starting event, locking inventory and grabbing data^7..")
tempLockInv(true)
local Player = PlayerPedId()
local emote = Emotes[Consumables[itemName].emote] or Emotes["crisps"]
if isAnimal then --- Animal ped adjustments
local presets = {
["default"] = {
propPlacement = { 0.0, 0.25, -0.04, 0.0, 0.0, 0.0, },
propPlacement2 = { 0.0, 0.25, -0.02, 0.0, 0.0, 0.0, }
},
[`a_c_rabbit_01`] = {
propPlacement = { 0.0, 0.37, -0.15, 0.0, 0.0, 0.0, },
propPlacement2 = { 0.0, 0.37, -0.13, 0.0, 0.0, 0.0, }
},
[`a_c_rat`] = {
propPlacement = { 0.0, 0.25, -0.04, 0.0, 0.0, 0.0, },
propPlacement2 = { 0.0, 0.25, -0.02, 0.0, 0.0, 0.0, }
},
[`a_c_crow`] = {
propPlacement = { 0.0, 0.25, 0.02, 0.0, 0.0, 0.0, },
propPlacement2 = { 0.0, 0.25, 0.04, 0.0, 0.0, 0.0, }
},
}
local model = GetEntityModel(Player)
local isCat = (isCat() or model == `ft-raccoon`) and (model ~= `ft-sphynx`)
local isDog, bigDog = isDog()
if isDog and model == `a_c_coyote` then isDog = false end
local isCoyote = (model == `ft-sphynx` or model == `a_c_coyote`)
if model == `ft-capmonkey2` then isDog = true end
local propPlacement, propPlacement2 = { 0.0, 0.37, -0.19, 0.0, 0.0, 0.0, }, { 0.0, 0.37, -0.17, 0.0, 0.0, 0.0, }
if isDog then
if bigDog or isCoyote then
propPlacement = { 0.0, 0.53, -0.39, 0.0, 0.0, 0.0, } propPlacement2 = { 0.0, 0.53, -0.37, 0.0, 0.0, 0.0, }
else
propPlacement = { 0.0, 0.33, -0.28, 0.0, 0.0, 0.0, } propPlacement2 = { 0.0, 0.33, -0.26, 0.0, 0.0, 0.0, }
end
end
if not isCat and not isDog then
propPlacement = presets[model] and presets[model].propPlacement or presets["default"].propPlacement
propPlacement2 = presets[model] and presets[model].propPlacement2 or presets["default"].propPlacement
end
emote = {
"creatures@pug@move", "nill", "",
AnimationOptions = {
EmoteLoop = true,
Prop = "v_res_tt_bowl",
PropBone = 64081,
PropPlacement = propPlacement,
SecondProp = Emotes[Consumables[itemName].emote].AnimationOptions.Prop or nil,
SecondPropBone = Emotes[Consumables[itemName].emote].AnimationOptions.Prop and 64081 or nil,
SecondPropPlacement = Emotes[Consumables[itemName].emote].AnimationOptions.Prop and propPlacement2 or nil,
},
}
end
local returnItem = Consumables[itemName].returnItem or nil
local animDict, anim = tostring(emote[1]), tostring(emote[2])
local model, model2, bone, bone2, drugeffect, stress
local P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12 = table.unpack({0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}) -- Default placement coord cariable
local RewardItem = Consumables[itemName].rewards or nil
local time = Consumables[itemName].time or math.random(5000, 6000)
local type = Consumables[itemName].type or ""
local stress = Consumables[itemName].stress or 0
local heal = Consumables[itemName].heal or 0
local armor = Consumables[itemName].armor or 0
local stats = Consumables[itemName].stats or nil
local pack = Consumables[itemName].pack or nil
local string = "Using "
local notifType = ""
local canRun = Consumables[itemName].canRun
local time, stress, heal, armor, stats = GenerateRandomValues({
time = Consumables[itemName].time or { 5000, 6000 },
stress = Consumables[itemName].stress or 0,
heal = Consumables[itemName].heal or 0,
armor = Consumables[itemName].armor or 0,
hunger = Consumables[itemName].stats and Consumables[itemName].stats.hunger or 0,
thirst = Consumables[itemName].stats and Consumables[itemName].stats.thirst or 0,
})
if emote.AnimationOptions.Prop then
model = emote.AnimationOptions.Prop
bone = GetPedBoneIndex(Player, emote.AnimationOptions.PropBone)
@@ -63,16 +133,27 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
P7, P8, P9, P10, P11, P12 = table.unpack(emote.AnimationOptions.SecondPropPlacement)
end
end
if type == "drink" or type == "alcohol" then string = "Drinking "
elseif type == "food" then string = "Eating "
else string = "Using " end
if type == "drink" or type == "alcohol" then
string = "Drinking "
notifType = "drinking"
elseif type == "food" then
string = "Eating "
notifType = "eating"
elseif type == "smoke" then
string = "Smoking "
notifType = "smoking"
elseif type == "pack" then
string = "Opening "
notifType = "package"
else string = "Using "
notifType = "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)
debugPrint("^5Debug^7: ^3Consume^7: ^2Event already started^7, ^1Cancelling^7.")
tempLockInv(false)
if Config.UseProgbar then
if Config.ProgressBar == "ox" then exports.ox_lib:cancelProgress()
else TriggerEvent("progressbar:client:cancel") end
stopPropgressBar()
else
triggerNotify(nil, "Stopped "..string, "error")
end
@@ -80,29 +161,36 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
return
end
--Emote Stuff
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Grabbing Emote Animation Options^7...") end
debugPrint("^5Debug^7: ^3Consume^7: ^2Grabbing Emote Animation Options^7...")
local InVehicle = IsPedInAnyVehicle(Player, true)
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Checking if player is in a vehicle^7 - ^6"..tostring(InVehicle).."^7") end
if InVehicle == 1 then MovementType = 51
debugPrint("^5Debug^7: ^3Consume^7: ^2Checking if player is in a vehicle^7 - ^6"..tostring(InVehicle).."^7")
MovementType = 0 -- Default movement type
if InVehicle == 1 then
MovementType = 51
elseif emote.AnimationOptions then
if emote.AnimationOptions.EmoteMoving then MovementType = 51
if emote.AnimationOptions.EmoteMoving then MovementType = 51
elseif emote.AnimationOptions.EmoteLoop then MovementType = 1
elseif emote.AnimationOptions.EmoteStuck then MovementType = 50
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
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)
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Player Movement Type^7 - ^6"..json.encode(MovementType).." ^7") end
if Config.UseProgbar then
if Config.ProgressBar == "ox" then
CreateThread(function() if exports.ox_lib:progressBar({ duration = time, label = string..QBCore.Shared.Items[itemName].label.."..", useWhileDead = false, canCancel = false,}) then consuming = false else end end)
else
CreateThread(function() QBCore.Functions.Progressbar('jimmy_consume_', string..QBCore.Shared.Items[itemName].label.."..", time, false, false, {disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = true,}, {}, {}, {}, function() consuming = false end, function() end, itemName) end)
end
debugPrint("^5Debug^7: ^3Consume^7: ^2Playing Animation^7...")
if not (GetPedType(Player) == 28)then
playAnim(animDict, anim, -1, MovementType)
end
debugPrint("^5Debug^7: ^3Consume^7: ^2Player Movement Flag^7 - ^6"..json.encode(MovementType).." ^7")
if Config.Main.UseProgbar then
CreateThread(function()
if progressBar({ time = time, label = string..Items[itemName].label.."..", dead = false, cancel = false}) then
consuming = false
else
end
end)
else
triggerNotify(nil, string..QBCore.Shared.Items[itemName].label.."..", "success")
triggerNotify(nil, string..Items[itemName].label.."..", notifType)
end
consuming = true
@@ -110,44 +198,58 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
--Prop Spawning
if model then
if IsModelValid(model) == 1 then
if Config.Debug then print("^5Debug^7: ^3PropSpawn^7: ^2Spawning consumable prop^7.") end
attachProp = makeProp({ prop = model, coords = vector4(0.0,0.0,0.0,0.0)}, 1, 1)
AttachEntityToEntity(attachProp, Player, bone, P1, P2, P3, P4, P5, P6, true, true, false, true, 1, true)
if model2 then
if IsModelValid(model2) == 1 then
attachProp2 = makeProp({ prop = model2, coords = vector4(0.0,0.0,0.0,0.0)}, 1, 1)
AttachEntityToEntity(attachProp2, Player, bone2, P7, P8, P9, P10, P11, P12, true, true, false, true, 1, true)
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
debugPrint("^5Debug^7: ^3PropSpawn^7: ^2Spawning consumable prop^7...")
attachProp = makeProp({ prop = model, coords = vector4(0.0,0.0,0.0,0.0)}, 1, 1)
AttachEntityToEntity(attachProp, Player, bone, P1, P2, P3, P4, P5, P6, true, true, false, true, 1, true)
if model2 then
if IsModelValid(model2) == 1 then
attachProp2 = makeProp({ prop = model2, coords = vector4(0.0,0.0,0.0,0.0)}, 1, 1)
AttachEntityToEntity(attachProp2, Player, bone2, P7, P8, P9, P10, P11, P12, true, true, false, true, 1, true)
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
end
end)
end)
while consuming do
if time <= 0 then consuming = false end
if not canRun then
if IsControlJustPressed(0, 21) then
consuming = false
cancelled = true
LocalPlayer.state:set("inv_busy", false, true)
if Config.UseProgbar then
if Config.ProgressBar == "ox" then exports.ox_lib:cancelProgress()
else TriggerEvent("progressbar:client:cancel") end
else
triggerNotify(nil, "Cancelled "..string, "error")
end
local drawTable = debugMode and
{ "[BackSpace] Stop Consuming",
"Time: "..tostring(time),
"Type: "..(type or ""),
"Hunger: "..(stats.hunger or 0).."%",
"Thirst: "..(stats.thirst or 0).."%",
"Stress: "..(stress or 0).."%",
"Heal: "..(heal or 0).."%",
"Armour: "..(armor or 0).."%",
} or
{ "[BackSpace] Stop Consuming", }
drawText(nil, drawTable, nil, nil)
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
tempLockInv(false)
hideText()
if Config.Main.UseProgbar then
stopPropgressBar()
else
triggerNotify(nil, "Cancelled "..string, "error")
end
end
Wait(9)
time -= 11
Wait(0)
time -= 12
end
StopEntityAnim(Player, anim, animDict, 1.0)
unloadAnimDict(animDict)
if not cancelled then
toggleItem(false, itemName, 1)
if returnItem ~= nil then toggleItem(true, returnItem.item, returnItem.amount) end
hideText()
removeItem(itemName, 1)
if returnItem ~= nil then
currentToken = triggerCallback(AuthEvent)
addItem(returnItem.item, returnItem.amount)
end
-- Reward Item calculations
CreateThread(function()
@@ -157,8 +259,9 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
while true do
local item = math.random(1, countTable(RewardItem)) -- random item in the list to pick
if RewardItem[item].rarity >= rarity then
toggleItem(true, RewardItem[item].item, math.random(1, RewardItem[item].max))
if Config.Debug then print("^5Debug^7: ^2Given reward prize^7: '^6"..RewardItem[item].item.."^7'") end
currentToken = triggerCallback(AuthEvent)
addItem(RewardItem[item].item, math.random(1, RewardItem[item].max or 1))
debugPrint("^5Debug^7: ^2Given reward prize^7: '^6"..RewardItem[item].item.."^7'")
break
end
Wait(100)
@@ -168,25 +271,31 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
end
end)
if stats then
if stats.hunger then TriggerServerEvent("jim-consumables:server:addNeed", QBCore.Functions.GetPlayerData().metadata["hunger"] + stats.hunger, "hunger") end
if stats.thirst then TriggerServerEvent("jim-consumables:server:addNeed", QBCore.Functions.GetPlayerData().metadata["thirst"] + stats.thirst, "thirst") end
if stats.hunger then
--stats.hunger = math.random(stats.hunger - 5, stats.hunger + 5)
TriggerServerEvent(getScript()..":server:addNeed", Core.Functions.GetPlayerData().metadata["hunger"] + stats.hunger, "hunger")
end
if stats.thirst then
--stats.thirst = math.random(stats.thirst - 5, stats.thirst + 5)
TriggerServerEvent(getScript()..":server:addNeed", Core.Functions.GetPlayerData().metadata["thirst"] + stats.thirst, "thirst")
end
end
if Config.Debug then print("^5Debug^7: ^2Hunger^7: [^6"..(stats.hunger or 0).."^7] ^2Thrist^7: [^6"..(stats.thirst or 0).."^7]" ) end
debugPrint("^5Debug^7: ^2Hunger^7: [^6"..(stats.hunger or 0).."^7] ^2Thrist^7: [^6"..(stats.thirst or 0).."^7]" )
if stress and stress ~= 0 then
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Reliving ^6"..stress.." ^2stress^7.") end
debugPrint("^5Debug^7: ^3Consume^7: ^2Relieving ^6"..stress.." ^2stress^7.")
TriggerServerEvent('hud:server:RelieveStress', stress)
end
if heal and heal ~= 0 then
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Healing player by^7: ^6"..heal) end
debugPrint("^5Debug^7: ^3Consume^7: ^2Healing player by^7: ^6"..heal)
SetEntityHealth(Player, GetEntityHealth(Player) + heal)
end
if armor and armor ~= 0 then
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Adding ^6"..armor.." ^2armour^7.") end
debugPrint("^5Debug^7: ^3Consume^7: ^2Adding ^6"..armor.." ^2armour^7.")
TriggerServerEvent('hospital:server:SetArmor', (GetPedArmour(Player) + armor)) SetPedArmour(Player, (GetPedArmour(Player) + 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
alcoholCount += 1
debugPrint("^5Debug^7: ^3Consume^7: ^2Current ^4alcoholCount^7: ^6"..alcoholCount)
if alcoholCount > 1 and alcoholCount < 4 then
TriggerEvent("evidence:client:SetStatus", "alcohol", 200)
elseif alcoholCount >= 4 then
@@ -194,6 +303,10 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
CreateThread(function() AlienEffect() end) -- Used as overdosing/too drunk effect
end
end
if pack then
currentToken = triggerCallback(AuthEvent)
addItem(pack.item, pack.amount)
end
if stats then
if stats.screen then -- Screen effect activation
if stats.screen == "turbo" then CreateThread(function() TurboEffect() end) end
@@ -205,30 +318,34 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
if stats.screen == "thermal" then CreateThread(function() ThermalEffect() end) end
end
if stats.canOD then
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Current ^4drugCount^7: ^6"..(drugCount + 1)) end
drugCount += 1
debugPrint("^5Debug^7: ^3Consume^7: ^2Current ^4drugCount^7: ^6"..drugCount)
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(Player) - math.random(10,15))
debugPrint("^5Debug^7: ^3Consume^7: ^2Current ^4drugCount^7: ^6"..drugCount.."^7 - ^2 removing health")
SetEntityHealth(PlayerPedId(), GetEntityHealth(Player) - math.random(10, 15))
if drugCount >= 7 then
CreateThread(function() AlienEffect() end) -- If too many drugs, if not dead will make you stumble
end
end
end
if stats.effect == "heal" then
if GetResourceState("ps-buffs") == "started" then
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^4PS^7-^4Buffs ^2found^7, ^2hooking in to get buffs and applying ^6Health Buff ^2for ^6"..stats.time.."^7ms") end
if GetResourceState("ps-buffs"):find("start") 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 CreateThread(function() HealEffect({(tonumber(stats.time) or 10000), (stats.amount or 6)}) end) end
else
CreateThread(function()
HealEffect({(tonumber(stats.time) or 10000), (stats.amount or 6)})
end)
end
end
if stats.effect == "stamina" then
if GetResourceState("ps-buffs") == "started" then
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^4PS^7-^4Buffs ^2found^7, ^2hooking in to get buffs and applying ^6Stamina Buff ^2for ^6"..stats.time.."^7ms") end
if GetResourceState("ps-buffs"):find("start") 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") == "started" then --PS-BUFFS ONLY
--if Config.Debug then if stats.effect then print("^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 end
if GetResourceState("ps-buffs"):find("start") 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
if stats.effect == "swimming" then exports["ps-buffs"]:SwimmingBuffEffect((tonumber(stats.time) or 10000), (stats.amount or 6)) end
@@ -242,8 +359,8 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
end
cancelled = false
consuming = false
if Config.Debug then print("^5Debug^7: ^3Consume^7: ^2Finished, unlocking inventory^7...") end
LocalPlayer.state:set("inv_busy", false, true) TriggerEvent('inventory:client:busy:status', false) TriggerEvent('canUseInventoryAndHotbar:toggle', true)
debugPrint("^5Debug^7: ^3Consume^7: ^2Finished, unlocking inventory^7...")
tempLockInv(false)
end)
CreateThread(function()
@@ -255,5 +372,7 @@ CreateThread(function()
end)
AddEventHandler('onResourceStop', function(r) if r ~= GetCurrentResourceName() then return end
lockInv(false)
StopEffects()
end)
end)

View File

@@ -0,0 +1,249 @@
RegisterNetEvent("jim-consumables:client:consumableCreator", function()
local itemTable, emoteTable = {}, {}
for k, v in pairsByKeys(Items) do itemTable[#itemTable+1] = { value = tostring(k), label = tostring((v.label or k)) } end
table.sort(itemTable, function(a, b) return a.label < b.label end)
for k in pairsByKeys(Emotes) do emoteTable[#emoteTable+1] = { value = k, label = k } end
local input = lib.inputDialog("Consumable Creator", {
{ type = "select",
label = "Item List",
options = itemTable,
required = true,
icon = "fas fa-burger",
clearable = true,
searchable = true -- Doesnt work as i think only ox_lib lua was updated, the web stuff doesn't support this
},
{ type = "select",
label = "Emote",
options = emoteTable,
required = true,
icon = "fas fa-user",
clearable = true,
searchable = true, -- Doesnt work as i think only ox_lib lua was updated, the web stuff doesn't support this
default = "burger",
},
{ type = "select",
label = "Item Required for consuming",
options = itemTable,
required = false,
icon = "fas fa-utensils",
clearable = true,
searchable = true -- Doesnt work as i think only ox_lib lua was updated, the web stuff doesn't support this
},
{ type = 'number', label = 'Time', description = "How long it takes in ms to consume item", default = 5000, icon = "fas fa-clock", },
{ type = 'number', label = 'Stress Relief', description = "How much stress to relieve", default = 0, icon = "fas fa-mug-hot", },
{ type = 'number', label = 'Healing Amount', description = "How much to heal after consuming", default = 0, icon = "fas fa-notes-medical", },
{ type = 'number', label = 'Armour', description = "How much armour to give after consuming", default = 0, icon = "fas fa-shield-halved", },
{ type = "select", label = "Type", default = "food", icon = "fas fa-box", options = {
{ value = "food", label = "Food" },
{ value = "drink", label = "Drink" },
{ value = "alcohol", label = "Alcohol" },
{ value = "drug", label = "Drugs" },
{ value = "smoke", label = "Cigar/Cigarette" },
{ value = "pack", label = "Pack (Container Item)" },
}},
})
if not input or not input[1] then return end
local resultTable = {
item = input[1],
emote = input[2],
requireItem = input[3] or nil,
time = { input[4], input[4] + 1000 },
stress = input[5],
heal = input[6],
armor = input[7],
type = input[8],
}
if resultTable.type == "food" or resultTable.type == "drink" then foodInput(resultTable)
elseif resultTable.type == "pack" then packInput(resultTable, itemTable)
else
ExtraStatsInput(resultTable)
end
end, false)
function foodInput(prevInput)
local resultTable = prevInput
local input = lib.inputDialog((Items[prevInput.item].label or prevInput.item).." - Food or Drink",{
{ type = 'number', label = 'Hunger %', default = 0, icon = "fas fa-burger", },
{ type = 'number', label = 'Thirst %', default = 0, icon = "fas fa-mug-hot", },
})
if not input or not input[1] then return end
resultTable["stats"] = {
hunger = input[1] ~= 0 and { input[1], input[1] + 10 } or 0,
thirst = input[2] ~= 0 and { input[2], input[2] + 10 } or 0,
}
ExtraStatsInput(resultTable)
end
function packInput(prevInput, itemTable)
local resultTable = prevInput
local input = lib.inputDialog((Items[prevInput.item].label or prevInput.item).." - Pack", {
{ type = "select",
label = "Item List",
options = itemTable,
required = true,
icon = "fas fa-burger",
},
{ type = 'number', label = 'Amount to give of item', default = 1, icon = "fas fa-box", },
})
resultTable["pack"] = { item = input[1], amount = input[2], }
getConsumableResult(resultTable)
end
function ExtraStatsInput(prevInput)
local resultTable = prevInput
local input = lib.inputDialog((Items[prevInput.item].label or prevInput.item).." - Extra Stats", {
{ type = "select", label = "Buff Type", description = "These are 'gradual' buff effects", default = "none", options = {
{ value = "none", label = "None" },
{ value = "heal", label = "Healing" },
{ value = "stamina", label = "Stamina" },
{ value = "armor", label = "Armour" },
{ value = "stress", label = "Stress" },
{ value = "swimming", label = "Swimming" },
{ value = "hacking", label = "Hacking" },
{ value = "intelligence", label = "Intelligence" },
{ value = "luck", label = "Luck" },
{ value = "strength", label = "Strength" },
}},
{ type = "select", label = "Screen Effect", default = "none", options = {
{ value = "none", label = "None" },
{ value = "rampage", label = "Rampage" },
{ value = "turbo", label = "Turbo" },
{ value = "focus", label = "Focus" },
{ value = "weed", label = "Weed" },
{ value = "trevor", label = "Trevor" },
{ value = "nightvision", label = "Night Vision" },
{ value = "thermal", label = "Thermal Vision" },
}},
{ type = "number", label = "Total Time of 'Buff'", default = 10000, },
{ type = "number", label = "Amount to give per second", default = 6, },
((prevInput.type ~= "food" and prevInput.type ~= "drink") and { type = "select", label = "Wide Pupils", default = "false", options = {
{ value = "true", label = "True" },
{ value = "false", label = "False" },
}} or nil),
((prevInput.type ~= "food" and prevInput.type ~= "drink") and { type = "select", label = "Can Over Dose", default = "false", options = {
{ value = "true", label = "True" },
{ value = "false", label = "False" },
}} or nil),
})
if not input or not input[1] then return end
resultTable["stats"] = {
hunger = resultTable["stats"] and resultTable["stats"].hunger or 0,
thirst = resultTable["stats"] and resultTable["stats"].thirst or 0,
screen = input[2] or nil,
effect = input[1] or nil,
time = input[1] ~= "none" and input[3] or nil,
amount = input[1] ~= "none" and input[4] or nil,
widepupils = input[5],
canOD = input[6],
}
getConsumableResult(resultTable)
end
function getConsumableResult(data)
local resultString = '["'..data.item..'"] = { '
resultString = resultString..'emote = "'..data.emote..'", '
resultString = resultString.."canRun = true, "
resultString = resultString.."time = {"..data.time[1]..", "..data.time[2].."}, "
resultString = (data.stress > 0 and resultString.."stress = "..data.stress..", ") or resultString..""
resultString = (data.heal > 0 and resultString.."heal = "..data.heal..", ") or resultString..""
resultString = (data.armor > 0 and resultString.."armor = "..data.armor..", ") or resultString..""
resultString = resultString..'type = "'..data.type..'", '
if data.type == "pack" then
resultString = resultString..'pack = { item = "'..data.pack.item..'", amount = "'..data.pack.amount..'", }, '
end
if data.stats then
resultString = resultString.."stats = { "
if data.stats.hunger and type(data.stats.hunger) == "table" then
resultString = resultString..'hunger = { '..data.stats.hunger[1]..', '..data.stats.hunger[2]..' }, '
end
if data.stats.thirst and type(data.stats.thirst) == "table" then
resultString = resultString..'thirst = { '..data.stats.thirst[1]..', '..data.stats.thirst[2]..' }, '
end
if data.stats.screen and data.stats.screen ~= "none" then
resultString = resultString..'screen = "'..data.stats.screen..'", '
end
if data.stats.effect and data.stats.effect ~= "none" then
resultString = resultString..'effect = "'..data.stats.effect..'", '
resultString = resultString..'time = "'..data.stats.time..'", '
resultString = resultString..'amount = "'..data.stats.amount..'", '
end
if data.stats.widepupils == "true" then
resultString = resultString..'widepupils = "'..data.stats.widepupils..'", '
end
if data.stats.canOD == "true" then
resultString = resultString..'canOD = "'..data.stats.canOD..'", '
end
end
triggerNotify(nil, "Copied new consumable info to clipboard", "success")
lib.setClipboard(resultString .. " },")
end
RegisterNetEvent("jim-consumables:client:testEmotes", function()
local Menu = {}
for k, v in pairsByKeys(Emotes) do
Menu[#Menu+1] = {
header = k,
onSelect = function()
testEmote(v, k)
end
}
end
openMenu(Menu, { header = "Test Consumable Emotes" })
end)
function testEmote(emote, name)
triggerNotify(nil, "Testing "..name, "warning")
triggerNotify(nil, "Anim will loop twice then return to menu", "warning")
local MovementType = nil
local Player = PlayerPedId()
local InVehicle = IsPedInAnyVehicle(Player, true)
local animDict, anim = tostring(emote[1]), tostring(emote[2])
local model, model2, bone, bone2
local P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12 = table.unpack({0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}) -- Default placement coord cariable
if emote.AnimationOptions.Prop then
model = emote.AnimationOptions.Prop
bone = GetPedBoneIndex(Player, emote.AnimationOptions.PropBone)
P1, P2, P3, P4, P5, P6 = table.unpack(emote.AnimationOptions.PropPlacement)
if emote.AnimationOptions.SecondProp then
model2 = emote.AnimationOptions.SecondProp
bone2 = GetPedBoneIndex(Player, emote.AnimationOptions.SecondPropBone)
P7, P8, P9, P10, P11, P12 = table.unpack(emote.AnimationOptions.SecondPropPlacement)
end
end
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
end
playAnim(animDict, anim, (GetAnimDuration(animDict, anim) * 1000 )*2, MovementType)
local consuming = true
--Prop Spawning
CreateThread(function()
if model then
if IsModelValid(model) == 1 then
triggerNotify(nil, "Debug: Spawning consumable prop")
attachProp = makeProp({ prop = model, coords = vector4(0.0,0.0,0.0,0.0)}, 1, 1)
AttachEntityToEntity(attachProp, Player, bone, P1, P2, P3, P4, P5, P6, true, true, false, true, 1, true)
if model2 then
triggerNotify(nil, "Debug: Spawning consumable prop 2")
if IsModelValid(model2) == 1 then
attachProp2 = makeProp({ prop = model2, coords = vector4(0.0,0.0,0.0,0.0)}, 1, 1)
AttachEntityToEntity(attachProp2, Player, bone2, P7, P8, P9, P10, P11, P12, true, true, false, true, 1, true)
else triggerNotify(nil, "Debug: Second prop model isn't valid", "error") 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 triggerNotify(nil, "Debug: Prop model isn't valid", "error") end
end
end)
Wait((GetAnimDuration(animDict, anim) * 1000)*2)
consuming = false
stopAnim(animDict, anim)
TriggerEvent("jim-consumables:client:testEmotes")
end

View File

@@ -1,136 +1,17 @@
print("^2Jim^7-^2Consumables ^7v^41^7.^45 ^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.
-- https://discord.gg/xKgQZ6wZvS
Config = {
Debug = false,
Core = "qb-core",
Inv = "qb", -- set to "ox" if using ox_inventory
Notify = "qb", -- set to "ox" if using ox_lib
UseProgbar = false,
ProgressBar = "qb", -- set to "ox" if using ox_lib
Consumables = {
-- Default QB food and drink item override
--Effects can be applied here, like stamina on coffee for example
["vodka"] = { emote = "vodkab", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
["beer"] = { emote = "beer", canRun = false, 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", canRun = false, 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", canRun = false, 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", canRun = true, 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", canRun = true, 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", canRun = false, 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", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { effect = "stamina", time = 10000, thirst = math.random(10,20), }},
["water_bottle"] = { emote = "drink", canRun = false, 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", canRun = false, 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", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 10, armor = 0, type = "drug", stats = { effect = "heal", amount = 6, widepupils = false, canOD = false } },
["bandage"] = { emote = "oxy", time = math.random(5000, 6000), stress = 0, heal = 10, armor = 0, type = "drug", stats = { effect = "heal", amount = 3, widepupils = false, canOD = false } }, },
]]
--Testing effects & armor with small functionality to drugs - This may be another one left to default scripts
["joint"] = { emote = "smoke3", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", stats = { screen = "weed", effect = "armor", widepupils = false, canOD = false } },
["cokebaggy"] = { emote = "coke", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 0, type = "drug", stats = { screen = "focus", effect = "stamina", widepupils = false, canOD = true } },
--["crackbaggy"] = { emote = "coke", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 0, 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 = "strength", widepupils = true, canOD = true } },
["oxy"] = { emote = "oxy", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 0, 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"] = {
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
type = "food", -- Type: "alcohol" / "drink" / "food"
stats = {
screen = "thermal", -- The screen effect to be played when after consuming the item "rampage" "turbo" "focus" "weed" "trevor" "nightvision" "thermal"
effect = "heal", -- The status effect given by the item, "heal" / "stamina"
-- This supports ps-buffs effects "armor" "stress" "swimming" "hacking" "intelligence" "luck" "strength"
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
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
},
--Reward Items Variables
-- These can be the only thing in a consumable table and the item will still work
amounttogive = 3, -- Used for "RewardItems", tells the script how many to give
rewards = {
[1] = {
item = "plastic", -- prize item name
max = 10, -- max amount to give (this is put into math.random(1, max) )
rarity = 1, -- the rarity system, 1 being rarest, 4 being most common
},
},
},]]
},
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, }},
["coffee"] = {"amb@world_human_drinking@coffee@male@idle_a", "idle_c", "Coffee", AnimationOptions =
{ Prop = 'p_amb_coffeecup_01', PropBone = 28422, PropPlacement = {0.0,0.0,0.0,0.0,0.0,0.0},
EmoteLoop = true, EmoteMoving = true }},
["burger"] = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Burger", AnimationOptions =
{ Prop = 'prop_cs_burger_01', PropBone = 18905, PropPlacement = {0.13,0.05,0.02,-50.0,16.0,60.0},
EmoteMoving = true }},
["beer"] = {"amb@world_human_drinking@beer@male@idle_a", "idle_c", "Beer", AnimationOptions =
{ Prop = 'prop_amb_beer_bottle', PropBone = 28422, PropPlacement = {0.0,0.0,0.06,0.0,15.0,0.0},
EmoteLoop = true, EmoteMoving = true }},
["egobar"] = {"mp_player_inteat@burger", "mp_player_int_eat_burger","Ego Bar", AnimationOptions =
{ Prop = 'prop_choc_ego', PropBone = 60309, PropPlacement ={0.0,0.0,0.0,0.0,0.0,0.0},
EmoteMoving = true }},
["sandwich"] = {"mp_player_inteat@burger", "mp_player_int_eat_burger", "Sandwich", AnimationOptions =
{ Prop = 'prop_sandwich_01', PropBone = 18905, PropPlacement = {0.13,0.05,0.02,-50.0,16.0,60.0},
EmoteMoving = true }},
["smoke3"] = { "amb@world_human_aa_smoke@male@idle_a", "idle_b", "Smoke 3", AnimationOptions =
{ Prop = 'prop_cs_ciggy_01', PropBone = 28422, PropPlacement = {0.0,0.0,0.0,0.0,0.0,0.0},
EmoteLoop = true, EmoteMoving = true }},
["whiskey"] = { "amb@world_human_drinking@coffee@male@idle_a", "idle_c", "Whiskey", AnimationOptions =
{ Prop = 'prop_drink_whisky', PropBone = 28422, PropPlacement = {0.01,-0.01,-0.06,0.0,0.0,0.0},
EmoteLoop = true, EmoteMoving = true } },
["vodkab"] = {"mp_player_intdrink", "loop_bottle", "(Don't Use) Vodka Bottle", AnimationOptions =
{ Prop = 'prop_vodka_bottle', PropBone = 18905, PropPlacement = {0.00, -0.26, 0.10, 240.0, -60.0},
EmoteMoving = true, EmoteLoop = true }},
["ecola"] = {"mp_player_intdrink", "loop_bottle", "E-cola", AnimationOptions =
{ Prop = "prop_ecola_can", PropBone = 18905, PropPlacement = {0.12, 0.008, 0.03, 240.0, -60.0},
EmoteMoving = true, EmoteLoop = true, }},
["crisps"] = {"amb@world_human_drinking@coffee@male@idle_a", "idle_c", "Chrisps", AnimationOptions =
{ Prop = 'v_ret_ml_chips2', PropBone = 28422, PropPlacement = {0.01, -0.05, -0.1, 0.0, 0.0, 90.0},
EmoteLoop = true, EmoteMoving = true, }},
--Drugs
["coke"] = { "switch@trevor@trev_smoking_meth", "trev_smoking_meth_loop", "Coke", AnimationOptions =
{ EmoteLoop = true, EmoteMoving = true, }},
["oxy"] = { "mp_suicide", "pill", "Oxy", AnimationOptions =
{ EmoteLoop = true, EmoteMoving = true, }},
["cigar"] = {"amb@world_human_smoking@male@male_a@enter", "enter", "Cigar", AnimationOptions =
{ Prop = 'prop_cigar_02', PropBone = 47419, PropPlacement = {0.010, 0.0, 0.0, 50.0, 0.0, -80.0},
EmoteMoving = true, EmoteDuration = 2600 }},
["cigar2"] = {"amb@world_human_smoking@male@male_a@enter", "enter", "Cigar 2", AnimationOptions =
{ Prop = 'prop_cigar_01', PropBone = 47419, PropPlacement = {0.010, 0.0, 0.0, 50.0, 0.0, -80.0},
EmoteMoving = true, EmoteDuration = 2600 }},
["joint"] = {"amb@world_human_smoking@male@male_a@enter", "enter", "Joint", AnimationOptions =
{ Prop = 'p_cs_joint_02', PropBone = 47419, PropPlacement = {0.015, -0.009, 0.003, 55.0, 0.0, 110.0},
EmoteMoving = true, EmoteDuration = 2600 }},
["cig"] = {"amb@world_human_smoking@male@male_a@enter", "enter", "Cig", AnimationOptions =
{ Prop = 'prop_amb_ciggy_01', PropBone = 47419, PropPlacement = {0.015, -0.009, 0.003, 55.0, 0.0, 110.0},
EmoteMoving = true, EmoteDuration = 2600 }},
},
}
Config = {
System = {
Debug = false,
EventDebug = false,
Notify = "qb",
Menu = "qb",
ProgressBar = "qb",
drawText = "gta",
},
Main = {
UseProgbar = false, -- Disabled this, progress bars stop all anims when complete.
},
Crafting = {
showItemBox = true
}
}

View File

@@ -1,11 +1,36 @@
name "Jim-Consumables"
author "Jimathy"
version "1.5"
description "Consumable Script By Jimathy"
version "2.0"
description "Consumables Script"
fx_version "cerulean"
game "gta5"
lua54 'yes'
shared_scripts { 'config.lua', 'shared/*.lua' }
client_scripts { 'client/*.lua', }
server_scripts { 'server/*.lua' }
server_script '@oxmysql/lib/MySQL.lua'
shared_scripts {
'config.lua',
'shared/emotes.lua',
'shared/consumables.lua',
'shared/shared.lua',
-- Required core scripts
'@ox_lib/init.lua',
'@ox_core/lib/init.lua',
'@es_extended/imports.lua',
'@qbx_core/modules/playerdata.lua',
--Jim Bridge
'@jim_bridge/starter.lua',
}
client_scripts {
--'@warmenu/warmenu.lua',
'client/*.lua',
}
server_script 'server/*.lua'
dependency 'jim_bridge'

View File

@@ -1,51 +1,14 @@
local QBCore = exports[Config.Core]:GetCoreObject()
local Consumables = Config.Consumables
local Emotes = Config.Emotes
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("^1Debug^7: ^2Item check ^7- '^1"..k.."^7' ^2not found in the shared lua^7") end
createUseableItem(k, function(source, item) TriggerClientEvent(getScript()..':Consume', source, item.name) end)
if not Items[k] then print("^1Debug^7: ^2Item check ^7- '^1"..k.."^7' ^2not found in the shared lua^7") end
if not Config.Emotes[v.emote] then print("^1Debug^7: ^2Emote check ^7- '^1"..k.."^7' ^2requested emote ^7'^6"..v.emote.."^7' - ^2not found in config^7.^2lua^7") end
end
RegisterNetEvent("jim-consumables:server:DupeWarn", function(item, newsrc)
local src = newsrc or source
local P = QBCore.Functions.GetPlayer(src)
print("^5DupeWarn: ^1"..P.PlayerData.charinfo.firstname.." "..P.PlayerData.charinfo.lastname.."^7(^1"..tostring(src).."^7) ^2Tried to remove item ^7('^3"..item.."^7')^2 but it wasn't there^7")
if not Config.Debug then DropPlayer(src, "Kicked for attempting to duplicate items") end
print("^5DupeWarn: ^1"..P.PlayerData.charinfo.firstname.." "..P.PlayerData.charinfo.lastname.."^7(^1"..tostring(src).."^7) ^2Dropped from server for item duplicating^7")
end)
RegisterNetEvent('jim-consumables:server:toggleItem', function(give, item, amount, newsrc)
local src = newsrc or source
local amount = amount or 1
local remamount = amount
if not give then
if HasItem(src, item, amount) then -- check if you still have the item
if QBCore.Functions.GetPlayer(src).Functions.GetItemByName(item).unique then -- If unique item, keep removing until gone
while remamount > 0 do
QBCore.Functions.GetPlayer(src).Functions.RemoveItem(item, 1)
remamount -= 1
end
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove", amount) -- Show removal item box when all are removed
return
end
if QBCore.Functions.GetPlayer(src).Functions.RemoveItem(item, amount) then
if Config.Debug then print("^5Debug^7: ^1Removing ^2from Player^7(^2"..src.."^7) '^6"..QBCore.Shared.Items[item].label.."^7(^2x^6"..(amount or "1").."^7)'") end
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove", amount)
end
else TriggerEvent("jim-consumables:server:DupeWarn", item, src) end -- if not boot the player
elseif give then
if QBCore.Functions.GetPlayer(src).Functions.AddItem(item, amount) then
if Config.Debug then print("^5Debug^7: ^4Giving ^2Player^7(^2"..src.."^7) '^6"..QBCore.Shared.Items[item].label.."^7(^2x^6"..(amount or "1").."^7)'") end
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "add", amount)
end
end
end)
RegisterNetEvent('jim-consumables:server:addNeed', function(amount, type)
local Player = QBCore.Functions.GetPlayer(source) if not Player then return end
RegisterNetEvent(getScript()..':server:addNeed', function(amount, type)
local Player = Core.Functions.GetPlayer(source) if not Player then return end
if type == "thirst" then
Player.Functions.SetMetaData('thirst', amount)
TriggerClientEvent('hud:client:UpdateNeeds', source, Player.PlayerData.metadata.hunger, amount)
@@ -55,60 +18,61 @@ RegisterNetEvent('jim-consumables:server:addNeed', function(amount, type)
end
end)
if Config.Inv == "ox" then
function HasItem(src, items, amount)
local count = exports.ox_inventory:Search(src, 'count', items)
if exports.ox_inventory:Search(src, 'count', items) >= (amount or 1) then if Config.Debug then print("^5Debug^7: ^3HasItem^7: ^5FOUND^7 x^3"..count.."^7 ^3"..tostring(items)) end return true
else if Config.Debug then print("^5Debug^7: ^3HasItem^7: ^2Items ^1NOT FOUND^7") end return false end
end
else
function HasItem(source, items, amount)
local amount, count = amount or 1, 0
local Player = QBCore.Functions.GetPlayer(source)
if Config.Debug then print("^5Debug^7: ^3HasItem^7: ^2Checking if player has required item^7 '^3"..tostring(items).."^7'") end
for _, itemData in pairs(Player.PlayerData.items) do
if itemData and (itemData.name == items) then
if Config.Debug then print("^5Debug^7: ^3HasItem^7: ^2Item^7: '^3"..tostring(items).."^7' ^2Slot^7: ^3"..itemData.slot.." ^7x(^3"..tostring(itemData.amount).."^7)") end
count += itemData.amount
end
end
if count >= amount then if Config.Debug then print("^5Debug^7: ^3HasItem^7: ^2Items ^5FOUND^7 x^3"..count.."^7") end return true end
if Config.Debug then print("^5Debug^7: ^3HasItem^7: ^2Items ^1NOT FOUND^7") end return false
end
end
--Export Import System--
QBCore.Functions.CreateCallback('jim-consumables:server:syncConsumables', function(source, cb) cb(Consumables) end)
QBCore.Functions.CreateCallback('jim-consumables:server:syncEmotes', function(source, cb) cb(Emotes) end)
createCallback(getScript()..':server:syncConsumables', function(source) return Consumables end)
createCallback(getScript()..':server:syncEmotes', function(source) return Emotes end)
RegisterNetEvent('jim-consumables:server:syncAddItem', function(itemName, data)
if not Consumables[itemName] then
QBCore.Functions.CreateUseableItem(itemName, function(source, item) TriggerClientEvent('jim-consumables:Consume', source, itemName) end)
if Config.Debug then print("^5Debug^7: ^2Adding new ^3Item^7: '^6"..itemName.."^7'") end
Consumables[itemName] = data
TriggerClientEvent("jim-consumables:client:syncConsumables", -1, Consumables)
end
end)
RegisterNetEvent('jim-consumables:server:syncAddEmote', function(emoteName, data)
if not Emotes[emoteName] then
if Config.Debug then print("^5Debug^7: ^2Adding new ^3Emote^7: '^6"..emoteName.."^7'") end
Emotes[emoteName] = data
TriggerClientEvent("jim-consumables:client:syncEmotes", -1, Emotes)
end
end)
RegisterNetEvent("jim-consumables:server:syncConsumables", function() TriggerClientEvent('jim-consumables:client:syncConsumables', -1, Consumables) end)
RegisterNetEvent("jim-consumables:server:syncEmotes", function() TriggerClientEvent('jim-consumables:client:syncEmotes', -1, Emotes) end)
local function CheckVersion()
PerformHttpRequest('https://raw.githubusercontent.com/jimathy/jim-consumables/master/version.txt', function(err, newestVersion, headers)
local currentVersion = GetResourceMetadata(GetCurrentResourceName(), 'version')
if not newestVersion then print("Currently unable to run a version check.") return end
local advice = "^1You are currently running an outdated version^7, ^1please update^7"
if newestVersion:gsub("%s+", "") == currentVersion:gsub("%s+", "") then advice = '^6You are running the latest version.^7'
else print("^3Version Check^7: ^2Current^7: "..currentVersion.." ^2Latest^7: "..newestVersion) end
print(advice)
end)
local syncScheduled = false
function syncConsumables()
if Config.System.Debug then print("^5Debug^7: ^2Sending ^6"..countTable(Consumables).." ^3Consumables ^2to all clients^7") end
TriggerClientEvent(getScript()..":client:syncConsumables", -1, Consumables)
syncScheduled = false
end
CheckVersion()
local emoteSyncScheduled = false
function syncEmotes()
if Config.System.Debug then print("^5Debug^7: ^2Sending ^6"..countTable(Emotes).." ^3Emotes to all clients^7") end
TriggerClientEvent(getScript()..":client:syncEmotes", -1, Emotes)
emoteSyncScheduled = false
end
RegisterNetEvent(getScript()..':server:syncAddItem', function(itemName, data)
if not Consumables[itemName] then
Consumables[itemName] = data
createUseableItem(itemName, function(source, item) TriggerClientEvent(getScript()..':Consume', source, itemName) end)
if Config.System.Debug then print("^5Debug^7: "..GetInvokingResource().." ^2is sending new ^3Item^7: '"..itemName.."'") end
if not syncScheduled then
syncScheduled = true
Citizen.SetTimeout(5000, syncConsumables)
end
else
if Config.System.Debug then print("^1Debug^7: "..GetInvokingResource().." ^2is sending ^1duplicate ^3Item^7: '"..itemName.."'") end
end
end)
RegisterNetEvent(getScript()..':server:syncAddEmote', function(emoteName, data)
if not Emotes[emoteName] then
Emotes[emoteName] = data
if Config.System.Debug then print("^5Debug^7: "..GetInvokingResource().." ^2is sending new ^3Emote^7: '"..emoteName.."'") end
if not emoteSyncScheduled then
emoteSyncScheduled = true
Citizen.SetTimeout(5000, syncEmotes)
end
else
if Config.System.Debug then print("^1Debug^7: "..GetInvokingResource().." ^2is sending ^1duplicate ^3Emote^7: '"..emoteName.."'") end
end
end)
RegisterNetEvent(getScript()..":server:syncConsumables", function()
TriggerClientEvent(getScript()..':client:syncConsumables', -1, Consumables)
end)
RegisterNetEvent(getScript()..":server:syncEmotes", function()
TriggerClientEvent(getScript()..':client:syncEmotes', -1, Emotes)
end)
Core.Commands.Add('consumableCreator', "Create consumables (admin only)", {}, false, function(source)
if source > 0 then return TriggerClientEvent(getScript()..":client:consumableCreator", source) end
end, 'admin')
Core.Commands.Add('testConsumableEmotes', "Test consumables Emotes (admin only)", {}, false, function(source)
if source > 0 then return TriggerClientEvent(getScript()..":client:testEmotes", source) end
end, 'admin')

140
shared/consumables.lua Normal file
View File

@@ -0,0 +1,140 @@
Config = Config or {}
Config.Consumables = {
redwood_cigarette = { emote = "smoke2", canRun = false, time = 11000, stress = math.random(10, 15), heal = 0, armor = 0, type = "smoke", requiredItem = "lighter", stats = { effect = "stress", time = 5000, amount = math.random(10, 15), canOD = false } },
debonaire_cigarette = { emote = "smoke2", canRun = false, time = 11000, stress = math.random(10, 15), heal = 0, armor = 0, type = "smoke", requiredItem = "lighter", stats = { effect = "stress", time = 5000, amount = math.random(10, 15), canOD = false } },
estancia_cigar = { emote = "smokecigar", canRun = false, time = 11000, stress = math.random(10, 15), heal = 0, armor = 0, type = "smoke", requiredItem = "lighter", stats = { effect = "stress", time = 5000, amount = math.random(10, 15), canOD = false } },
olivaseriev = { emote = "smokecigar", canRun = false, time = 11000, stress = math.random(10, 15), heal = 0, armor = 0, type = "smoke", requiredItem = "lighter", stats = { effect = "stress", time = 5000, amount = math.random(10, 15), canOD = false } },
montecristo = { emote = "smokecigar", canRun = false, time = 11000, stress = math.random(10, 15), heal = 0, armor = 0, type = "smoke", requiredItem = "lighter", stats = { effect = "stress", time = 5000, amount = math.random(10, 15), canOD = false } },
partagas = { emote = "smokecigar", canRun = false, time = 11000, stress = math.random(10, 15), heal = 0, armor = 0, type = "smoke", requiredItem = "lighter", stats = { effect = "stress", time = 5000, amount = math.random(10, 15), canOD = false } },
hoyodemonterrey = { emote = "smokecigar", canRun = false, time = 11000, stress = math.random(10, 15), heal = 0, armor = 0, type = "smoke", requiredItem = "lighter", stats = { effect = "stress", time = 5000, amount = math.random(10, 15), canOD = false } },
arturofuente = { emote = "smokecigar", canRun = false, time = 11000, stress = 0, heal = 10, armor = 10, type = "smoke", requiredItem = "lighter", stats = { effect = "stress", time = 5000, amount = 0, canOD = false } },
cohiba = { emote = "smokecigar", canRun = false, time = 11000, stress = 0, heal = 0, armor = 10, type = "smoke", requiredItem = "lighter", stats = { effect = "stress", time = 5000, amount = 0, canOD = false } },
romeoyjulieta = { emote = "smokecigar", canRun = false, time = 11000, stress = 0, heal = 10, armor = 0, type = "smoke", requiredItem = "lighter", stats = { effect = "stress", time = 5000, amount = 0, canOD = false } },
dusche = { emote = "beer", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
vodka = { emote = "vodkab", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
cherenkov1 = { emote = "cherenkov1", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
cherenkov2 = { emote = "cherenkov2", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
cherenkov3 = { emote = "cherenkov3", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
cherenkov4 = { emote = "cherenkov4", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
bleuterdchampagne = { emote = "bleuturd", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
bourgeoixcognac = { emote = "bourgeoix", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
cardiaquecognac = { emote = "cardiaque", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
red_wine = { emote = "wine", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
white_wine = { emote = "wine", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
raggaerum = { emote = "raggae", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "alcohol", stats = { effect = "stress", time = 5000, amount = 2, thirst = math.random(10,20), canOD = true }},
beer = { emote = "beer", canRun = false, 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", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "alcohol", stats = { thirst = math.random(10,20), canOD = true }},
godfather = { emote = "whiskey", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "alcohol", stats = { thirst = math.random(10,20), canOD = true }},
godmother = { emote = "whiskey", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "alcohol", stats = { thirst = math.random(10,20), canOD = true }},
oldfashion = { emote = "whiskey", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "alcohol", stats = { thirst = math.random(10,20), canOD = true }},
nightfall_negroni = { emote = "whiskey", canRun = false, 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", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = 20, }},
butter = { emote = "sandwich", canRun = false, time = math.random(5000, 6000), stress = math.random(5, 10), heal = 0, armor = 0, type = "food", stats = { hunger = 20, }},
bar_nuts = { emote = "sandwich", canRun = false, time = math.random(5000, 6000), stress = math.random(5, 10), heal = 0, armor = 0, type = "food", stats = { hunger = 20, }},
slim_johns = { emote = "sandwich", canRun = false, time = math.random(5000, 6000), stress = math.random(5, 10), heal = 0, armor = 0, type = "food", stats = { hunger = 20, }},
twerks_candy = { emote = "egobar", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,15), }},
snikkel_candy = { emote = "egobar", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,15), }},
meteoritebar = { emote = "egobar", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,15), }},
zebrabar = { emote = "egobar", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,15), }},
egochaser = { emote = "egobar", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,15), }},
psandqs = { emote = "egobar", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,15), }},
lollipop_blue = { emote = "egobar", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,15), }},
lollipop_yellow = { emote = "egobar", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,15), }},
lollipop_pink = { emote = "egobar", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,15), }},
coffee = { emote = "coffee", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "drink", stats = { time = 10000, thirst = math.random(10,15), }},
watermelon_slices = { emote = "orange", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(25,35), }, },
pineapple_slices = { emote = "orange", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(25,35), }, },
applejuice = { emote = "drink", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(15,20),}, },
orangejuice = { emote = "drink", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(15,20), }, },
peachjuice = { emote = "drink", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(15,20), }, },
-- prisonslushie = { emote = "drink", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(15,20), }, },
water_bottle = { emote = "drink", canRun = false, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "drink", stats = { thirst = 20, }},
tosti = { emote = "sandwich", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(10,15), }},
apple = { emote = "apple", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(5,10), }},
mkecola = { emote = "ecola", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(15,20), }},
mkecolalight = { emote = "ecola", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(15,20), }},
mksprunk = { emote = "sprunk", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(15,20), }},
mksprunklight = { emote = "sprunk", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(15,20), }},
munchables_pizza = { emote = "sandwich", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = 20, }},
milk = { emote = "milk", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(10,15), }},
chocolate_milk = { emote = "milk", canRun = false, time = math.random(5000, 6000), stress = math.random(4, 6), heal = 0, armor = 0, type = "drink", stats = { thirst = math.random(10,16), }},
banana = { emote = "banana", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(5,10), }},
avacado = { emote = "avacado", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(5,10), }},
orange = { emote = "orange", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(5,10), }},
carrot = { emote = "carrot", canRun = true, time = math.random(5000, 6000), stress = 0, heal = 0, armor = 0, type = "food", stats = { hunger = math.random(5,10), }},
-- Cigarette Packs
redwood_pack = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "redwood_cigarette", amount = 20 }, },
debonaire_pack = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "debonaire_cigarette", amount = 20 }, },
estancia_pack = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "estancia_cigar", amount = 5 }, },
-- Cigarette Cartons
redwood_carton = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "redwood_pack", amount = 10 }, },
debonaire_carton = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "debonaire_pack", amount = 10 }, },
estancia_carton = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "estancia_pack", amount = 10 }, },
foodration = { emote = "egobar", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(15,20), }, },
mre = { emote = "hotdog", canRun = false, time = math.random(5000, 6000), stress = math.random(2, 4), heal = 0, armor = 0, type = "food", stats = { hunger = math.random(25,35), }, },
-- Ammo boxes
["9_box"] = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "9_ammo", amount = 20 }, },
["12_box"] = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "12_ammo", amount = 10 }, },
["380_box"] = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "380_ammo", amount = 20 }, },
["38_box"] = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "38_ammo", amount = 20 }, },
["308_box"] = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "308_ammo", amount = 20 }, },
["357_box"] = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "357_ammo", amount = 20 }, },
["45_box"] = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "45_ammo", amount = 20 }, },
["545_box"] = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "545_ammo", amount = 20 }, },
["556_box"] = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "556_ammo", amount = 20 }, },
["762_box"] = { emote = "uncuff", canRun = true, time = 3500, type = "pack", pack = { item = "762_ammo", amount = 20 }, },
--[[ --Testing effects & armor with small functionality to drugs - This may be another one left to default scripts
joint = { emote = "smoke3", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 10, type = "drug", stats = { screen = "weed", effect = "armor", widepupils = false, canOD = false } },
cokebaggy = { emote = "coke", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 0, type = "drug", stats = { screen = "focus", effect = "stamina", widepupils = false, canOD = true } },
--crackbaggy = { emote = "coke", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 0, 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 = "strength", widepupils = true, canOD = true } },
oxy = { emote = "oxy", time = math.random(5000, 6000), stress = math.random(12, 24), heal = 0, armor = 0, 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 = {
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
type = "food", -- Type: "alcohol" / "drink" / "food"
stats = {
screen = "thermal", -- The screen effect to be played when after consuming the item "rampage" "turbo" "focus" "weed" "trevor" "nightvision" "thermal"
effect = "heal", -- The status effect given by the item, "heal" / "stamina"
-- This supports ps-buffs effects "armor" "stress" "swimming" "hacking" "intelligence" "luck" "strength"
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
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
},
--Reward Items Variables
-- These can be the only thing in a consumable table and the item will still work
amounttogive = 3, -- Used for "RewardItems", tells the script how many to give
rewards = {
[1] = {
item = "plastic", -- prize item name
max = 10, -- max amount to give (this is put into math.random(1, max) )
rarity = 1, -- the rarity system, 1 being rarest, 4 being most common
},
},
},]]
}

89
shared/emotes.lua Normal file
View File

@@ -0,0 +1,89 @@
Config = Config or {}
Config.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, }},
milk = {"mp_player_intdrink", "loop_bottle", "Glass of milk", AnimationOptions = { Prop = 'bzzz_farmprops_milk_a', PropBone = 18905, PropPlacement = {-0.02, -0.04, 0.1, 34.0, 140.0, 224.0}, EmoteLoop = true, EmoteMoving = true, }},
coffee = {"amb@world_human_drinking@coffee@male@idle_a", "idle_c", "Coffee", AnimationOptions = { Prop = 'p_amb_coffeecup_01', PropBone = 28422, PropPlacement = {0.0,0.0,0.0,0.0,0.0,0.0}, EmoteLoop = true, EmoteMoving = true }},
burger = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Burger", AnimationOptions = { Prop = 'prop_cs_burger_01', PropBone = 18905, PropPlacement = {0.13,0.05,0.02,-50.0,16.0,60.0}, EmoteMoving = true }},
beer = {"amb@world_human_drinking@beer@male@idle_a", "idle_c", "Beer", AnimationOptions = { Prop = 'prop_amb_beer_bottle', PropBone = 28422, PropPlacement = {0.0,0.0,0.06,0.0,15.0,0.0}, EmoteLoop = true, EmoteMoving = true }},
egobar = {"mp_player_inteat@burger", "mp_player_int_eat_burger","Ego Bar", AnimationOptions = { Prop = 'prop_choc_ego', PropBone = 60309, PropPlacement = {0.0,0.0,0.0,0.0,0.0,0.0}, EmoteMoving = true }},
sandwich = {"mp_player_inteat@burger", "mp_player_int_eat_burger", "Sandwich", AnimationOptions = { Prop = 'prop_sandwich_01', PropBone = 18905, PropPlacement = {0.13,0.05,0.02,-50.0,16.0,60.0}, EmoteMoving = true }},
apple = {"mp_player_inteat@burger", "mp_player_int_eat_burger", "Apple", AnimationOptions = { Prop = 'idrp_apple_solo', PropBone = 18905, PropPlacement = {0.13,0.05,0.02,-50.0,16.0,60.0}, EmoteMoving = true }},
avacado = {"mp_player_inteat@burger", "mp_player_int_eat_burger", "Avacado", AnimationOptions = { Prop = 'idrp_avo_solo', PropBone = 18905, PropPlacement = {0.13,0.05,0.02,-50.0,16.0,60.0}, EmoteMoving = true }},
banana = {"mp_player_inteat@burger", "mp_player_int_eat_burger", "Banana", AnimationOptions = { Prop = 'idrp_bana_solo', PropBone = 18905, PropPlacement = {0.13,0.05,0.02,-50.0,16.0,60.0}, EmoteMoving = true }},
carrot = {"mp_player_inteat@burger", "mp_player_int_eat_burger", "Carrot", AnimationOptions = { Prop = 'idrp_carrot_single', PropBone = 18905, PropPlacement = {0.13,0.05,0.02,-50.0,16.0,60.0}, EmoteMoving = true }},
orange = {"mp_player_inteat@burger", "mp_player_int_eat_burger", "Orange", AnimationOptions = { Prop = 'idrp_bana_solo', PropBone = 18905, PropPlacement = {0.13,0.05,0.02,-50.0,16.0,60.0}, EmoteMoving = true }},
smoke3 = { "amb@world_human_aa_smoke@male@idle_a", "idle_b", "Smoke 3", AnimationOptions = { Prop = 'prop_cs_ciggy_01', PropBone = 28422, PropPlacement = {0.0,0.0,0.0,0.0,0.0,0.0}, EmoteLoop = true, EmoteMoving = true }},
whiskey = { "amb@world_human_drinking@coffee@male@idle_a", "idle_c", "Whiskey", AnimationOptions = { Prop = 'prop_drink_whisky', PropBone = 28422, PropPlacement = {0.01,-0.01,-0.06,0.0,0.0,0.0}, EmoteLoop = true, EmoteMoving = true } },
vodkab = {"mp_player_intdrink", "loop_bottle", "(Don't Use) Vodka Bottle", AnimationOptions = { Prop = 'prop_vodka_bottle', PropBone = 18905, PropPlacement = {0.00, -0.26, 0.10, 240.0, -60.0}, EmoteMoving = true, EmoteLoop = true }},
cherenkov1 = {"mp_player_intdrink", "loop_bottle", "(Don't Use) Vodka Bottle", AnimationOptions = { Prop = 'prop_cherenkov_01', PropBone = 18905, PropPlacement = {0.00, -0.26, 0.10, 240.0, -60.0}, EmoteMoving = true, EmoteLoop = true }},
cherenkov2 = {"mp_player_intdrink", "loop_bottle", "(Don't Use) Vodka Bottle", AnimationOptions = { Prop = 'prop_cherenkov_04', PropBone = 18905, PropPlacement = {0.00, -0.26, 0.10, 240.0, -60.0}, EmoteMoving = true, EmoteLoop = true }},
cherenkov3 = {"mp_player_intdrink", "loop_bottle", "(Don't Use) Vodka Bottle", AnimationOptions = { Prop = 'prop_cherenkov_03', PropBone = 18905, PropPlacement = {0.00, -0.26, 0.10, 240.0, -60.0}, EmoteMoving = true, EmoteLoop = true }},
cherenkov4 = {"mp_player_intdrink", "loop_bottle", "(Don't Use) Vodka Bottle", AnimationOptions = { Prop = 'prop_cherenkov_02', PropBone = 18905, PropPlacement = {0.00, -0.26, 0.10, 240.0, -60.0}, EmoteMoving = true, EmoteLoop = true }},
bleuturd = {"mp_player_intdrink", "loop_bottle", "(Don't Use) Vodka Bottle", AnimationOptions = { Prop = 'prop_champ_01b', PropBone = 18905, PropPlacement = {0.00, -0.26, 0.10, 240.0, -60.0}, EmoteMoving = true, EmoteLoop = true }},
bourgeoix = {"mp_player_intdrink", "loop_bottle", "(Don't Use) Vodka Bottle", AnimationOptions = { Prop = 'prop_bottle_cognac', PropBone = 18905, PropPlacement = {0.00, -0.26, 0.10, 240.0, -60.0}, EmoteMoving = true, EmoteLoop = true }},
cardiaque = {"mp_player_intdrink", "loop_bottle", "(Don't Use) Vodka Bottle", AnimationOptions = { Prop = 'prop_bottle_brandy', PropBone = 18905, PropPlacement = {0.00, -0.26, 0.10, 240.0, -60.0}, EmoteMoving = true, EmoteLoop = true }},
raggae = {"mp_player_intdrink", "loop_bottle", "(Don't Use) Vodka Bottle", AnimationOptions = { Prop = 'prop_rum_bottle', PropBone = 18905, PropPlacement = {0.00, -0.26, 0.10, 240.0, -60.0}, EmoteMoving = true, EmoteLoop = true }},
ecola = {"mp_player_intdrink", "loop_bottle", "E-cola", AnimationOptions = { Prop = "prop_ecola_can", PropBone = 18905, PropPlacement = {0.12, 0.008, 0.03, 240.0, -60.0}, EmoteMoving = true, EmoteLoop = true, }},
crisps = {"amb@world_human_drinking@coffee@male@idle_a", "idle_c", "Chrisps", AnimationOptions = { Prop = 'v_ret_ml_chips2', PropBone = 28422, PropPlacement = {0.01, -0.05, -0.1, 0.0, 0.0, 90.0}, EmoteLoop = true, EmoteMoving = true, }},
sprunk = {"mp_player_intdrink", "loop_bottle", "Sprunk", AnimationOptions = { Prop = "v_res_tt_can03", PropBone = 18905, PropPlacement = {0.12, 0.008, 0.03, 240.0, -60.0}, EmoteMoving = true, EmoteLoop = true, }},
wine = { "anim@heists@humane_labs@finale@keycards", "ped_a_enter_loop", "Wine", AnimationOptions = { Prop = 'prop_drink_redwine', PropBone = 18905, PropPlacement = {0.10, -0.03, 0.03, -100.0, 0.0, -10.0}, EmoteMoving = true, EmoteLoop = true }},
champagne = { "anim@heists@humane_labs@finale@keycards", "ped_a_enter_loop", "Champagne", AnimationOptions = { Prop = 'prop_drink_champ', PropBone = 18905, PropPlacement = { 0.10, -0.03, 0.03, -100.0, 0.0, -10.0 }, EmoteMoving = true, EmoteLoop = true }},
croissant = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Croissant", AnimationOptions = { Prop = 'bzzz_foodpack_croissant001', PropBone = 60309, PropPlacement = { 0.00, 0.0, -0.01, 0.0, 0.0, 90.0 }, EmoteMoving = true }},
cup = { "amb@world_human_drinking@coffee@male@idle_a", "idle_c", "Cup", AnimationOptions = { Prop = 'prop_plastic_cup_02', PropBone = 28422, PropPlacement = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, EmoteLoop = true, EmoteMoving = true }},
desert = { "mp_player_inteat@burger", "mp_player_int_eat_burger","Eat dessert", AnimationOptions = { Prop = 'bzzz_food_dessert_a', PropBone = 18905, PropPlacement = { 0.15, 0.03, 0.03, -42.0, -36.0, 0.0 }, EmoteMoving = true}},
dinner = { "anim@scripted@island@special_peds@pavel@hs4_pavel_ig5_caviar_p1", "base_idle", "Dinner", AnimationOptions = { Prop = "prop_cs_plate_01", PropBone = 60309, PropPlacement = { 0.0, 0.0, 0.0, 0.0, 0.0 }, SecondProp = 'h4_prop_h4_caviar_spoon_01a', SecondPropBone = 28422, SecondPropPlacement = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, EmoteLoop = true, EmoteMoving = true }},
flute = { "anim@heists@humane_labs@finale@keycards", "ped_a_enter_loop", "Flute", AnimationOptions = { Prop = 'prop_champ_flute', PropBone = 18905, PropPlacement = { 0.10, -0.03, 0.03, -100.0, 0.0, -10.0 }, EmoteMoving = true, EmoteLoop = true }},
frappe = { "amb@code_human_wander_drinking@male@base", "static", "Frappe", AnimationOptions = { Prop = 'brum_heartfrappe', PropBone = 28422, PropPlacement = { 0.0, -0.0150, -0.0100, 0.0, -3.9999, 0.0 }, EmoteLoop = true, EmoteMoving = true }},
frappe2 = { "amb@code_human_wander_drinking@female@base", "static", "Frappe 2", AnimationOptions = { Prop = 'beanmachine_cup', PropBone = 28422, PropPlacement = { 0.0110, 0.0, 0.0300, 0.0, 0.0, -140.0 }, EmoteLoop = true, EmoteMoving = true }},
frappe3 = { "amb@code_human_wander_drinking@female@base", "static", "Frappe 3", AnimationOptions = { Prop = 'beanmachine_cup2', PropBone = 28422, PropPlacement = { 0.0, 0.0, -0.0600, 0.0, 0.0, -178.0 }, EmoteLoop = true, EmoteMoving = true }},
frappe4 = { "amb@code_human_wander_drinking@female@base", "static", "Frappe 4", AnimationOptions = { Prop = 'beanmachine_cup3', PropBone = 28422, PropPlacement = { 0.0, 0.0, -0.0600, 0.0, 0.0, -178.0 }, EmoteLoop = true, EmoteMoving = true }},
hotdog = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Hotdog", AnimationOptions = { Prop = 'prop_cs_hotdog_02', PropBone = 60309, PropPlacement = { -0.0300, 0.0100, -0.0100, 95.1071, 94.7001, -66.9179 }, EmoteMoving = true }},
icecreama = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Ice cream Cherry", AnimationOptions = { Prop = 'bzzz_icecream_cherry', PropBone = 18905, PropPlacement = { 0.14, 0.03, 0.01, 85.0, 70.0, -203.0 }, EmoteMoving = true }},
icecreamb = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Ice cream Chocolate", AnimationOptions = { Prop = 'bzzz_icecream_chocolate', PropBone = 18905, PropPlacement = { 0.14, 0.03, 0.01, 85.0, 70.0, -203.0 }, EmoteMoving = true }},
icecreamc = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Ice cream Lemon", AnimationOptions = { Prop = 'bzzz_icecream_lemon', PropBone = 18905, PropPlacement = { 0.14, 0.03, 0.01, 85.0, 70.0, -203.0 }, EmoteMoving = true }},
icecreamd = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Ice cream Pistachio", AnimationOptions = { Prop = 'bzzz_icecream_pistachio', PropBone = 18905, PropPlacement = { 0.14, 0.03, 0.01, 85.0, 70.0, -203.0 }, EmoteMoving = true }},
icecreame = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Ice cream Raspberry", AnimationOptions = { Prop = 'bzzz_icecream_raspberry', PropBone = 18905, PropPlacement = { 0.14, 0.03, 0.01, 85.0, 70.0, -203.0 }, EmoteMoving = true }},
icecreamf = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Ice cream Stracciatella", AnimationOptions = { Prop = 'bzzz_icecream_stracciatella', PropBone = 18905, PropPlacement = { 0.14, 0.03, 0.01, 85.0, 70.0, -203.0 }, EmoteMoving = true }},
icecreamg = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Ice cream Strawberry", AnimationOptions = { Prop = 'bzzz_icecream_strawberry', PropBone = 18905, PropPlacement = { 0.14, 0.03, 0.01, 85.0, 70.0, -203.0 }, EmoteMoving = true }},
icecreamh = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Ice cream Walnut", AnimationOptions = { Prop = 'bzzz_icecream_walnut', PropBone = 18905, PropPlacement = { 0.14, 0.03, 0.01, 85.0, 70.0, -203.0 }, EmoteMoving = true }},
macaroon = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Macaroon", AnimationOptions = { Prop = 'bzzz_food_xmas_macaroon_a', PropBone = 18905, PropPlacement = { 0.15, 0.07, 0.00, 38.0, 7.0, 7.0 }, EmoteMoving = true }},
sipshake = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Bubblegum", AnimationOptions = { Prop = 'brum_cherryshake_raspberry', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
sipshakeb = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Cherry", AnimationOptions = { Prop = 'brum_cherryshake_cherry', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
sipshakec = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Chocolate", AnimationOptions = { Prop = 'brum_cherryshake_chocolate', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
sipshaked = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Coffee", AnimationOptions = { Prop = 'brum_cherryshake_coffee', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
sipshakee = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Double Chocolate", AnimationOptions = { Prop = 'brum_cherryshake_doublechocolate', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
sipshakef = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Frappe", AnimationOptions = { Prop = 'brum_cherryshake_frappe', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
sipshakeg = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Lemon", AnimationOptions = { Prop = 'brum_cherryshake_lemon', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
sipshakeh = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Mint", AnimationOptions = { Prop = 'brum_cherryshake_mint', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
sipshakei = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Strawberry", AnimationOptions = { Prop = 'brum_cherryshake_strawberry', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
sipshakej = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Raspberry", AnimationOptions = { Prop = 'brum_cherryshake_raspberry', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
sipshakek = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Salted", AnimationOptions = { Prop = 'brum_cherryshake_salted', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
sipshakel = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Milkshake - Vanilla", AnimationOptions = { Prop = 'brum_cherryshake_vanilla', PropBone = 28422, PropPlacement = { 0.0850, 0.0670, -0.0350, -115.0862, -165.7841, 24.1318 }, EmoteLoop = true, EmoteMoving = true }},
pizzaslice = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Pizza Slice - Jalapeño And Peperoni", AnimationOptions = { Prop = 'knjgh_pizzaslice1', PropBone = 60309, PropPlacement = { 0.0500, -0.0200, -0.0200, 73.6928, -66.7427, 68.3677 }, EmoteMoving = true }},
pizzas = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Pizza Slice - Jalapeño And Peperoni", AnimationOptions = { Prop = 'knjgh_pizzaslice1', PropBone = 60309, PropPlacement = { 0.0500, -0.0200, -0.0200, 73.6928, -66.7427, 68.3677 }, EmoteMoving = true }},
pizzas2 = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Pizza Slice - Tomato And Pesto", AnimationOptions = { Prop = 'knjgh_pizzaslice2', PropBone = 60309, PropPlacement = { 0.0500, -0.0200, -0.0200, 73.6928, -66.7427, 68.3677 }, EmoteMoving = true }},
pizzas3 = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Pizza Slice - Mushroom", AnimationOptions = { Prop = 'knjgh_pizzaslice3', PropBone = 60309, PropPlacement = { 0.0500, -0.0200, -0.0200, 73.6928, -66.7427, 68.3677 }, EmoteMoving = true }},
pizzas4 = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Pizza Slice - Margherita", AnimationOptions = { Prop = 'knjgh_pizzaslice4', PropBone = 60309, PropPlacement = { 0.0500, -0.0200, -0.0200, 73.6928, -66.7427, 68.3677 }, EmoteMoving = true }},
pizzas5 = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Pizza Slice - Double Peperoni", AnimationOptions = { Prop = 'knjgh_pizzaslice5', PropBone = 60309, PropPlacement = { 0.0500, -0.0200, -0.0200, 73.6928, -66.7427, 68.3677 }, EmoteMoving = true }},
popcorn = { "amb@code_human_wander_drinking@female@base", "static", "Popcorn", AnimationOptions = { Prop = 'prop_taymckenzienz_popcorn', PropBone = 28422, PropPlacement = { -0.0200, -0.0100, -0.0700, -179.3626, 176.9331, 11.9833 }, EmoteLoop = true, EmoteMoving = true }},
sipsoda = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Soda Cup - Sprunk", AnimationOptions = { Prop = 'prop_rpemotes_soda01', PropBone = 28422, PropPlacement = { 0.0470, 0.0040, -0.0600, -88.0263, -25.0367, -27.3898 }, EmoteLoop = true, EmoteMoving = true }},
sipsodab = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Soda Cup - Sprunk Light", AnimationOptions = { Prop = 'prop_rpemotes_soda02', PropBone = 28422, PropPlacement = { 0.0470, 0.0040, -0.0600, -88.0263, -25.0367, -27.3898 }, EmoteLoop = true, EmoteMoving = true }},
sipsodac = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Soda Cup - eCola", AnimationOptions = { Prop = 'prop_rpemotes_soda03', PropBone = 28422, PropPlacement = { 0.0470, 0.0040, -0.0600, -88.0263, -25.0367, -27.3898 }, EmoteLoop = true, EmoteMoving = true }},
sipsodad = { "smo@milkshake_idle", "milkshake_idle_clip", "Sip Soda Cup - eCola Light", AnimationOptions = { Prop = 'prop_rpemotes_soda04', PropBone = 28422, PropPlacement = { 0.0470, 0.0040, -0.0600, -88.0263, -25.0367, -27.3898 }, EmoteLoop = true, EmoteMoving = true }},
taco = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Taco", AnimationOptions = { Prop = 'prop_taco_01', PropBone = 60309, PropPlacement = { -0.0170, 0.0070, -0.0210, 107.9846, -105.0251, 55.7779 }, EmoteMoving = true }},
xmascc = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Xmas Cupcake", AnimationOptions = { Prop = 'pata_christmasfood6', PropBone = 60309, PropPlacement = { 0.0100, 0.0200, -0.0100, -170.1788, 87.6716, 30.0540 }, EmoteMoving = true }},
xmascc2 = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "Xmas Cupcake 2", AnimationOptions = { Prop = 'pata_christmasfood8', PropBone = 60309, PropPlacement = { 0.0200, 0.0, -0.0100, 9.3608, -90.1809, 66.3689 }, EmoteMoving = true }},
xmasic = { "anim@scripted@island@special_peds@pavel@hs4_pavel_ig5_caviar_p1", "base_idle", "Xmas Ice Cream", AnimationOptions = { Prop = "pata_christmasfood7", PropBone = 60309, PropPlacement = { -0.0460, 0.0000, -0.0300, 0.0, 0.0, -50.0000 }, SecondProp = 'h4_prop_h4_coke_spoon_01', SecondPropBone = 28422, SecondPropPlacement = { 0.0, 0.0, 0.0, 0.0, 20.0, 0.0 }, EmoteLoop = true, EmoteMoving = true }},
xmaswine = { "mp_player_intdrink", "loop_bottle", "Xmas Mulled Wine", AnimationOptions = { Prop = 'bzzz_food_xmas_mulled_wine_a', PropBone = 18905, PropPlacement = { 0.13, 0.03, 0.05, -110.0, -47.0, 7.0 }, EmoteMoving = true }},
cocoa = { "amb@world_human_aa_coffee@base", "base", "Xmas Cocoa", AnimationOptions = { Prop = 'pata_christmasfood1', PropBone = 28422, PropPlacement = { 0.0100, -0.1100, -0.1300, 0.0, 0.0, 0.0 }, EmoteLoop = true, EmoteMoving = true }},
coke = { "switch@trevor@trev_smoking_meth", "trev_smoking_meth_loop", "Coke", AnimationOptions = { EmoteLoop = true, EmoteMoving = true }},
oxy = { "mp_suicide", "pill", "Oxy", AnimationOptions = { EmoteLoop = true, EmoteMoving = true }},
cigar = { "amb@world_human_smoking@male@male_a@enter", "enter", "Cigar", AnimationOptions = { Prop = 'prop_cigar_02', PropBone = 47419, PropPlacement = { 0.010, 0.0, 0.0, 50.0, 0.0, -80.0 }, EmoteMoving = true, EmoteDuration = 2600 }},
cigar2 = { "amb@world_human_smoking@male@male_a@enter", "enter", "Cigar 2", AnimationOptions = { Prop = 'prop_cigar_01', PropBone = 47419, PropPlacement = { 0.010, 0.0, 0.0, 50.0, 0.0, -80.0 }, EmoteMoving = true, EmoteDuration = 2600 }},
joint = { "amb@world_human_smoking@male@male_a@enter", "enter", "Joint", AnimationOptions = { Prop = 'p_cs_joint_02', PropBone = 47419, PropPlacement = { 0.015, -0.009, 0.003, 55.0, 0.0, 110.0 }, EmoteMoving = true, EmoteDuration = 2600 }},
cig = { "amb@world_human_smoking@male@male_a@enter", "enter", "Cig", AnimationOptions = { Prop = 'prop_amb_ciggy_01', PropBone = 47419, PropPlacement = { 0.015, -0.009, 0.003, 55.0, 0.0, 110.0 }, EmoteMoving = true, EmoteDuration = 2600 }},
smoke2 = { "amb@world_human_aa_smoke@male@idle_a", "idle_c", "Smoke 2", AnimationOptions = { Prop = 'prop_cs_ciggy_01', PropBone = 28422, PropPlacement = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, EmoteLoop = true, EmoteMoving = true }},
smokecigar = { "amb@world_human_aa_smoke@male@idle_a", "idle_c", "Smoke Cigar", AnimationOptions = { Prop = 'prop_cigar_01', PropBone = 28422, PropPlacement = { 0.0, 0.0, 0.0, 0.0, 0.0, 180.0 }, EmoteLoop = true, EmoteMoving = true }},
uncuff = { "mp_arresting", "a_uncuff", "Uncuff", AnimationOptions = { EmoteLoop = true, EmoteMoving = true }},
}

View File

@@ -1,278 +1,23 @@
local QBCore = exports[Config.Core]:GetCoreObject()
RegisterNetEvent('QBCore:Client:UpdateObject', function() QBCore = exports[Config.Core]:GetCoreObject() end)
local time = 1000
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 -= 1 RequestModel(model)
else time = 1000 print("^5Debug^7: ^3LoadModel^7: ^2Timed out loading model ^7'^6"..model.."^7'") 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 not HasAnimDictLoaded(dict) then 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 end
function unloadAnimDict(dict) if Config.Debug then print("^5Debug^7: ^2Removing Anim Dictionary^7: '^6"..dict.."^7'") end RemoveAnimDict(dict) end
function loadPtfxDict(dict) if not HasNamedPtfxAssetLoaded(dict) then if Config.Debug then print("^5Debug^7: ^2Loading Ptfx Dictionary^7: '^6"..dict.."^7'") end while not HasNamedPtfxAssetLoaded(dict) do RequestNamedPtfxAsset(dict) Wait(5) end end end
function unloadPtfxDict(dict) if Config.Debug then print("^5Debug^7: ^2Removing Ptfx Dictionary^7: '^6"..dict.."^7'") end RemoveNamedPtfxAsset(dict) end
function destroyProp(entity)
if Config.Debug then print("^5Debug^7: ^2Destroying Prop^7: '^6"..entity.."^7'") end
SetEntityAsMissionEntity(entity) Wait(5)
DeleteObject(entity)
end
function makeProp(data, freeze, synced)
loadModel(data.prop)
local prop = CreateObject(data.prop, 0.0, 0.0, 0.0, synced or false, synced or false, false)
SetEntityHeading(prop, data.coords.w+180.0)
SetEntityCompletelyDisableCollision(prop, true, false)
DisableCamCollisionForEntity(prop)
DisableCamCollisionForObject(prop)
if Config.Debug then print("^5Debug^7: ^6Prop ^2Created ^7: '^6"..prop.."^7'") end
return prop
end
function triggerNotify(title, message, type, src)
if Config.Notify == "okok" then
if not src then exports['okokNotify']:Alert(title, message, 6000, type)
else TriggerClientEvent('okokNotify:Alert', src, title, message, 6000, type) end
elseif Config.Notify == "qb" then
if not src then TriggerEvent("QBCore:Notify", message, type)
else TriggerClientEvent("QBCore:Notify", src, message, type) end
elseif Config.Notify == "t" then
if not src then exports['t-notify']:Custom({title = title, style = type, message = message, sound = true})
else TriggerClientEvent('t-notify:client:Custom', src, { style = type, duration = 6000, title = title, message = message, sound = true, custom = true}) end
elseif Config.Notify == "infinity" then
if not src then TriggerEvent('infinity-notify:sendNotify', message, type)
else TriggerClientEvent('infinity-notify:sendNotify', src, message, type) end
elseif Config.Notify == "rr" then
if not src then exports.rr_uilib:Notify({msg = message, type = type, style = "dark", duration = 6000, position = "top-right", })
else TriggerClientEvent("rr_uilib:Notify", src, {msg = message, type = type, style = "dark", duration = 6000, position = "top-right", }) end
elseif Config.Notify == "ox" then
if not src then exports.ox_lib:notify({title = title, description = message, type = type or "success"})
else exports.ox_lib:notify({title = title, description = message, type = type or "success"}) end
end
end
function countTable(table) local i = 0 for keys in pairs(table) do i += 1 end return i end
function toggleItem(give, item, amount) TriggerServerEvent("jim-consumables:server:toggleItem", give, item, amount) end
if Config.Inv == "ox" then
function HasItem(items, amount)
local count = exports.ox_inventory:Search('count', items)
if count >= amount then if Config.Debug then print("^5Debug^7: ^3HasItem^7: ^5FOUND^7 ^3"..count.."^7/^3"..amount.." "..tostring(items)) end return true
else if Config.Debug then print("^5Debug^7: ^3HasItem^7: ^2"..tostring(items).." ^1NOT FOUND^7") end return false end
end
else
function HasItem(items, amount)
local amount = amount or 1
local count = 0
for _, itemData in pairs(QBCore.Functions.GetPlayerData().items) do
if itemData and (itemData.name == items) then
if Config.Debug then print("^5Debug^7: ^3HasItem^7: ^2Item^7: '^3"..tostring(items).."^7' ^2Slot^7: ^3"..itemData.slot.." ^7x(^3"..tostring(itemData.amount).."^7)") end
count += itemData.amount
end
end
if count >= amount then
if Config.Debug then print("^5Debug^7: ^3HasItem^7: ^2Items ^5FOUND^7 x^3"..count.."^7") end
return true
else
if Config.Debug then print("^5Debug^7: ^3HasItem^7: ^2Items ^1NOT FOUND^7") end
return false
end
end
end
--Screen Effects
local alienEffect = false
function AlienEffect()
if alienEffect then return else alienEffect = true end
if Config.Debug then print("^5Debug^7: ^3AlienEffect^7() ^2activated") end
AnimpostfxPlay("DrugsMichaelAliensFightIn", 3.0, 0)
Wait(math.random(5000, 8000))
local Ped = PlayerPedId()
local animDict = "MOVE_M@DRUNK@VERYDRUNK"
loadAnimDict(animDict)
SetPedCanRagdoll(Ped, true)
ShakeGameplayCam('DRUNK_SHAKE', 2.80)
SetTimecycleModifier("Drunk")
SetPedMovementClipset(Ped, animDict, 1)
SetPedMotionBlur(Ped, true)
SetPedIsDrunk(Ped, true)
Wait(1500)
SetPedToRagdoll(Ped, 5000, 1000, 1, 0, 0, 0)
Wait(13500)
SetPedToRagdoll(Ped, 5000, 1000, 1, 0, 0, 0)
Wait(120500)
ClearTimecycleModifier()
ResetScenarioTypesEnabled()
ResetPedMovementClipset(Ped, 0)
SetPedIsDrunk(Ped, false)
SetPedMotionBlur(Ped, false)
AnimpostfxStopAll()
ShakeGameplayCam('DRUNK_SHAKE', 0.0)
AnimpostfxPlay("DrugsMichaelAliensFight", 3.0, 0)
Wait(math.random(45000, 60000))
AnimpostfxPlay("DrugsMichaelAliensFightOut", 3.0, 0)
AnimpostfxStop("DrugsMichaelAliensFightIn")
AnimpostfxStop("DrugsMichaelAliensFight")
AnimpostfxStop("DrugsMichaelAliensFightOut")
alienEffect = false
if Config.Debug then print("^5Debug^7: ^3AlienEffect^7() ^2stopped") end
end
local weedEffect = false
function WeedEffect()
if weedEffect then return else weedEffect = true end
if Config.Debug then print("^5Debug^7: ^3WeedEffect^7() ^2activated") end
AnimpostfxPlay("DrugsMichaelAliensFightIn", 3.0, 0)
Wait(math.random(3000, 20000))
AnimpostfxPlay("DrugsMichaelAliensFight", 3.0, 0)
Wait(math.random(15000, 20000))
AnimpostfxPlay("DrugsMichaelAliensFightOut", 3.0, 0)
AnimpostfxStop("DrugsMichaelAliensFightIn")
AnimpostfxStop("DrugsMichaelAliensFight")
AnimpostfxStop("DrugsMichaelAliensFightOut")
weedEffect = false
if Config.Debug then print("^5Debug^7: ^3WeedEffect^7() ^2stopped") end
end
local trevorEffect = false
function TrevorEffect()
if trevorEffect then return else trevorEffect = true end
if Config.Debug then print("^5Debug^7: ^3TrevorEffect^7() ^2activated") end
AnimpostfxPlay("DrugsTrevorClownsFightIn", 3.0, 0)
Wait(3000)
AnimpostfxPlay("DrugsTrevorClownsFight", 3.0, 0)
Wait(30000)
AnimpostfxPlay("DrugsTrevorClownsFightOut", 3.0, 0)
AnimpostfxStop("DrugsTrevorClownsFight")
AnimpostfxStop("DrugsTrevorClownsFightIn")
AnimpostfxStop("DrugsTrevorClownsFightOut")
trevorEffect = false
if Config.Debug then print("^5Debug^7: ^3TrevorEffect^7() ^2stopped") end
end
local turboEffect = false
function TurboEffect()
if turboEffect then return else turboEffect = true end
if Config.Debug then print("^5Debug^7: ^3TurboEffect^7() ^2activated") end
AnimpostfxPlay('RaceTurbo', 0, true)
SetTimecycleModifier('rply_motionblur')
ShakeGameplayCam('SKY_DIVING_SHAKE', 0.25)
Wait(30000)
StopGameplayCamShaking(true)
SetTransitionTimecycleModifier('default', 0.35)
Wait(1000)
ClearTimecycleModifier()
AnimpostfxStop('RaceTurbo')
turboEffect = false
if Config.Debug then print("^5Debug^7: ^3TurboEffect^7() ^2stopped") end
end
local rampageEffect = false
function RampageEffect()
if rampageEffect then return else rampageEffect = true end
if Config.Debug then print("^5Debug^7: ^3RampageEffect^7() ^2activated") end
AnimpostfxPlay('Rampage', 0, true)
SetTimecycleModifier('rply_motionblur')
ShakeGameplayCam('SKY_DIVING_SHAKE', 0.25)
Wait(30000)
StopGameplayCamShaking(true)
SetTransitionTimecycleModifier('default', 0.35)
Wait(1000)
ClearTimecycleModifier()
AnimpostfxStop('Rampage')
rampageEffect = false
if Config.Debug then print("^5Debug^7: ^3RampageEffect^7() ^2stopped") end
end
local focusEffect = false
function FocusEffect()
if focusEffect then return else focusEffect = true end
if Config.Debug then print("^5Debug^7: ^3FocusEffect^7() ^2activated") end
Wait(1000)
AnimpostfxPlay('FocusIn', 0, true)
Wait(30000)
AnimpostfxStop('FocusIn')
focusEffect = false
if Config.Debug then print("^5Debug^7: ^3FocusEffect^7() ^2stopped") 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
local healEffect = false
function HealEffect(data)
if healEffect then return end
if Config.Debug then print("^5Debug^7: ^3HealEffect^7() ^2activated") end
healEffect = true
local count = (data[1] / 1000)
while count > 0 do
Wait(1000)
count -= 1
SetEntityHealth(PlayerPedId(), GetEntityHealth(PlayerPedId()) + data[2])
end
healEffect = false
if Config.Debug then print("^5Debug^7: ^3HealEffect^7() ^2stopped") end
end
local staminaEffect = false
function StaminaEffect(data)
if staminaEffect then return end
if Config.Debug then print("^5Debug^7: ^3StaminaEffect^7() ^2activated") end
staminaEffect = true
local startStamina = (data[1] / 1000)
SetRunSprintMultiplierForPlayer(PlayerId(), 1.49)
while startStamina > 0 do
Wait(1000)
if math.random(5, 100) < 10 then RestorePlayerStamina(PlayerId(), data[2]) end
startStamina -= 1
if math.random(5, 100) < 51 then end
end
startStamina = 0
SetRunSprintMultiplierForPlayer(PlayerId(), 1.0)
staminaEffect = false
if Config.Debug then print("^5Debug^7: ^3StaminaEffect^7() ^2stopped") end
end
function StopEffects() -- Used to clear up any effects stuck on screen
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)
SetNightvision(false)
SetSeethrough(false)
AnimpostfxStop("DrugsMichaelAliensFightIn")
AnimpostfxStop("DrugsMichaelAliensFight")
AnimpostfxStop("DrugsMichaelAliensFightOut")
AnimpostfxStop("DrugsTrevorClownsFight")
AnimpostfxStop("DrugsTrevorClownsFightIn")
AnimpostfxStop("DrugsTrevorClownsFightOut")
AnimpostfxStop('RaceTurbo')
AnimpostfxStop('FocusIn')
AnimpostfxStop('Rampage')
function tempLockInv(toggle)
LocalPlayer.state:set("inv_busy", toggle, true)
TriggerEvent('inventory:client:busy:status', toggle)
TriggerEvent('canUseInventoryAndHotbar:toggle', not toggle)
end
function GenerateRandomValues(data)
local transData = {}
for k, v in pairs(data) do
if type(v) == "table" then
debugPrint("Converting Table "..json.encode(v).." to math.random")
transData[k] = math.random(v[1], v[2])
debugPrint("Translated value: "..k.." - "..transData[k])
else
transData[k] = v
end
end
return transData["time"],
transData["stress"],
transData["heal"],
transData["armor"],
{ hunger = transData["hunger"], thirst = transData["thirst"] }
end