added sv function to check cops and threw a cop check in wholesale, made it so you can only buy heroin table if none are in your inventory
This commit is contained in:
1 parent
bf1471e238
commit
a07118d0cb
4 files changed
+17
-1
No files matched your search
@@ -318,6 +318,17 @@ function sortTab(tbl, type)
|
||||
end)
|
||||
end
|
||||
|
||||
function getCops()
|
||||
local amount = 0
|
||||
local players = QBCore.Functions.GetQBPlayers()
|
||||
for k, v in pairs(players) do
|
||||
if v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then
|
||||
amount = amount + 1
|
||||
end
|
||||
end
|
||||
return amount
|
||||
end
|
||||
|
||||
lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args)
|
||||
local amount = 0
|
||||
local players = QBCore.Functions.GetQBPlayers()
|
||||
|
||||
@@ -102,6 +102,8 @@ RegisterServerEvent('md-drugs:server:getheroinlabkit', function()
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if not checkLoc(source, 'singleSpot', 'buyheroinlabkit') then return end
|
||||
local has = Player.Functions.GetItemByName('heroinlabkit')
|
||||
if has then Notifys(src, 'You Already Have A Heroin Lab Kit', 'error') return end
|
||||
if Player.Functions.RemoveMoney('cash', prices.heroinlabkitprice) then
|
||||
AddItem(src, 'heroinlabkit', 1)
|
||||
else
|
||||
|
||||
@@ -6,6 +6,7 @@ local heroin = {'heroin_ready', 'heroin_readystagetwo', 'heroin_readystagethree'
|
||||
local xtc = {"white_playboys", "white_playboys2", "white_playboys3", "white_playboys4", "blue_playboys", "blue_playboys2", "blue_playboys3", "blue_playboys4", "red_playboys", "red_playboys2", "red_playboys3", "red_playboys4", "orange_playboys", "orange_playboy2s", "orange_playboys3", "orange_playboys4", "white_aliens", "white_aliens2", "white_aliens3", "white_aliens4", "blue_aliens", "blue_aliens2", "blue_aliens3", "blue_aliens4", "red_aliens", "red_aliens3", "red_aliens2", "red_aliens4", "orange_aliens", "orange_aliens2", "orange_aliens3", "orange_aliens4", "white_pl", "white_pl2", "white_pl3", "white_pl4", "blue_pl", "blue_pl2", "blue_pl3", "blue_pl4", "red_pl", "red_pl2", "red_pl3", "red_pl4", "orange_pl", "orange_pl2", "orange_pl3", "orange_pl4", "white_trolls", "white_trolls2", "white_trolls3", "white_trolls4", "blue_trolls", "blue_trolls2", "blue_trolls3", "blue_trolls4", "red_trolls", "red_trolls2", "red_trolls3", "red_trolls4", "orange_trolls", "orange_trolls2", "orange_trolls3", "orange_trolls4", "white_cats2", "white_cats3", "white_cats4", "white_cats", "blue_cats", "blue_cats3", "blue_cats2", "blue_cats4", "red_cats", "red_cats2", "red_cats3", "red_cats4", "orange_cats", "orange_cats2", "orange_cats3", "orange_cats4" }
|
||||
local burners = {cokeburner = coke, crackburner = crack, lsdburner = lsd, heroinburner = heroin, xtcburner = xtc}
|
||||
local active = {}
|
||||
|
||||
local Price = {
|
||||
coke = {min = 20, max = 60},
|
||||
crack = {min = 20, max = 60},
|
||||
@@ -13,10 +14,12 @@ local Price = {
|
||||
heroin = {min = 20, max = 60},
|
||||
xtc = {min = 20, max = 60},
|
||||
}
|
||||
|
||||
for k, v in pairs (burners) do
|
||||
QBCore.Functions.CreateUseableItem(k, function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if getCops() < Config.PoliceCount then return Notifys(src, 'Nobody Answered, Try Again Later', 'error') end
|
||||
for m, d in pairs (active) do
|
||||
if d.cid == Player.PlayerData.citizenid then
|
||||
return Notifys(src, 'You Already Have A Delivery To Make', 'error' )
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ Config.MethHeist = false
|
||||
Config.SuccessfulChance = 90 --- this is the chance of a Success wholesale 1-100
|
||||
Config.AlertPoliceWholesale = 90 -- 1-100 of how often it will alert police
|
||||
Config.WholesaleTimeout = 600 -- time in seconds to get to the location
|
||||
Config.PoliceCount = 0 -- Amount of police required
|
||||
Config.PoliceCount = 2 -- Amount of police required
|
||||
Config.PoliceAlertOxy = 90 -- This is a % out of 100 to alert police
|
||||
|
||||
----------------------------------- TierSystem levels ** ONLY IN USE IF CONFIG.TIERSYTEM IS TRUE
|
||||
|
||||
Reference in new issue
Block a user