- added multi location for coke fancy anims

This commit is contained in:
Mustache Dom committed 2025-06-30 23:24:57 -07:00
1 parent 7422c9d57b
commit 9e84111da3
7 files changed
+109 -114

No files matched your search

+23 -31
View File
@@ -50,7 +50,11 @@ end)
RegisterServerEvent('md-drugs:server:makepowder', function(num)
local src = source
if not checkLoc(src, 'MakePowder', num) then return end
ps.debug(#(GetEntityCoords(GetPlayerPed(src)) - GlobalState.MDDrugsLocs.MakePowder[num].loc))
if not ps.checkDistance(src, GlobalState.MDDrugsLocs.MakePowder[num].loc, 3.5) then
Notifys(src, 'You are not in the correct location', 'error')
return
end
local tier = 'tier1'
if Config.TierSystem then
local coke = getRep(src, 'coke')
@@ -65,55 +69,44 @@ end)
RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
local src = source
local Player = getPlayer(src)
local count = 0
if Config.FancyCokeAnims then
if not checkLoc(src, 'singleSpot', 'cutcoke') then return end
else
if not checkLoc(src, 'CuttingCoke', num) then return end
local tier = 'tier1'
if not ps.checkDistance(src, GlobalState.MDDrugsLocs.CuttingCoke[num].loc, 2.5) then
Notifys(src, 'You are not in the correct location', 'error')
return
end
if Config.TierSystem then
local tier = 'tier1'
local cokeTiers = {
{item = 'coke', tier = 'tier1', log = ' Cut Coke'},
{item = 'cokestagetwo', tier = 'tier2', log = ' Cut Coke tier 2'},
{item = 'cokestagethree', tier = 'tier3', log = ' Cut Coke tier 3'}
}
for _, v in ipairs(cokeTiers) do
if count >= 1 then break end
if Player.Functions.GetItemByName(v.item) then
if ps.hasItem(src, v.item) then
tier = v.tier
count = count + 1
break
end
end
if not GetRecipe(src, 'cocaine', 'cutcoke', tier) then return end
else
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end
end
if not GetRecipe(src, 'cocaine', 'cutcoke', tier) then return end
end)
RegisterServerEvent('md-drugs:server:bagcoke', function(num)
local src = source
local Player = getPlayer(src)
local count = 0
local tier = 'tier1'
if Config.FancyCokeAnims then
if not checkLoc(src, 'singleSpot', 'bagcokepowder') then return end
else
if not checkLoc(src, 'BaggingCoke', num) then return end
if not ps.checkDistance(src, GlobalState.MDDrugsLocs.BaggingCoke[num].loc, 2.5) then
Notifys(src, 'You are not in the correct location', 'error')
return
end
if Config.TierSystem then
local coke = getRep(src, 'coke')
local cokeTiers = {
{item = 'loosecoke', tier = 'tier1', log = ' Bagged Coke'},
{item = 'loosecokestagetwo', tier = 'tier2', log = ' Bagged Coke tier 2'},
{item = 'loosecokestagethree', tier = 'tier3', log = ' Bagged Coke tier 3'}
}
for _, v in ipairs(cokeTiers) do
if Player.Functions.GetItemByName(v.item) then
if count >= 1 then break end
count = count + 1
tier = v.tier
if ps.hasItem(src, v.item) then
tier = v.tier
break
end
end
if not GetRecipe(src, 'cocaine', 'bagcoke', tier) then return end
@@ -125,16 +118,15 @@ end)
local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3}
for k, v in pairs (cokecut) do
CUI(k, function(source, item)
ps.createUseable(k, function(source, item)
local src = source
local Player = getPlayer(src)
if not Player.Functions.GetItemByName('bakingsoda') then Notifys(src, 'You Need Baking Soda For this', 'error') return end
if Player.Functions.GetItemByName(item.name) then
if not Itemcheck(src, 'bakingsoda', 1) then return end
if not ps.hasItem(src, 'bakingsoda') then ps.notify(src, 'You Need Baking Soda For this', 'error') return end
if ps.hasItem(src,item.name) then
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting It Further')
if not check then return end
if RemoveItem(src, k, 1) and RemoveItem(src, 'bakingsoda', 1) then
AddItem(src, 'loosecoke', v)
if ps.removeItem(src, k, 1) and ps.removeItem(src, 'bakingsoda', 1) then
ps.addItem(src, 'loosecoke', v)
end
end
end)