diff --git a/client/consumables.lua b/client/consumables.lua index 87782beb..464f59b3 100644 --- a/client/consumables.lua +++ b/client/consumables.lua @@ -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) @@ -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) @@ -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)) @@ -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 @@ -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 @@ -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 @@ -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) @@ -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 @@ -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() @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/client/cruise.lua b/client/cruise.lua index c87af4ac..19aa4384 100644 --- a/client/cruise.lua +++ b/client/cruise.lua @@ -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 @@ -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 @@ -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') \ No newline at end of file +RegisterKeyMapping('togglecruise', 'Toggle Cruise Control', 'keyboard', 'Y') diff --git a/client/fireworks.lua b/client/fireworks.lua index 5503d539..60117f60 100644 --- a/client/fireworks.lua +++ b/client/fireworks.lua @@ -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) @@ -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 @@ -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) @@ -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 @@ -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) \ No newline at end of file +end) diff --git a/client/recoil.lua b/client/recoil.lua deleted file mode 100644 index 15113836..00000000 --- a/client/recoil.lua +++ /dev/null @@ -1,119 +0,0 @@ -local recoils = { - -- Handguns - [`weapon_pistol`] = 0.3, - [`weapon_pistol_mk2`] = 0.5, - [`weapon_combatpistol`] = 0.2, - [`weapon_appistol`] = 0.3, - [`weapon_stungun`] = 0.1, - [`weapon_pistol50`] = 0.6, - [`weapon_snspistol`] = 0.2, - [`weapon_heavypistol`] = 0.5, - [`weapon_vintagepistol`] = 0.4, - [`weapon_flaregun`] = 0.9, - [`weapon_marksmanpistol`] = 0.9, - [`weapon_revolver`] = 0.6, - [`weapon_revolver_mk2`] = 0.6, - [`weapon_doubleaction`] = 0.3, - [`weapon_snspistol_mk2`] = 0.3, - [`weapon_raypistol`] = 0.3, - [`weapon_ceramicpistol`] = 0.3, - [`weapon_navyrevolver`] = 0.3, - [`weapon_gadgetpistol`] = 0.3, - [`weapon_pistolxm3`] = 0.4, - - -- Submachine Guns - [`weapon_microsmg`] = 0.5, - [`weapon_smg`] = 0.4, - [`weapon_smg_mk2`] = 0.1, - [`weapon_assaultsmg`] = 0.1, - [`weapon_combatpdw`] = 0.2, - [`weapon_machinepistol`] = 0.3, - [`weapon_minismg`] = 0.1, - [`weapon_raycarbine`] = 0.3, - [`weapon_tecpistol`] = 0.3, - - -- Shotguns - [`weapon_pumpshotgun`] = 0.4, - [`weapon_sawnoffshotgun`] = 0.7, - [`weapon_assaultshotgun`] = 0.4, - [`weapon_bullpupshotgun`] = 0.2, - [`weapon_musket`] = 0.7, - [`weapon_heavyshotgun`] = 0.2, - [`weapon_dbshotgun`] = 0.7, - [`weapon_autoshotgun`] = 0.2, - [`weapon_pumpshotgun_mk2`] = 0.4, - [`weapon_combatshotgun`] = 0.0, - - -- Assault Rifles - [`weapon_assaultrifle`] = 0.5, - [`weapon_assaultrifle_mk2`] = 0.2, - [`weapon_carbinerifle`] = 0.3, - [`weapon_carbinerifle_mk2`] = 0.1, - [`weapon_advancedrifle`] = 0.1, - [`weapon_specialcarbine`] = 0.2, - [`weapon_bullpuprifle`] = 0.2, - [`weapon_compactrifle`] = 0.3, - [`weapon_specialcarbine_mk2`] = 0.2, - [`weapon_bullpuprifle_mk2`] = 0.2, - [`weapon_militaryrifle`] = 0.0, - [`weapon_heavyrifle`] = 0.3, - [`weapon_tacticalrifle`] = 0.2, - - -- Light Machine Guns - [`weapon_mg`] = 0.1, - [`weapon_combatmg`] = 0.1, - [`weapon_gusenberg`] = 0.1, - [`weapon_combatmg_mk2`] = 0.1, - - -- Sniper Rifles - [`weapon_sniperrifle`] = 0.5, - [`weapon_heavysniper`] = 0.7, - [`weapon_marksmanrifle`] = 0.3, - [`weapon_remotesniper`] = 1.2, - [`weapon_heavysniper_mk2`] = 0.6, - [`weapon_marksmanrifle_mk2`] = 0.3, - [`weapon_precisionrifle`] = 0.3, - - -- Heavy Weapons - [`weapon_rpg`] = 0.0, - [`weapon_grenadelauncher`] = 1.0, - [`weapon_grenadelauncher_smoke`] = 1.0, - [`weapon_minigun`] = 0.1, - [`weapon_firework`] = 0.3, - [`weapon_railgun`] = 2.4, - [`weapon_hominglauncher`] = 0.0, - [`weapon_compactlauncher`] = 0.5, - [`weapon_rayminigun`] = 0.3, -} - -AddEventHandler('CEventGunShot', function(entities, eventEntity, args) - local ped = PlayerPedId() - - if eventEntity ~= ped then return end - if IsPedDoingDriveby(ped) then return end - - local _, weap = GetCurrentPedWeapon(ped) - if recoils[weap] and recoils[weap] ~= 0 then - local tv = 0 - if GetFollowPedCamViewMode() ~= 4 then - repeat - Wait(0) - local p = GetGameplayCamRelativePitch() - SetGameplayCamRelativePitch(p + 0.1, 0.2) - tv += 0.1 - until tv >= recoils[weap] - else - repeat - Wait(0) - local p = GetGameplayCamRelativePitch() - if recoils[weap] > 0.1 then - SetGameplayCamRelativePitch(p + 0.6, 1.2) - tv += 0.6 - else - SetGameplayCamRelativePitch(p + 0.016, 0.333) - tv += 0.1 - end - until tv >= recoils[weap] - end - end -end) diff --git a/client/weapdraw.lua b/client/weapdraw.lua deleted file mode 100644 index 1bea01fa..00000000 --- a/client/weapdraw.lua +++ /dev/null @@ -1,338 +0,0 @@ -local weapons = { - 'WEAPON_KNIFE', - 'WEAPON_NIGHTSTICK', - 'WEAPON_BREAD', - 'WEAPON_FLASHLIGHT', - 'WEAPON_HAMMER', - 'WEAPON_BAT', - 'WEAPON_GOLFCLUB', - 'WEAPON_CROWBAR', - 'WEAPON_BOTTLE', - 'WEAPON_DAGGER', - 'WEAPON_HATCHET', - 'WEAPON_MACHETE', - 'WEAPON_SWITCHBLADE', - 'WEAPON_BATTLEAXE', - 'WEAPON_POOLCUE', - 'WEAPON_WRENCH', - 'WEAPON_PISTOL', - 'WEAPON_PISTOL_MK2', - 'WEAPON_COMBATPISTOL', - 'WEAPON_APPISTOL', - 'WEAPON_PISTOL50', - 'WEAPON_REVOLVER', - 'WEAPON_SNSPISTOL', - 'WEAPON_HEAVYPISTOL', - 'WEAPON_VINTAGEPISTOL', - 'WEAPON_MICROSMG', - 'WEAPON_SMG', - 'WEAPON_ASSAULTSMG', - 'WEAPON_MINISMG', - 'WEAPON_MACHINEPISTOL', - 'WEAPON_COMBATPDW', - 'WEAPON_PUMPSHOTGUN', - 'WEAPON_SAWNOFFSHOTGUN', - 'WEAPON_ASSAULTSHOTGUN', - 'WEAPON_BULLPUPSHOTGUN', - 'WEAPON_HEAVYSHOTGUN', - 'WEAPON_ASSAULTRIFLE', - 'WEAPON_CARBINERIFLE', - 'WEAPON_ADVANCEDRIFLE', - 'WEAPON_SPECIALCARBINE', - 'WEAPON_BULLPUPRIFLE', - 'WEAPON_COMPACTRIFLE', - 'WEAPON_MG', - 'WEAPON_COMBATMG', - 'WEAPON_GUSENBERG', - 'WEAPON_SNIPERRIFLE', - 'WEAPON_HEAVYSNIPER', - 'WEAPON_MARKSMANRIFLE', - 'WEAPON_GRENADELAUNCHER', - 'WEAPON_RPG', - 'WEAPON_STINGER', - 'WEAPON_MINIGUN', - 'WEAPON_GRENADE', - 'WEAPON_STICKYBOMB', - 'WEAPON_SMOKEGRENADE', - 'WEAPON_BZGAS', - 'WEAPON_MOLOTOV', - 'WEAPON_DIGISCANNER', - 'WEAPON_FIREWORK', - 'WEAPON_MUSKET', - 'WEAPON_STUNGUN', - 'WEAPON_HOMINGLAUNCHER', - 'WEAPON_PROXMINE', - 'WEAPON_FLAREGUN', - 'WEAPON_MARKSMANPISTOL', - 'WEAPON_RAILGUN', - 'WEAPON_DBSHOTGUN', - 'WEAPON_AUTOSHOTGUN', - 'WEAPON_COMPACTLAUNCHER', - 'WEAPON_PIPEBOMB', - 'WEAPON_DOUBLEACTION', - 'WEAPON_SNOWBALL', - 'WEAPON_PISTOLXM3', - 'WEAPON_CANDYCANE', - 'WEAPON_CERAMICPISTOL', - 'WEAPON_NAVYREVOLVER', - 'WEAPON_GADGETPISTOL', - 'WEAPON_PISTOLXM3', - 'WEAPON_TECPISTOL', - 'WEAPON_HEAVYRIFLE', - 'WEAPON_MILITARYRIFLE', - 'WEAPON_TACTICALRIFLE', - 'WEAPON_SWEEPERSHOTGUN', - 'WEAPON_ASSAULTRIFLE_MK2', - 'WEAPON_BULLPUPRIFLE_MK2', - 'WEAPON_CARBINERIFLE_MK2', - 'WEAPON_COMBATMG_MK2', - 'WEAPON_HEAVYSNIPER_MK2', - 'WEAPON_KNUCKLE', - 'WEAPON_MARKSMANRIFLE_MK2', - 'WEAPON_PRECISIONRIFLE', - 'WEAPON_PETROLCAN', - 'WEAPON_PUMPSHOTGUN_MK2', - 'WEAPON_RAYCARBINE', - 'WEAPON_RAYMINIGUN', - 'WEAPON_RAYPISTOL', - 'WEAPON_REVOLVER_MK2', - 'WEAPON_SMG_MK2', - 'WEAPON_SNSPISTOL_MK2', - 'WEAPON_SPECIALCARBINE_MK2', - 'WEAPON_STONE_HATCHET' -} - -local holstered = true -local canFire = true -local currWeap = `WEAPON_UNARMED` -local currHolster = nil -local currHolsterTexture = nil -local wearingHolster = nil - -local function loadAnimDict(dict) - if HasAnimDictLoaded(dict) then return end - RequestAnimDict(dict) - while not HasAnimDictLoaded(dict) do - Wait(10) - end -end - -local function checkWeapon(newWeap) - for i = 1, #weapons do - if joaat(weapons[i]) == newWeap then - return true - end - end - return false -end - -local function isWeaponHolsterable(weap) - for i = 1, #Config.WeapDraw.weapons do - if joaat(Config.WeapDraw.weapons[i]) == weap then - return true - end - end - return false -end - -RegisterNetEvent('weapons:ResetHolster', function() - holstered = true - canFire = true - currWeap = `WEAPON_UNARMED` - currHolster = nil - currHolsterTexture = nil - wearingHolster = nil -end) - -RegisterNetEvent('weapons:client:DrawWeapon', function() - if GetResourceState('qb-inventory') == 'missing' then return end -- This part is only made to work with qb-inventory, other inventories might conflict - local sleep - local weaponCheck = 0 - while true do - local ped = PlayerPedId() - sleep = 250 - if DoesEntityExist(ped) and not IsEntityDead(ped) and not IsPedInParachuteFreeFall(ped) and not IsPedFalling(ped) and (GetPedParachuteState(ped) == -1 or GetPedParachuteState(ped) == 0) then - sleep = 0 - if currWeap ~= GetSelectedPedWeapon(ped) then - local pos = GetEntityCoords(ped, true) - local rot = GetEntityHeading(ped) - - local newWeap = GetSelectedPedWeapon(ped) - SetCurrentPedWeapon(ped, currWeap, true) - loadAnimDict('reaction@intimidation@1h') - loadAnimDict('reaction@intimidation@cop@unarmed') - loadAnimDict('rcmjosh4') - loadAnimDict('weapons@pistol@') - - local holsterVariant = GetPedDrawableVariation(ped, 8) - wearingHolster = false - for i = 1, #Config.WeapDraw.variants, 1 do - if holsterVariant == Config.WeapDraw.variants[i] then - wearingHolster = true - end - end - if checkWeapon(newWeap) then - if holstered then - if wearingHolster then - --TaskPlayAnim(ped, 'rcmjosh4', 'josh_leadout_cop2', 8.0, 2.0, -1, 48, 10, 0, 0, 0 ) - canFire = false - CeaseFire() - currHolster = GetPedDrawableVariation(ped, 7) - currHolsterTexture = GetPedTextureVariation(ped, 7) - TaskPlayAnimAdvanced(ped, 'rcmjosh4', 'josh_leadout_cop2', pos.x, pos.y, pos.z, 0, 0, rot, 3.0, 3.0, -1, 50, 0, 0, 0) - Wait(300) - SetCurrentPedWeapon(ped, newWeap, true) - - if isWeaponHolsterable(newWeap) then - SetPedComponentVariation(ped, 7, currHolster == 8 and 2 or currHolster == 1 and 3 or currHolster == 6 and 5, currHolsterTexture, 2) - end - currWeap = newWeap - Wait(300) - ClearPedTasks(ped) - holstered = false - canFire = true - else - canFire = false - CeaseFire() - TaskPlayAnimAdvanced(ped, 'reaction@intimidation@1h', 'intro', pos.x, pos.y, pos.z, 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0) - Wait(1000) - SetCurrentPedWeapon(ped, newWeap, true) - currWeap = newWeap - Wait(1400) - ClearPedTasks(ped) - holstered = false - canFire = true - end - elseif newWeap ~= currWeap and checkWeapon(currWeap) then - if wearingHolster then - canFire = false - CeaseFire() - - TaskPlayAnimAdvanced(ped, 'reaction@intimidation@cop@unarmed', 'intro', pos.x, pos.y, pos.z, 0, 0, rot, 3.0, 3.0, -1, 50, 0, 0, 0) - Wait(500) - - if isWeaponHolsterable(currWeap) then - SetPedComponentVariation(ped, 7, currHolster, currHolsterTexture, 2) - end - - SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true) - currHolster = GetPedDrawableVariation(ped, 7) - currHolsterTexture = GetPedTextureVariation(ped, 7) - - TaskPlayAnimAdvanced(ped, 'rcmjosh4', 'josh_leadout_cop2', pos.x, pos.y, pos.z, 0, 0, rot, 3.0, 3.0, -1, 50, 0, 0, 0) - Wait(300) - SetCurrentPedWeapon(ped, newWeap, true) - - if isWeaponHolsterable(newWeap) then - SetPedComponentVariation(ped, 7, currHolster == 8 and 2 or currHolster == 1 and 3 or currHolster == 6 and 5, currHolsterTexture, 2) - end - - Wait(500) - currWeap = newWeap - ClearPedTasks(ped) - holstered = false - canFire = true - else - canFire = false - CeaseFire() - TaskPlayAnimAdvanced(ped, 'reaction@intimidation@1h', 'outro', pos.x, pos.y, pos.z, 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0) - Wait(1600) - SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true) - TaskPlayAnimAdvanced(ped, 'reaction@intimidation@1h', 'intro', pos.x, pos.y, pos.z, 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0) - Wait(1000) - SetCurrentPedWeapon(ped, newWeap, true) - currWeap = newWeap - Wait(1400) - ClearPedTasks(ped) - holstered = false - canFire = true - end - else - if wearingHolster then - SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true) - currHolster = GetPedDrawableVariation(ped, 7) - currHolsterTexture = GetPedTextureVariation(ped, 7) - TaskPlayAnimAdvanced(ped, 'rcmjosh4', 'josh_leadout_cop2', pos.x, pos.y, pos.z, 0, 0, rot, 3.0, 3.0, -1, 50, 0, 0, 0) - Wait(300) - SetCurrentPedWeapon(ped, newWeap, true) - - if isWeaponHolsterable(newWeap) then - SetPedComponentVariation(ped, 7, currHolster == 8 and 2 or currHolster == 1 and 3 or currHolster == 6 and 5, currHolsterTexture, 2) - end - - currWeap = newWeap - Wait(300) - ClearPedTasks(ped) - holstered = false - canFire = true - else - SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true) - TaskPlayAnimAdvanced(ped, 'reaction@intimidation@1h', 'intro', pos.x, pos.y, pos.z, 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0) - Wait(1000) - SetCurrentPedWeapon(ped, newWeap, true) - currWeap = newWeap - Wait(1400) - ClearPedTasks(ped) - holstered = false - canFire = true - end - end - else - if not holstered and checkWeapon(currWeap) then - if wearingHolster then - canFire = false - CeaseFire() - TaskPlayAnimAdvanced(ped, 'reaction@intimidation@cop@unarmed', 'intro', pos.x, pos.y, pos.z, 0, 0, rot, 3.0, 3.0, -1, 50, 0, 0, 0) - Wait(500) - - if isWeaponHolsterable(currWeap) then - SetPedComponentVariation(ped, 7, currHolster, currHolsterTexture, 2) - end - - SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true) - ClearPedTasks(ped) - SetCurrentPedWeapon(ped, newWeap, true) - holstered = true - canFire = true - currWeap = newWeap - else - canFire = false - CeaseFire() - TaskPlayAnimAdvanced(ped, 'reaction@intimidation@1h', 'outro', pos.x, pos.y, pos.z, 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0) - Wait(1400) - SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true) - ClearPedTasks(ped) - SetCurrentPedWeapon(ped, newWeap, true) - holstered = true - canFire = true - currWeap = newWeap - end - else - SetCurrentPedWeapon(ped, newWeap, true) - holstered = false - canFire = true - currWeap = newWeap - end - end - end - end - Wait(sleep) - if currWeap == nil or currWeap == `WEAPON_UNARMED` then - weaponCheck += 1 - if weaponCheck == 2 then - break - end - end - end -end) - -function CeaseFire() - CreateThread(function() - if GetResourceState('qb-inventory') == 'missing' then return end -- This part is only made to work with qb-inventory, other inventories might conflict - while not canFire do - DisableControlAction(0, 25, true) - DisablePlayerFiring(PlayerId(), true) - Wait(0) - end - end) -end diff --git a/config.lua b/config.lua index c2ab61d4..f204df42 100644 --- a/config.lua +++ b/config.lua @@ -227,22 +227,6 @@ Config.BlacklistedPeds = { [`s_m_y_hwaycop_01`] = true } -Config.WeapDraw = { - variants = { 130, 122, 3, 6, 8 }, - weapons = { - --'WEAPON_STUNGUN', - 'WEAPON_PISTOL', - 'WEAPON_PISTOL_MK2', - 'WEAPON_COMBATPISTOL', - 'WEAPON_APPISTOL', - 'WEAPON_PISTOL50', - 'WEAPON_REVOLVER', - 'WEAPON_SNSPISTOL', - 'WEAPON_HEAVYPISTOL', - 'WEAPON_VINTAGEPISTOL' - } -} - Config.Objects = { -- for object removal { coords = vector3(266.09, -349.35, 44.74), heading = 0, length = 200, width = 200, model = 'prop_sec_barier_02b' }, { coords = vector3(285.28, -355.78, 45.13), heading = 0, length = 200, width = 200, model = 'prop_sec_barier_02a' }, diff --git a/server/consumables.lua b/server/consumables.lua index 423936cb..a099df68 100644 --- a/server/consumables.lua +++ b/server/consumables.lua @@ -12,7 +12,7 @@ end for k, _ in pairs(Config.Consumables.eat) do QBCore.Functions.CreateUseableItem(k, function(source, item) local Player = QBCore.Functions.GetPlayer(source) - if not Player.Functions.RemoveItem(item.name, 1, item.slot) then return end + if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:consumables:eat') then return end TriggerClientEvent('consumables:client:Eat', source, item.name) end) end @@ -21,7 +21,7 @@ end for k, _ in pairs(Config.Consumables.drink) do QBCore.Functions.CreateUseableItem(k, function(source, item) local Player = QBCore.Functions.GetPlayer(source) - if not Player.Functions.RemoveItem(item.name, 1, item.slot) then return end + if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:consumables:drink') then return end TriggerClientEvent('consumables:client:Drink', source, item.name) end) end @@ -30,7 +30,7 @@ end for k, _ in pairs(Config.Consumables.custom) do QBCore.Functions.CreateUseableItem(k, function(source, item) local Player = QBCore.Functions.GetPlayer(source) - if not Player.Functions.RemoveItem(item.name, 1, item.slot) then return end + if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:consumables:custom') then return end TriggerClientEvent('consumables:client:Custom', source, item.name) end) end @@ -38,7 +38,7 @@ end local function createItem(name, type) QBCore.Functions.CreateUseableItem(name, function(source, item) local Player = QBCore.Functions.GetPlayer(source) - if not Player.Functions.RemoveItem(item.name, 1, item.slot) then return end + if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:consumables:createItem') then return end TriggerClientEvent('consumables:client:' .. type, source, item.name) end) end @@ -46,7 +46,7 @@ end QBCore.Functions.CreateUseableItem('joint', function(source, item) local Player = QBCore.Functions.GetPlayer(source) - if not Player.Functions.RemoveItem(item.name, 1, item.slot) then return end + if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:joint') then return end TriggerClientEvent('consumables:client:UseJoint', source) end) @@ -95,7 +95,7 @@ end) QBCore.Functions.CreateUseableItem('parachute', function(source, item) local Player = QBCore.Functions.GetPlayer(source) - if not Player.Functions.RemoveItem(item.name, 1, item.slot) then return end + if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:parachute') then return end TriggerClientEvent('consumables:client:UseParachute', source) end) @@ -103,12 +103,6 @@ QBCore.Commands.Add('resetparachute', 'Resets Parachute', {}, false, function(so TriggerClientEvent('consumables:client:ResetParachute', source) end) -RegisterNetEvent('qb-smallpenis:server:AddParachute', function() - local Player = QBCore.Functions.GetPlayer(source) - if not Player then return end - Player.Functions.AddItem('parachute', 1) -end) - ----------- / Firework for _, v in pairs(Config.Fireworks.items) do @@ -130,17 +124,23 @@ end) -- Events for adding and removing specific items to fix some exploits +RegisterNetEvent('consumables:server:AddParachute', function() + local Player = QBCore.Functions.GetPlayer(source) + if not Player then return end + exports['qb-inventory']:AddItem(source, 'parachute', 1, false, false, 'consumables:server:AddParachute') +end) + RegisterNetEvent('consumables:server:resetArmor', function() local Player = QBCore.Functions.GetPlayer(source) if not Player then return end - Player.Functions.AddItem('heavyarmor', 1) + exports['qb-inventory']:AddItem(source, 'heavyarmor', 1, false, false, 'consumables:server:resetArmor') end) RegisterNetEvent('consumables:server:useHeavyArmor', function() local Player = QBCore.Functions.GetPlayer(source) if not Player then return end - if not Player.Functions.RemoveItem('heavyarmor', 1) then return end - TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['heavyarmor'], 'remove') + if not exports['qb-inventory']:RemoveItem(source, 'heavyarmor', 1, false, 'consumables:server:useHeavyArmor') then return end + TriggerClientEvent('qb-inventory:client:ItemBox', source, QBCore.Shared.Items['heavyarmor'], 'remove') TriggerClientEvent('hospital:server:SetArmor', source, 100) SetPedArmour(GetPlayerPed(source), 100) end) @@ -148,8 +148,8 @@ end) RegisterNetEvent('consumables:server:useArmor', function() local Player = QBCore.Functions.GetPlayer(source) if not Player then return end - if not Player.Functions.RemoveItem('armor', 1) then return end - TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['armor'], 'remove') + if not exports['qb-inventory']:RemoveItem(source, 'armor', 1, false, 'consumables:server:useArmor') then return end + TriggerClientEvent('qb-inventory:client:ItemBox', source, QBCore.Shared.Items['armor'], 'remove') TriggerClientEvent('hospital:server:SetArmor', source, 75) SetPedArmour(GetPlayerPed(source), 75) end) @@ -157,31 +157,31 @@ end) RegisterNetEvent('consumables:server:useMeth', function() local Player = QBCore.Functions.GetPlayer(source) if not Player then return end - Player.Functions.RemoveItem('meth', 1) + exports['qb-inventory']:RemoveItem(source, 'meth', 1, false, 'consumables:server:useMeth') end) RegisterNetEvent('consumables:server:useOxy', function() local Player = QBCore.Functions.GetPlayer(source) if not Player then return end - Player.Functions.RemoveItem('oxy', 1) + exports['qb-inventory']:RemoveItem(source, 'oxy', 1, false, 'consumables:server:useOxy') end) RegisterNetEvent('consumables:server:useXTCBaggy', function() local Player = QBCore.Functions.GetPlayer(source) if not Player then return end - Player.Functions.RemoveItem('xtcbaggy', 1) + exports['qb-inventory']:RemoveItem(source, 'xtcbaggy', 1, false, 'consumables:server:useXTCBaggy') end) RegisterNetEvent('consumables:server:useCrackBaggy', function() local Player = QBCore.Functions.GetPlayer(source) if not Player then return end - Player.Functions.RemoveItem('crack_baggy', 1) + exports['qb-inventory']:RemoveItem(source, 'crack_baggy', 1, false, 'consumables:server:useCrackBaggy') end) RegisterNetEvent('consumables:server:useCokeBaggy', function() local Player = QBCore.Functions.GetPlayer(source) if not Player then return end - Player.Functions.RemoveItem('cokebaggy', 1) + exports['qb-inventory']:RemoveItem(source, 'cokebaggy', 1, false, 'consumables:server:useCokeBaggy') end) RegisterNetEvent('consumables:server:drinkAlcohol', function(item) @@ -197,7 +197,7 @@ RegisterNetEvent('consumables:server:drinkAlcohol', function(item) end if not foundItem then return end - Player.Functions.RemoveItem(foundItem, 1) + exports['qb-inventory']:RemoveItem(source, foundItem, 1, false, 'consumables:server:drinkAlcohol') end) RegisterNetEvent('consumables:server:UseFirework', function(item) @@ -213,7 +213,7 @@ RegisterNetEvent('consumables:server:UseFirework', function(item) end if not foundItem then return end - Player.Functions.RemoveItem(foundItem, 1) + exports['qb-inventory']:RemoveItem(source, foundItem, 1, false, 'consumables:server:UseFirework') end) RegisterNetEvent('consumables:server:addThirst', function(amount) diff --git a/server/main.lua b/server/main.lua index 2e3ccd4c..ec3097ce 100644 --- a/server/main.lua +++ b/server/main.lua @@ -15,15 +15,13 @@ end) RegisterNetEvent('equip:harness', function(item) local src = source local Player = QBCore.Functions.GetPlayer(src) - if not Player then return end - if not Player.PlayerData.items[item.slot].info.uses then Player.PlayerData.items[item.slot].info.uses = Config.HarnessUses - 1 Player.Functions.SetInventory(Player.PlayerData.items) elseif Player.PlayerData.items[item.slot].info.uses == 1 then - TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['harness'], 'remove') - Player.Functions.RemoveItem('harness', 1) + exports['qb-inventory']:RemoveItem(src, 'harness', 1, false, 'equip:harness') + TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items['harness'], 'remove') else Player.PlayerData.items[item.slot].info.uses -= 1 Player.Functions.SetInventory(Player.PlayerData.items) @@ -33,11 +31,9 @@ end) RegisterNetEvent('seatbelt:DoHarnessDamage', function(hp, data) local src = source local Player = QBCore.Functions.GetPlayer(src) - if not Player then return end - if hp == 0 then - Player.Functions.RemoveItem('harness', 1, data.slot) + exports['qb-inventory']:RemoveItem(src, 'harness', 1, data.slot, 'seatbelt:DoHarnessDamage') else Player.PlayerData.items[data.slot].info.uses -= 1 Player.Functions.SetInventory(Player.PlayerData.items)