- 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
+107 -112

No files matched your search

+4 -6
View File
@@ -159,13 +159,12 @@ function Tray()
AttachEntityToEntity(trays, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), 0.01,-0.2, -0.2, 20.0, 0.0, 0.0, true, true, false, true, 1, true)
end
function CutCoke()
function CutCoke(coords, offset, rotation)
local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter"
lib.requestAnimDict(animDict, 500)
local animDuration = GetAnimDuration(animDict, animName) * 1000
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local scenePos, sceneRot = vector3(1090.37+.9, -3193.61-1.68, -39.60), vector3(0.0, 0.0, 0.00)
local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation
local scenes = {
{
{ hash = "bkr_prop_coke_bakingsoda_o", animName = "coke_cut_v5_bakingsoda"},
@@ -214,14 +213,13 @@ CreateThread(function()
BikerCocaine.Details.Enable({BikerCocaine.Details.cokeBasic1, BikerCocaine.Details.cokeBasic2, BikerCocaine.Details.cokeBasic3}, true)
end)
function BagCoke()
function BagCoke(coords, offset, rotation)
local ver = ""
local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01"
lib.requestAnimDict(animDict, 500)
local animDuration = GetAnimDuration(animDict, animName) * 1000
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local scenePos, sceneRot = vector3(1090.62+4.3, -3196.2+3, -38.99-1), vector3(360.0, 360.0, 180.08)
local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation
local scenes = {
{
{ hash = "bkr_prop_coke_cutblock_01", animName = "break_weigh_"..ver.."box01"},
+66 -43
View File
@@ -14,7 +14,15 @@ RegisterNetEvent('coke:respawnCane', function(loc)
if not CocaPlant[loc] then
CocaPlant[loc] = CreateObject(hash, v.location, false, true, true)
Freeze(CocaPlant[loc], true, v.heading)
AddSingleModel(CocaPlant[loc], {icon = "fa-solid fa-seedling", label = Lang.targets.coke.pick, action = function() if not pick(loc) then return end end}, loc)
ps.entityTarget(CocaPlant[loc], {
{
icon = "fa-solid fa-seedling",
label = Lang.targets.coke.pick,
action = function()
if not pick(loc) then return end
end
}
})
end
end)
@@ -30,7 +38,15 @@ RegisterNetEvent("coke:init", function()
if not v.taken then
CocaPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
Freeze(CocaPlant[k], true, v.heading)
AddSingleModel(CocaPlant[k], {icon = "fa-solid fa-seedling", label = Lang.targets.coke.pick, action = function() if not pick(k) then return end end}, k)
ps.entityTarget(CocaPlant[k], {
{
icon = "fa-solid fa-seedling",
label = Lang.targets.coke.pick,
action = function()
if not pick(k) then return end
end
}
})
end
end
end)
@@ -46,45 +62,52 @@ AddEventHandler('onResourceStop', function(resourceName)
end
end)
RegisterNetEvent("md-drugs:client:makepowder", function(data)
if not ItemCheck('coca_leaf') then return end
if not progressbar(Lang.Coke.makepow, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makepowder", data.data)
end)
for k, v in pairs (GlobalState.MDDrugsLocs.MakePowder) do
ps.boxTarget('cocaplant'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, {
{
label = Lang.targets.coke.pick,
icon = 'fa-solid fa-seedling',
action = function()
if not ps.hasItem('coca_leaf') then return end
if not ps.progressbar(Lang.Coke.makepow, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makepowder", k)
end,
canInteract = function()
return handleGang(v.gang)
end
}
})
end
RegisterNetEvent("md-drugs:client:cutcokeone", function(data)
if not ItemCheck('bakingsoda') then return end
cuttingcoke = true
if Config.FancyCokeAnims then
CutCoke()
else
if not progressbar(Lang.Coke.cutting, 5000, 'uncuff') then cuttingcoke = nil return end
end
TriggerServerEvent("md-drugs:server:cutcokeone", data.data)
cuttingcoke = nil
end)
RegisterNetEvent("md-drugs:client:bagcoke", function(data)
if not ItemCheck('empty_weed_bag') then return end
baggingcoke = true
if Config.FancyCokeAnims then
BagCoke()
else
if not progressbar(Lang.Coke.bagging, 5000, 'uncuff') then baggingcoke = nil return end
end
TriggerServerEvent("md-drugs:server:bagcoke", data.data)
baggingcoke = nil
end)
CreateThread(function()
local config = lib.callback.await('md-drugs:server:getLocs', false)
if Config.FancyCokeAnims == false then
AddBoxZoneMulti('cuttcoke', config.CuttingCoke, { type = "client",event = "md-drugs:client:cutcokeone", icon = "fa-solid fa-mortar-pestle", label = Lang.targets.coke.cut})
AddBoxZoneMulti('baggcoke', config.BaggingCoke, { type = "client",event = "md-drugs:client:bagcoke", icon = "fa-solid fa-sack-xmark", label = Lang.targets.coke.bag})
else
AddBoxZoneSingle('cutcoke', config.singleSpot.cutcoke,
{ data = config.singleSpot.cutcoke, type = "client", event = "md-drugs:client:cutcokeone", icon = "fa-solid fa-mortar-pestle", label = Lang.targets.coke.cut, canInteract = function() if cuttingcoke == nil and baggingcoke == nil then return true end end })
AddBoxZoneSingle('bagcokepowder', config.singleSpot.bagcokepowder,
{ data = config.singleSpot.bagcokepowder, type = "client", event = "md-drugs:client:bagcoke", icon = "fa-solid fa-sack-xmark", label = Lang.targets.coke.bag, canInteract = function() if baggingcoke == nil and cuttingcoke == nil then return true end end })
end
end)
for k, v in pairs (GlobalState.MDDrugsLocs.CuttingCoke) do
ps.boxTarget('cutcoke'..k, v.loc, {length = 1.0, width = 1.0, height = 1.0, rotation = 180.0}, {
{
label = 'cutCoke',
icon = 'fa-solid fa-mortar-pestle',
action = function()
CutCoke(v.loc, v.offset, v.rotation)
end,
canInteract = function()
if not handleGang(v.gang) then return false end
if cuttingcoke ~= nil or baggingcoke ~= nil then return false end
return true
end,
}
})
end
for k, v in pairs (GlobalState.MDDrugsLocs.BaggingCoke) do
ps.boxTarget('bagcoke'..k, v.loc, {length = 1.0, width = 1.0, height = 1.0, rotation = 180.0}, {
{
label = 'bagCoke',
icon = 'fa-solid fa-sack-xmark',
action = function()
BagCoke(v.loc, v.offset, v.rotation)
end,
canInteract = function()
if not handleGang(v.gang) then return false end
if cuttingcoke ~= nil or baggingcoke ~= nil then return false end
return true
end
}
})
end
+5
View File
@@ -676,3 +676,8 @@ RegisterCommand('DrugRep', function()
lib.showContext('DrugRep')
end, false)
function handleGang(gang)
if gang == nil or gang == '' or gang == "" then return true end
if ps.getGangName() == gang or gang == 1 then return true end
return false
end
+22 -30
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
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)
+7 -6
View File
@@ -1,14 +1,16 @@
local Target = {
MakePowder = { -- where you chop your coca leaves to make powder
{loc = vector3(1086.20, -3195.30, -39.20), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
{loc = vector3(1086.20, -3195.30, -39.20), l = 1.0, w = 1.0, rot = 45.0, gang = "ballas"},
{loc = vector3(1090.15, -3199.5, -39.18), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
{loc = vector3(1093.09, -3199.53, -39.05), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
},
CuttingCoke = { -- only active if Config.FancyCokeAnims = false
{loc = vector3(1095.61, -3195.62, -39.13), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
{loc = vector3(1095.61, -3195.62, -39.13), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(-1.782227, 0.445068, -0.502701), rotation = vector3(0,0,0), gang = ""},
{loc = vector3(1092.74, -3196.68, -38.99), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(1.983398, 0.407959, -0.642696), rotation = vector3(0,0,180.0), gang = ""},
},
BaggingCoke = { -- only active if Config.FancyCokeAnims = false
{loc = vector3(1093.16, -3195.78, -39.19), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
{loc = vector3(1093.16, -3195.78, -39.19), l = 1.0, w = 1.0, rot = 45.0,offset = vec3(4.515137, 2.542969, -0.814194), rotation = vector3(0,0,180.0), gang = ""},
{loc = vector3(1090.17, -3196.59, -38.99), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(-5.207642, -1.666504, -1.014198), rotation = vector3(0,0, 0.0), gang = ""},
},
makecrack = { -- make crack with baking soda with cut coke 1-3
{loc = vector3(2433.47, 4970.02, 42.18), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
@@ -53,8 +55,7 @@ local Target = {
{loc = vector3(2855.62, 4446.73, 48.53), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
},
singleSpot = {
cutcoke = vector3(1093.17, -3195.74, -39.19),
bagcokepowder = vector3(1090.28, -3195.65, -39.19),
CokeTeleIn = vector3(198.16, -1276.92, 29.33), -- where you target to go inside coke
CokeTeleOut = vector3(1088.81, -3187.57, -38.99), -- where you target to leave coke
buylsdlabkit = vector4(2598.47, 5033.06, 105.86, 283.51), -- buy lab kit for lsd
@@ -110,7 +111,7 @@ local Target = {
vector4(474.88, 2609.56, 44.48, 357.0),
}
}
GlobalState.MDDrugsLocs = Target
function checkLoc(source, event, num)
local ped = source
local pos = GetPlayerPed(ped)
+1 -25
View File
@@ -136,31 +136,7 @@ local recipe = {
}
function GetRecipe(source, type, method, tier)
local src = source
local Player = getPlayer(source)
local has = 0
local need = 0
for k, v in pairs (recipe[type][method][tier].take) do
local item = Player.Functions.GetItemByName(k)
if item and item.amount >= v then
has = has + 1
else
Notifys(src, ' You Need ' .. v .. ' Of ' .. GetLabels(k) .. ' To Do This', 'error')
end
need = need + 1
end
if has == need then
for k, v in pairs (recipe[type][method][tier].take) do
RemoveItem(src, k, v)
end
for k,v in pairs (recipe[type][method][tier].give) do
AddItem(src, k, v)
Log(GetName(src) .. ' Made ' .. GetLabels(k) .. '!', 'drugMaking')
end
return true
else
return false
end
ps.craftItem(source,recipe[type][method][tier])
end
lib.callback.register('md-drugs:server:GetRecipe', function(source, type, cat)
+2 -2
View File
@@ -1,5 +1,5 @@
Config = {} --Ignore.
ps = exports.ps_lib:init()
Config.respawnTime = 150 -- Seconds
Config.Fuel = "LegacyFuel" -- type the name of script you use i.e. ps-fuel, cdn-fuel, LegacyFuel
Config.TierSystem = true -- allows for three tiers of certain drugs ( coke, heroin, crack, lsd)
@@ -26,7 +26,7 @@ Config.progressbartype = 'oxcir' -- either 'qb', 'oxcir', 'oxbar'
Config.Notify = 'ox' -- -- either 'qb' or 'ox' or 'okok'
Config.Phone = 'qb' -- either 'qb' or 'yflip' or 'qs'
Config.Dispatch = 'ps' -- either 'ps', 'cd', 'core', 'aty'
Config.Target = 'ox' -- qb or ox
Config.Target = 'qb' -- qb or ox
Config.Inventory = 'ox' -- qb or ox, other if you dont use ox just mark as qb
Config.Minigames = {
ps_circle = {amount = 2, speed = 8,},