Skip to content

Commit

Permalink
Inventory Update
Browse files Browse the repository at this point in the history
  • Loading branch information
GhzGarage committed May 20, 2024
1 parent 71fd3ea commit cabb12a
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 570 deletions.
30 changes: 15 additions & 15 deletions client/consumables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ RegisterNetEvent('consumables:client:Eat', function(itemName)
coords = vec3(0.0, 0.0, -0.02),
rotation = vec3(30, 0.0, 0.0),
}, {}, function() -- Done
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
TriggerServerEvent('consumables:server:addHunger', QBCore.Functions.GetPlayerData().metadata.hunger + Config.Consumables.eat[itemName])
TriggerServerEvent('hud:server:RelieveStress', math.random(2, 4))
end)
Expand All @@ -182,7 +182,7 @@ RegisterNetEvent('consumables:client:Drink', function(itemName)
coords = vec3(0.0, 0.0, -0.05),
rotation = vec3(0.0, 0.0, -40),
}, {}, function() -- Done
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
TriggerServerEvent('consumables:server:addThirst', QBCore.Functions.GetPlayerData().metadata.thirst + Config.Consumables.drink[itemName])
end)
end)
Expand All @@ -203,7 +203,7 @@ RegisterNetEvent('consumables:client:DrinkAlcohol', function(itemName)
coords = vec3(0.0, 0.0, -0.05),
rotation = vec3(0.0, 0.0, -40),
}, {}, function() -- Done
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
TriggerServerEvent('consumables:server:drinkAlcohol', itemName)
TriggerServerEvent('consumables:server:addThirst', QBCore.Functions.GetPlayerData().metadata.thirst + Config.Consumables.alcohol[itemName])
TriggerServerEvent('hud:server:RelieveStress', math.random(2, 4))
Expand Down Expand Up @@ -237,7 +237,7 @@ RegisterNetEvent('consumables:client:Custom', function(itemName)
rotation = data.prop.rotation
}, {}, function() -- Done
ClearPedTasks(PlayerPedId())
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
if data.replenish.type then
TriggerServerEvent('consumables:server:add' .. data.replenish.type, QBCore.Functions.GetPlayerData().metadata[string.lower(data.replenish.type)] + data.replenish.replenish)
end
Expand Down Expand Up @@ -271,7 +271,7 @@ RegisterNetEvent('consumables:client:Cokebaggy', function()
}, {}, {}, function() -- Done
StopAnimTask(ped, 'switch@trevor@trev_smoking_meth', 'trev_smoking_meth_loop', 1.0)
TriggerServerEvent('consumables:server:useCokeBaggy')
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items['cokebaggy'], 'remove')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items['cokebaggy'], 'remove')
TriggerEvent('evidence:client:SetStatus', 'widepupils', 200)
cokeBaggyEffect()
end, function() -- Cancel
Expand All @@ -294,7 +294,7 @@ RegisterNetEvent('consumables:client:Crackbaggy', function()
}, {}, {}, function() -- Done
StopAnimTask(ped, 'switch@trevor@trev_smoking_meth', 'trev_smoking_meth_loop', 1.0)
TriggerServerEvent('consumables:server:useCrackBaggy')
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items['crack_baggy'], 'remove')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items['crack_baggy'], 'remove')
TriggerEvent('evidence:client:SetStatus', 'widepupils', 300)
crackBaggyEffect()
end, function() -- Cancel
Expand All @@ -316,7 +316,7 @@ RegisterNetEvent('consumables:client:EcstasyBaggy', function()
}, {}, {}, function() -- Done
StopAnimTask(PlayerPedId(), 'mp_suicide', 'pill', 1.0)
TriggerServerEvent('consumables:server:useXTCBaggy')
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items['xtcbaggy'], 'remove')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items['xtcbaggy'], 'remove')
ecstasyEffect()
end, function() -- Cancel
StopAnimTask(PlayerPedId(), 'mp_suicide', 'pill', 1.0)
Expand All @@ -337,7 +337,7 @@ RegisterNetEvent('consumables:client:oxy', function()
}, {}, {}, function() -- Done
StopAnimTask(PlayerPedId(), 'mp_suicide', 'pill', 1.0)
TriggerServerEvent('consumables:server:useOxy')
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items['oxy'], 'remove')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items['oxy'], 'remove')
ClearPedBloodDamage(PlayerPedId())
healOxy()
end, function() -- Cancel
Expand All @@ -359,7 +359,7 @@ RegisterNetEvent('consumables:client:meth', function()
}, {}, {}, function() -- Done
StopAnimTask(PlayerPedId(), 'switch@trevor@trev_smoking_meth', 'trev_smoking_meth_loop', 1.0)
TriggerServerEvent('consumables:server:useMeth')
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items['meth'], 'remove')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items['meth'], 'remove')
TriggerEvent('evidence:client:SetStatus', 'widepupils', 300)
TriggerEvent('evidence:client:SetStatus', 'agitated', 300)
methBagEffect()
Expand All @@ -376,7 +376,7 @@ RegisterNetEvent('consumables:client:UseJoint', function()
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Done
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items['joint'], 'remove')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items['joint'], 'remove')
if IsPedInAnyVehicle(PlayerPedId(), false) then
QBCore.Functions.PlayAnim('timetable@gardener@smoking_joint', 'smoke_idle', false)
else
Expand All @@ -396,7 +396,7 @@ RegisterNetEvent('consumables:client:UseParachute', function()
disableCombat = true,
}, {}, {}, {}, function() -- Done
local ped = PlayerPedId()
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items['parachute'], 'remove')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items['parachute'], 'remove')
GiveWeaponToPed(ped, `GADGET_PARACHUTE`, 1, false, false)
local parachuteData = {
outfitData = { ['bag'] = { item = 7, texture = 0 } } -- Adding Parachute Clothing
Expand All @@ -417,13 +417,13 @@ RegisterNetEvent('consumables:client:ResetParachute', function()
disableCombat = true,
}, {}, {}, {}, function() -- Done
local ped = PlayerPedId()
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items['parachute'], 'add')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items['parachute'], 'add')
local parachuteResetData = {
outfitData = { ['bag'] = { item = 0, texture = 0 } } -- Removing Parachute Clothing
}
TriggerEvent('qb-clothing:client:loadOutfit', parachuteResetData)
TaskPlayAnim(ped, 'clothingshirt', 'exit', 8.0, 1.0, -1, 49, 0, false, false, false)
TriggerServerEvent('qb-smallpenis:server:AddParachute')
TriggerServerEvent('consumables:server:AddParachute')
parachuteEquipped = false
end)
else
Expand Down Expand Up @@ -489,7 +489,7 @@ RegisterNetEvent('consumables:client:ResetArmor', function()
}, {}, {}, {}, function() -- Done
SetPedComponentVariation(ped, 9, currVest, currVestTexture, 2)
SetPedArmour(ped, 0)
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items['heavyarmor'], 'add')
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items['heavyarmor'], 'add')
TriggerServerEvent('consumables:server:resetArmor')
end)
else
Expand All @@ -502,7 +502,7 @@ end)
-- local ped = PlayerPedId()
-- SetPlayerParachuteSmokeTrailColor(ped, 255, 0, 0)
-- SetPlayerCanLeaveParachuteSmokeTrail(ped, true)
-- TriggerEvent("inventory:client:Itembox", QBCore.Shared.Items["smoketrailred"], "remove")
-- TriggerEvent("qb-inventory:client:ItemBox", QBCore.Shared.Items["smoketrailred"], "remove")
-- else
-- QBCore.Functions.Notify("You need to have a paracute to activate smoke!", "error")
-- end
Expand Down
10 changes: 4 additions & 6 deletions client/cruise.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ local function triggerCruiseControl(veh)
local isTurningOrHandbraking = IsControlPressed(2, 76) or IsControlPressed(2, 63) or IsControlPressed(2, 64)
TriggerEvent('seatbelt:client:ToggleCruise', true)
QBCore.Functions.Notify(Lang:t('cruise.activated'))

