From 9cb534c320340b35fb3b86d173ce56327c178524 Mon Sep 17 00:00:00 2001 From: Chris Newman <150890840+ChrisNewmanDev@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:51:33 +0200 Subject: [PATCH] Added Police Required For Weedruns Added Police Required For Weedruns, current config is set to 2 police required, change as you like. --- client/cl_weedrun.lua | 14 +++++++++----- fxmanifest.lua | 2 +- shared/locales.lua | 1 + shared/sh_shared.lua | 1 + 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/client/cl_weedrun.lua b/client/cl_weedrun.lua index c5a12db..189d952 100644 --- a/client/cl_weedrun.lua +++ b/client/cl_weedrun.lua @@ -10,6 +10,7 @@ local hasDropOff = false local dropOffArea local deliveryPed local madeDeal = false +CurrentCops = 0 --- Functions @@ -215,11 +216,14 @@ RegisterNetEvent('ps-weedplanting:client:PackageGoodsReceived', function() end) RegisterNetEvent('ps-weedplanting:client:ClockIn', function() - if delivering then return end - delivering = true - TriggerEvent('qb-phone:client:CustomNotification', _U('weedrun_delivery_title'), _U('weedrun_delivery_waitfornew'), 'fas fa-cannabis', '#00FF00', 8000) - Wait(math.random(Shared.DeliveryWaitTime[1], Shared.DeliveryWaitTime[2])) - createNewDropOff() + if CurrentCops >= Shared.CopsRequired then + if delivering then return end + delivering = true + TriggerEvent('qb-phone:client:CustomNotification', _U('weedrun_delivery_title'), _U('weedrun_delivery_waitfornew'), 'fas fa-cannabis', '#00FF00', 8000) + Wait(math.random(Shared.DeliveryWaitTime[1], Shared.DeliveryWaitTime[2])) + createNewDropOff() + else + QBCore.Functions.Notify(_U('not_enough_police'), 'error', 2500) end) RegisterNetEvent('ps-weedplanting:client:ClockOut', function() diff --git a/fxmanifest.lua b/fxmanifest.lua index c56a189..70f79b6 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -2,7 +2,7 @@ fx_version 'cerulean' game 'gta5' lua54 'yes' -version '1.6.1' +version '1.6.2' description 'Project Sloth Weedplanting script' author 'Lionh34rt' diff --git a/shared/locales.lua b/shared/locales.lua index 6125699..98221ec 100644 --- a/shared/locales.lua +++ b/shared/locales.lua @@ -59,6 +59,7 @@ local Locales = { ['enter_weedlab'] = 'Enter Lab', ['exit_weedlab'] = 'Exit Lab', ['police_burn'] = 'Burn the plant and remove pot.', + ['not_enough_police'] = 'There is not enough police', } function _U(entry) diff --git a/shared/sh_shared.lua b/shared/sh_shared.lua index cadb1f4..291cd6d 100644 --- a/shared/sh_shared.lua +++ b/shared/sh_shared.lua @@ -18,6 +18,7 @@ Shared.WeedItem = 'weedplant_weed' Shared.PackedWeedItem = 'weedplant_packedweed' Shared.SusPackageItem = 'weedplant_package' Shared.LabkeyItem = 'keya' -- Key required to enter the weed lab +Shared.CopsRequired = 2 --how many police is required to start and continue weed runs. --- Weed Processing | Weed-Lab Shared.WeedLab = {