check
This commit is contained in:
1 parent
c6d8556c12
commit
bcdf71b17a
21 files changed
+394
-403
No files matched your search
+47
-23
@@ -1,9 +1,25 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local cokeplants = {
|
||||
{ location = vector3(1474.25, -2643.87, 42.88), heading = 334.49, model = "prop_plant_01a" },
|
||||
{ location = vector3(1472.35, -2649.3, 41.87), heading = 329.56, model = "prop_plant_01a" },
|
||||
{ location = vector3(1475.7, -2652.9, 40.8), heading = 25.16, model = "prop_plant_01a" },
|
||||
{ location = vector3(1481.0, -2654.99, 39.86), heading = 21.52, model = "prop_plant_01a" },
|
||||
{ location = vector3(1480.9, -2660.63, 38.68), heading = 202.97, model = "prop_plant_01a" },
|
||||
{ location = vector3(1477.18, -2666.53, 38.19), heading = 202.97, model = "prop_plant_01a" },
|
||||
{ location = vector3(1477.58, -2670.82, 37.73), heading = 202.97, model = "prop_plant_01a" },
|
||||
{ location = vector3(1476.56, -2675.82, 37.46), heading = 202.97, model = "prop_plant_01a" },
|
||||
{ location = vector3(1474.8, -2680.19, 37.03), heading = 202.97, model = "prop_plant_01a" },
|
||||
{ location = vector3(1471.52, -2685.0, 36.82), heading = 202.97, model = "prop_plant_01a" },
|
||||
{ location = vector3(1462.82, -2676.58, 38.83), heading = 202.97, model = "prop_plant_01a" },
|
||||
{ location = vector3(1461.31, -2667.74, 39.67), heading = 202.97, model = "prop_plant_01a" },
|
||||
{ location = vector3(1456.3, -2647.61, 43.39), heading = 202.97, model = "prop_plant_01a" },
|
||||
{ location = vector3(1453.65, -2641.56, 45.0), heading = 202.97, model = "prop_plant_01a" },
|
||||
}
|
||||
|
||||
GlobalState.CocaPlant = Config.CocaPlant
|
||||
GlobalState.CocaPlant = cokeplants
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
for _, v in pairs(Config.CocaPlant) do
|
||||
for _, v in pairs(cokeplants) do
|
||||
v.taken = false
|
||||
end
|
||||
end)
|
||||
@@ -11,31 +27,31 @@ end)
|
||||
function CaneCooldown(loc)
|
||||
CreateThread(function()
|
||||
Wait(Config.respawnTime * 1000)
|
||||
Config.CocaPlant[loc].taken = false
|
||||
GlobalState.CocaPlant = Config.CocaPlant
|
||||
cokeplants[loc].taken = false
|
||||
GlobalState.CocaPlant = cokeplants
|
||||
Wait(1000)
|
||||
TriggerClientEvent('coke:respawnCane', -1, loc)
|
||||
Log('Coca Plant Respawned At ' .. Config.CocaPlant[loc].location, 'coke')
|
||||
Log('Coca Plant Respawned At ' .. cokeplants[loc].location, 'coke')
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent("coke:pickupCane")
|
||||
AddEventHandler("coke:pickupCane", function(loc)
|
||||
local src = source
|
||||
if CheckDist(src, Config.CocaPlant[loc].location) then return end
|
||||
if not Config.CocaPlant[loc].taken then
|
||||
Config.CocaPlant[loc].taken = true
|
||||
GlobalState.CocaPlant = Config.CocaPlant
|
||||
--if CheckDist(src, Config.CocaPlant[loc].location) then return end
|
||||
if not cokeplants[loc].taken then
|
||||
cokeplants[loc].taken = true
|
||||
GlobalState.CocaPlant = cokeplants
|
||||
TriggerClientEvent("coke:removeCane", -1, loc)
|
||||
CaneCooldown(loc)
|
||||
AddItem(src, 'coca_leaf', 1)
|
||||
Log(GetName(src) .. ' Picked A Coca Leaf With a distance of ' .. dist(src, Config.CocaPlant[loc].location) .. ' vectors', 'coke')
|
||||
--Log(GetName(src) .. ' Picked A Coca Leaf With a distance of ' .. dist(src, Config.CocaPlant[loc].location) .. ' vectors', 'coke')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:makepowder', function(num)
|
||||
local src = source
|
||||
if CheckDist(src, Config.MakePowder[num]['loc']) then return end
|
||||
if not checkLoc(src, 'MakePowder', num) then return end
|
||||
local tier = 'tier1'
|
||||
local logMessage = ' Made Raw Coke'
|
||||
if Config.TierSystem then
|
||||
@@ -52,11 +68,16 @@ RegisterServerEvent('md-drugs:server:makepowder', function(num)
|
||||
Log(GetName(src) .. logMessage .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:cutcokeone', function()
|
||||
RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
local count = 0
|
||||
if Config.TierSystem then
|
||||
if Config.FancyCokeAnims then
|
||||
if not checkLoc(src, 'singleSpot', 'cutcoke') then return end
|
||||
else
|
||||
if not checkLoc(src, 'CuttingCoke', num) then return end
|
||||
end
|
||||
if Config.TierSystem then
|
||||
local tier = ''
|
||||
local cokeTiers = {
|
||||
{item = 'coke', tier = 'tier1', log = ' Cut Coke'},
|
||||
@@ -65,12 +86,11 @@ RegisterServerEvent('md-drugs:server:cutcokeone', function()
|
||||
}
|
||||
for _, v in ipairs(cokeTiers) do
|
||||
if count >= 1 then break end
|
||||
if Player.Functions.GetItemByName(v.item) then
|
||||
tier = v.tier
|
||||
if Player.Functions.GetItemByName(v.item) then
|
||||
tier = v.tier
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
Notifys(src, Lang.Coke.nocutcoke, "error")
|
||||
if not GetRecipe(src, 'cocaine', 'cutcoke', tier) then return end
|
||||
else
|
||||
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end
|
||||
@@ -78,11 +98,16 @@ RegisterServerEvent('md-drugs:server:cutcokeone', function()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:bagcoke', function()
|
||||
RegisterServerEvent('md-drugs:server:bagcoke', function(num)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
local count = 0
|
||||
local count = 0
|
||||
local tier = ''
|
||||
if Config.FancyCokeAnims then
|
||||
if not checkLoc(src, 'singleSpot', 'bagcokepowder') then return end
|
||||
else
|
||||
if not checkLoc(src, 'BaggingCoke', num) then return end
|
||||
end
|
||||
if Config.TierSystem then
|
||||
local coke = getRep(src, 'coke')
|
||||
local cokeTiers = {
|
||||
@@ -92,14 +117,13 @@ RegisterServerEvent('md-drugs:server:bagcoke', function()
|
||||
}
|
||||
for _, v in ipairs(cokeTiers) do
|
||||
if Player.Functions.GetItemByName(v.item) then
|
||||
if count >= 1 then break end
|
||||
count = count + 1
|
||||
if count >= 1 then break end
|
||||
count = count + 1
|
||||
tier = v.tier
|
||||
end
|
||||
end
|
||||
if not GetRecipe(src, 'cocaine', 'bagcoke', tier) then return end
|
||||
end
|
||||
if not GetRecipe(src, 'cocaine', 'bagcoke', tier) then return end
|
||||
AddRep(src, 'coke')
|
||||
Notifys(src, Lang.Coke.nobagcoke, "error")
|
||||
else
|
||||
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end
|
||||
Log(GetName(src) .. ' Bagged Coke', 'coke')
|
||||
|
||||
Reference in new issue
Block a user