CreateThread(function()
while speed > 0 and GetPedInVehicleSeat(veh, -1) == ped do
Wait(0)
if not isTurningOrHandbraking and GetEntitySpeed(veh) < speed - 1.5 then
speed = 0
TriggerEvent('seatbelt:client:ToggleCruise', false)
QBCore.Functions.Notify(Lang:t('cruise.deactivated'), "error")
QBCore.Functions.Notify(Lang:t('cruise.deactivated'), 'error')
Wait(2000)
break
end
Expand All @@ -56,7 +56,7 @@ local function triggerCruiseControl(veh)
if IsControlJustPressed(2, 72) then
speed = 0
TriggerEvent('seatbelt:client:ToggleCruise', false)
QBCore.Functions.Notify(Lang:t('cruise.deactivated'), "error")
QBCore.Functions.Notify(Lang:t('cruise.deactivated'), 'error')
Wait(2000)
break
end
Expand All @@ -73,9 +73,7 @@ RegisterCommand('togglecruise', function()
local vehClass = GetVehicleClass(veh)
if ped == driver and vehicleClasses[vehClass] then
triggerCruiseControl(veh)
else
QBCore.Functions.Notify(Lang:t('cruise.unavailable'), "error")
end
end, false)

RegisterKeyMapping('togglecruise', 'Toggle Cruise Control', 'keyboard', 'Y')
RegisterKeyMapping('togglecruise', 'Toggle Cruise Control', 'keyboard', 'Y')
90 changes: 45 additions & 45 deletions client/fireworks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,45 @@ local QBCore = exports['qb-core']:GetCoreObject()
local fireworkTime = 0
local fireworkLoc = nil
local fireworkList = {
["proj_xmas_firework"] = {
"scr_firework_xmas_ring_burst_rgw",
"scr_firework_xmas_burst_rgw",
"scr_firework_xmas_repeat_burst_rgw",
"scr_firework_xmas_spiral_burst_rgw",
"scr_xmas_firework_sparkle_spawn"
['proj_xmas_firework'] = {
'scr_firework_xmas_ring_burst_rgw',
'scr_firework_xmas_burst_rgw',
'scr_firework_xmas_repeat_burst_rgw',
'scr_firework_xmas_spiral_burst_rgw',
'scr_xmas_firework_sparkle_spawn'
},
["scr_indep_fireworks"] = {
"scr_indep_firework_sparkle_spawn",
"scr_indep_firework_starburst",
"scr_indep_firework_shotburst",
"scr_indep_firework_trailburst",
"scr_indep_firework_trailburst_spawn",
"scr_indep_firework_burst_spawn",
"scr_indep_firework_trail_spawn",
"scr_indep_firework_fountain"
['scr_indep_fireworks'] = {
'scr_indep_firework_sparkle_spawn',
'scr_indep_firework_starburst',
'scr_indep_firework_shotburst',
'scr_indep_firework_trailburst',
'scr_indep_firework_trailburst_spawn',
'scr_indep_firework_burst_spawn',
'scr_indep_firework_trail_spawn',
'scr_indep_firework_fountain'
},
["proj_indep_firework"] = {
"scr_indep_firework_grd_burst",
"scr_indep_launcher_sparkle_spawn",
"scr_indep_firework_air_burst",
"proj_indep_flare_trail"
['proj_indep_firework'] = {
'scr_indep_firework_grd_burst',
'scr_indep_launcher_sparkle_spawn',
'scr_indep_firework_air_burst',
'proj_indep_flare_trail'
},
["proj_indep_firework_v2"] = {
"scr_firework_indep_burst_rwb",
"scr_firework_indep_spiral_burst_rwb",
"scr_xmas_firework_sparkle_spawn",
"scr_firework_indep_ring_burst_rwb",
"scr_xmas_firework_burst_fizzle",
"scr_firework_indep_repeat_burst_rwb"
['proj_indep_firework_v2'] = {
'scr_firework_indep_burst_rwb',
'scr_firework_indep_spiral_burst_rwb',
'scr_xmas_firework_sparkle_spawn',
'scr_firework_indep_ring_burst_rwb',
'scr_xmas_firework_burst_fizzle',
'scr_firework_indep_repeat_burst_rwb'
}
}

local function DrawText3D(x, y, z, text)
SetTextScale(0.35, 0.35)
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(true)
SetTextColour(255, 255, 255, 215)
BeginTextCommandDisplayText("STRING")
BeginTextCommandDisplayText('STRING')
SetTextCentre(true)
AddTextComponentSubstringPlayerName(text)
SetDrawOrigin(x, y, z, 0)
Expand All @@ -55,7 +55,7 @@ local function fireworkText()
while true do
Wait(0)
if fireworkTime > 0 and fireworkLoc then
DrawText3D(fireworkLoc.x, fireworkLoc.y, fireworkLoc.z, Lang:t('firework.time_left')..fireworkTime)
DrawText3D(fireworkLoc.x, fireworkLoc.y, fireworkLoc.z, Lang:t('firework.time_left') .. fireworkTime)
end
if fireworkTime <= 0 then break end
end
Expand All @@ -64,14 +64,14 @@ end

local function startFirework(asset, coords)
fireworkTime = Config.Fireworks.delay
fireworkLoc = {x = coords.x, y = coords.y, z = coords.z}
fireworkLoc = { x = coords.x, y = coords.y, z = coords.z }
CreateThread(function()
fireworkText()
while fireworkTime > 0 do
Wait(1000)
fireworkTime -= 1
end
UseParticleFxAssetNextCall("scr_indep_fireworks")
UseParticleFxAssetNextCall('scr_indep_fireworks')
for _ = 1, math.random(5, 10), 1 do
local firework = fireworkList[asset][math.random(1, #fireworkList[asset])]
UseParticleFxAssetNextCall(asset)
Expand All @@ -84,10 +84,10 @@ end

CreateThread(function()
local assets = {
"scr_indep_fireworks",
"proj_xmas_firework",
"proj_indep_firework_v2",
"proj_indep_firework"
'scr_indep_fireworks',
'proj_xmas_firework',
'proj_indep_firework_v2',
'proj_indep_firework'
}

for i = 1, #assets do
Expand All @@ -102,23 +102,23 @@ CreateThread(function()
end)

RegisterNetEvent('fireworks:client:UseFirework', function(itemName, assetName)
QBCore.Functions.Progressbar("spawn_object", Lang:t('firework.place_progress'), 3000, false, true, {
QBCore.Functions.Progressbar('spawn_object', Lang:t('firework.place_progress'), 3000, false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {
animDict = "anim@narcotics@trash",
anim = "drop_front",
animDict = 'anim@narcotics@trash',
anim = 'drop_front',
flags = 16,
}, {}, {}, function() -- Done
StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0)
TriggerServerEvent("consumables:server:UseFirework", itemName)
TriggerEvent("inventory:client:ItemBox", QBCore.Shared.Items[itemName], "remove")
StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0)
TriggerServerEvent('consumables:server:UseFirework', itemName)
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
local pos = GetEntityCoords(PlayerPedId())
startFirework(assetName, pos)
end, function() -- Cancel
StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0)
QBCore.Functions.Notify(Lang:t('firework.canceled'), "error")
StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0)
QBCore.Functions.Notify(Lang:t('firework.canceled'), 'error')
end)
end)
end)
Loading

0 comments on commit cabb12a

Please sign in to comment.