3 Commits
Author SHA1 Message Date
Mustache Dom 537e639045 more shit 2025-08-22 01:05:38 -07:00
Mustache Dom 0956b1d49c - big update to labs 2025-08-21 01:22:49 -07:00
Mustache Dom eaec5fc40f - made animation work, fix shit when im not tired 2025-08-17 02:29:14 -06:00
10 changed files with 870 additions and 7 deletions

No files matched your search

+9 -2
View File
@@ -2,6 +2,8 @@
local cuttingcoke = nil
local baggingcoke = nil
local locations = ps.callback('md-drugs:server:GetCokeLocations')
local function CutCoke(coords, offset, rotation)
local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter"
ps.requestAnim(animDict, 500)
@@ -125,8 +127,9 @@ for k, v in pairs (locations.MakePowder) do
TriggerServerEvent("md-drugs:server:makepowder", k)
end,
canInteract = function()
return handleGang(v.gang)
end
if cocaineLab then return false end
return handleGang(v.gang)
end
}
})
end
@@ -145,6 +148,7 @@ for k, v in pairs (locations.CuttingCoke) do
TriggerServerEvent("md-drugs:server:cutcokeone", k)
end,
canInteract = function()
if cocaineLab then return false end
if not handleGang(v.gang) then return false end
if cuttingcoke ~= nil or baggingcoke ~= nil then return false end
return true
@@ -167,6 +171,7 @@ for k, v in pairs (locations.BaggingCoke) do
TriggerServerEvent("md-drugs:server:bagcoke", k)
end,
canInteract = function()
if cocaineLab then return false end
if not handleGang(v.gang) then return false end
if cuttingcoke ~= nil or baggingcoke ~= nil then return false end
return true
@@ -184,6 +189,7 @@ for k, v in pairs (locations.cokeTele) do
SetEntityCoords(PlayerPedId(), v.outside)
end,
canInteract = function()
if cocaineLab then return false end
return handleGang(v.gang)
end
}
@@ -196,6 +202,7 @@ for k, v in pairs (locations.cokeTele) do
SetEntityCoords(PlayerPedId(), v.inside)
end,
canInteract = function()
if cocaineLab then return false end
return handleGang(v.gang)
end
}
+478
View File
@@ -0,0 +1,478 @@
local inside = false
local peds = {}
local labData = {}
cocaineLab = false
local insideLocation = nil
local function CutCoke(coords, offset, rotation)
CreateThread(function()
local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter"
ps.requestAnim(animDict, 500)
local animDuration = GetAnimDuration(animDict, animName) * 1000
if not peds['CutCoke'] then
ps.requestModel('ig_priest', 500)
peds['CutCoke'] = CreatePed(4, 'ig_priest', coords.x + 1.0, coords.y + 1.0, coords.z - 1.0, 0.0, true, true)
FreezeEntityPosition(peds['CutCoke'], true)
SetEntityInvincible(peds['CutCoke'], true)
SetBlockingOfNonTemporaryEvents(peds['CutCoke'], true)
end
local ped = peds['CutCoke']
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"},
{ hash = "prop_cs_credit_card", animName = "coke_cut_v5_creditcard"},
{ hash = "prop_cs_credit_card", animName = "coke_cut_v5_creditcard^1"}
},
}
local scenesList, entitiesList = {}, {}
for i=1, #scenes, 1 do
local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3)
NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0)
for j=1, #scenes[i], 1 do
local s = scenes[i][j]
RequestModel(s.hash)
while not HasModelLoaded(s.hash) do
Wait(0)
end
local obj = CreateObjectNoOffset(s.hash, coords, true, true, true)
SetModelAsNoLongerNeeded(s.hash)
entitiesList[#entitiesList+1] = obj
NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1)
end
scenesList[#scenesList+1] = scene
end
DisableCamCollisionForEntity(ped)
FreezeEntityPosition(ped, true)
for i=1, #scenesList, 1 do
NetworkStartSynchronisedScene(scenesList[i])
end
Wait(animDuration-11000)
for i=1, #scenesList, 1 do
NetworkStopSynchronisedScene(scenesList[i])
end
for i=1, #entitiesList, 1 do
DeleteEntity(entitiesList[i])
end
RemoveAnimDict(animDict)
FreezeEntityPosition(ped, false)
if inside then
CutCoke(coords, offset, rotation)
end
end)
end
local function BagCoke(coords, offset, rotation)
CreateThread(function()
local ver = ""
local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01"
ps.requestAnim(animDict, 500)
local animDuration = GetAnimDuration(animDict, animName) * 1000
if not peds['BagCoke'] then
ps.requestModel('ig_priest', 500)
peds['BagCoke'] = CreatePed(4, 'ig_priest', coords.x + 1.0, coords.y + 1.0, coords.z - 1.0, 0.0, true, true)
FreezeEntityPosition(peds['BagCoke'], true)
SetEntityInvincible(peds['BagCoke'], true)
SetBlockingOfNonTemporaryEvents(peds['BagCoke'], true)
end
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"},
{ hash = "bkr_prop_coke_fullmetalbowl_02", animName = "break_weigh_"..ver.."box01^1"},
{ hash = "bkr_prop_coke_cutblock_01", animName = "break_weigh_"..ver.."methbag01"}
},
{
{ hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^1"},
{ hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^2"},
{ hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^3"}
},
{
{ hash = "bkr_prop_coke_fullscoop_01a", animName = "break_weigh_"..ver.."scoop"},
{ hash = "bkr_prop_coke_scale_01", animName = "break_weigh_"..ver.."scale"},
{ hash = "bkr_prop_fakeid_penclipboard", animName = "break_weigh_"..ver.."pen"}
},
{
{ hash = "bkr_prop_fakeid_clipboard_01a", animName = "break_weigh_"..ver.."clipboard"},
}
}
local scenesList, entitiesList = {}, {}
for i=1, #scenes, 1 do
local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3)
NetworkAddPedToSynchronisedScene(peds['BagCoke'], scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0)
for j=1, #scenes[i], 1 do
local s = scenes[i][j]
RequestModel(s.hash)
while not HasModelLoaded(s.hash) do
Wait(0)
end
local obj = CreateObjectNoOffset(s.hash, coords, true, true, true)
SetModelAsNoLongerNeeded(s.hash)
entitiesList[#entitiesList+1] = obj
NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1)
end
scenesList[#scenesList+1] = scene
end
DisableCamCollisionForEntity(peds['BagCoke'])
FreezeEntityPosition(peds['BagCoke'], true)
for i=1, #scenesList, 1 do
NetworkStartSynchronisedScene(scenesList[i])
end
Wait(animDuration-11000)
for i=1, #scenesList, 1 do
NetworkStopSynchronisedScene(scenesList[i])
end
for i=1, #entitiesList, 1 do
DeleteEntity(entitiesList[i])
end
RemoveAnimDict(animDict)
FreezeEntityPosition(peds['BagCoke'], false)
if inside then
BagCoke(coords, offset, rotation)
end
end)
end
RegisterCommand('cocaineMake', function()
inside = true
CutCoke(vector3(1095.61, -3195.62, -39.13), vector3(-1.782227, 0.445068, -0.502701), vector3(0,0,0))
BagCoke(vector3(1093.16, -3195.78, -39.19), vector3(4.515137, 2.542969, -0.814194), vector3(0,0,180.0))
end)
local locs = ps.callback('md-drugs:server:GetCokeLabLocations')
for k, v in pairs (locs) do
v.coords = json.decode(v.coords)
local loc = vector3(v.coords.x, v.coords.y, v.coords.z)
ps.boxTarget('drugLabcoke'..k, loc, {},{
{
label = 'Purchase Lab',
action = function()
ps.debug(v)
end,
canInteract = function()
if v.owner then
return false
end
return true
end
},
{
label = 'Enter Lab',
action = function()
TriggerServerEvent('TestCokeLab', k)
insideLocation = k
end,
canInteract = function()
if v.owner == ps.getIdentifier() then return true end
if ps.tableContains(json.decode(v.allowedIn) or {}, ps.getIdentifier()) then return true end
return false
end
},
{
label = 'Raid Lab',
action = function()
ps.debug(v)
end,
canInteract = function()
if v.owner and ps.getJobType() == 'leo' then
return true
end
return false
end
}
})
end
ps.boxTarget('cokelabLeave', vector3(1088.64, -3187.21, -38.24), {length = 1.0, width = 1.0, height = 1.0, rotation = 180.0}, {
{
label = 'Leave Lab',
action = function()
inside = false
cocaineLab = false
TriggerServerEvent('RestoreCokeLab', insideLocation)
for k, v in pairs(peds) do
DeleteEntity(v)
end
labData = {}
end,
canInteract = function()
return inside and cocaineLab
end
}
})
local function getInputData()
if Config.TierSystem then
return {
{required = true, min = 0, type = 'number', title = ps.getLabel('coca_leaf'), max = ps.getItemCount('coca_leaf')},
{required = true, min = 0, type = 'number', title = ps.getLabel('bakingsoda'), max = ps.getItemCount('bakingsoda')},
{required = true, min = 0, type = 'number', title = ps.getLabel('loosecoke'), max = ps.getItemCount('loosecoke')},
{required = true, min = 0, type = 'number', title = ps.getLabel('loosecokestagetwo'), max = ps.getItemCount('loosecokestagetwo')},
{required = true, min = 0, type = 'number', title = ps.getLabel('loosecokestagethree'), max = ps.getItemCount('loosecokestagethree')},
{required = true, min = 0, type = 'number', title = ps.getLabel('empty_weed_bag'), max = ps.getItemCount('empty_weed_bag')},
}
end
return {
{required = true, min = 0, type = 'number', title = ps.getLabel('coca_leaf'), max = ps.getItemCount('coca_leaf')},
{required = true, min = 0, type = 'number', title = ps.getLabel('bakingsoda'), max = ps.getItemCount('bakingsoda')},
{required = true, min = 0, type = 'number', title = ps.getLabel('loosecoke'), max = ps.getItemCount('loosecoke')},
{required = true, min = 0, type = 'number', title = ps.getLabel('empty_weed_bag'), max = ps.getItemCount('empty_weed_bag')},
}
end
local function returnResults(data)
if Config.TierSystem then
local Items = {
coca_leaf = data[1] or 0,
bakingsoda = data[2] or 0,
loosecoke = data[3] or 0,
loosecokestagetwo = data[4] or 0,
loosecokestagethree = data[5] or 0,
empty_weed_bag = data[6] or 0,
}
for k, v in pairs (Items) do
if v == 0 then
Items[k] = nil
end
end
return Items
end
local Items = {
coca_leaf = data[1] or 0,
bakingsoda = data[2] or 0,
loosecoke = data[3] or 0,
empty_weed_bag = data[4] or 0,
}
for k, v in pairs (Items) do
if v == 0 then
Items[k] = nil
end
end
return Items
end
local function getDescript(employee)
local strings = ''
strings = strings .. 'Hiring Cost: $' .. employee.salary * 10 .. '\n'
strings = strings .. 'Salary: $'..employee.salary..'\n'
strings = strings .. 'Job: ' .. employee.type..'\n'
strings = strings .. 'Skills: \n'
for k, v in pairs (json.decode(employee.skills) or {}) do
strings = strings .. '- ' .. k .. ': ' .. v .. '\n'
end
return strings
end
local function openDrugLabMenu()
local options = {
{
title = 'Lab Management',
description = 'Manage the overall operations of your drug lab',
action = function()
local options = {
{
title = 'Add Funds',
description = 'Add money to your drug lab\'s budget',
action = function()
local input = ps.input('Enter the amount of money to add:', {
{type = 'number', min = 0, required = true}
})
if input and input[1] then
TriggerServerEvent('md-drugs:server:AddLabFunds', tonumber(input[1]))
end
end
},
{
title = 'Withdraw Funds',
description = 'Withdraw money from your drug lab\'s budget',
action = function()
local input = ps.input('Enter the amount of money to withdraw:', {
{type = 'number', min = 0, required = true}
})
if input and input[1] then
TriggerServerEvent('md-drugs:server:WithdrawLabFunds', tonumber(input[1]))
end
end
},
{
title = 'Give Access',
description = 'Grant other players access to your drug lab',
action = function()
local input = ps.input('Enter the player ID to give access:', {
{type = 'number', min = 1, required = true}
})
if input and input[1] then
TriggerServerEvent('md-drugs:server:GiveLabAccess', tonumber(input[1]))
end
end
},
{
title = 'Revoke Access',
description = 'Remove other players\' access to your drug lab',
action = function()
local input = ps.input('Enter the player ID to revoke access:', {
{type = 'number', min = 1, required = true}
})
if input and input[1] then
TriggerServerEvent('md-drugs:server:RevokeLabAccess', tonumber(input[1]))
end
end
}
}
ps.menu('Lab Management', 'Manage your drug lab', options)
end,
},
{
title = 'Manage Employees',
description = 'View and manage your current drug lab employees',
action = function()
local options = {
{
title = 'Hire Employees',
description = 'Manage your drug lab employees',
action = function()
local employees = ps.callback('md-drugs:server:GetAvailableEmployees')
local options = {}
for k,v in pairs (employees) do
options[#options+1] = {
title = v.name,
description = getDescript(v),
action = function()
TriggerServerEvent('md-drugs:server:HireEmployee', v.id)
end,
}
end
ps.menu('Drug Employees', 'Drug Employees', options)
end,
},
{
title = 'Fire Employees',
description = 'Manage your drug lab employees',
action = function()
local employees = ps.callback('md-drugs:server:GetAvailableEmployees')
local options = {}
for k,v in pairs (employees) do
options[#options+1] = {
title = v.name,
description = getDescript(v),
action = function()
local input = ps.input('Are you sure you want to fire this employee?', {
{type = 'select', title = 'Confirm', options = {{label = 'Yes', value = true}, {label = 'No', value = false}}, required = true}
})
if input and input[1] == true then
TriggerServerEvent('md-drugs:server:FireEmployee', v.id)
end
end,
}
end
ps.menu('Drug Employees', 'Drug Employees', options)
end,
},
{
title = 'Train Employees',
description = 'Improve the skills of your drug lab employees',
action = function()
local employees = ps.callback('md-drugs:server:GetAvailableEmployees')
local options = {}
for k,v in pairs (employees) do
options[#options+1] = {
title = v.name,
description = getDescript(v),
action = function()
TriggerServerEvent('md-drugs:server:TrainEmployee', v.id)
end,
}
end
ps.menu('Train Employees', 'Select an employee to train', options)
end,
}
}
ps.menu('Manage Employees', 'Manage your drug lab employees', options)
end,
},
{
title = 'Input Stock Management',
description = 'Manage the raw materials and supplies for your drug lab',
action = function()
local options = {
{
title = 'Input Stock',
description = 'Add raw materials to your drug lab inventory',
action = function()
local input = ps.input('Enter the amount of stock to add:',getInputData())
if not input or not input[1] then return end
TriggerServerEvent('md-drugs:server:cokeAddStock', returnResults(input))
end,
},
{
title = 'Take Drug Ingredients',
description = 'Withdraw finished products from your drug lab',
action = function()
local itemData = ps.callback('md-drugs:server:getCokeLabItemCount')
if not itemData.input or #itemData.input == 0 then
ps.notify('No drugs available to take.', 'error')
return
end
local input = ps.input('Enter the amount of drugs to take:', itemData.input)
if not input or not input[1] then return end
local itemList = {}
for i = 1, #input do
local itemInfo = itemData.input[i]
local value = tonumber(input[i])
if not value or value < 0 then
ps.notify('Invalid amount entered.', 'error')
return
end
if value > 0 and itemInfo and itemInfo.item then
itemList[itemInfo.item] = value
end
end
TriggerServerEvent('md-drugs:server:cokeTakeDrugs', itemList)
end,
}
}
ps.menu('Input Stock Management', 'Manage your drug lab\'s raw materials and supplies', options)
end,
},
}
ps.menu('Cocaine Lab Management', 'Cocaine Lab Management', options)
end
ps.boxTarget('cokeLabManagement', vector3(1099.67, -3193.13, -38.99), {length = 1.0, width = 1.0, height = 1.0, rotation = 0.0}, {
{
label = 'Open Coke Management',
action = function()
openDrugLabMenu()
end,
canInteract = function()
if inside and cocaineLab and ps.getIdentifier() == labData.owner then
return true
end
if labData and labData.allowedIn and ps.tableContains(labData.allowedIn, ps.getIdentifier()) then
return true
end
return false
end
},
})
RegisterNetEvent('md-drugs:client:EnterCokeLab', function(data)
inside = true
cocaineLab = true
labData = data
labData.coords = json.decode(labData.coords)
labData.allowedIn = json.decode(labData.allowedIn) or {}
labData.employees = json.decode(labData.employees) or {}
for k, v in pairs (labData.employees) do
if v.type == 'packer' then
BagCoke(vector3(1093.16, -3195.78, -39.19), vector3(4.515137, 2.542969, -0.814194), vector3(0,0,180.0))
end
if v.type == 'mixer' then
CutCoke(vector3(1095.61, -3195.62, -39.13), vector3(-1.782227, 0.445068, -0.502701), vector3(0,0,0))
end
end
end)
+173
View File
@@ -0,0 +1,173 @@
local inside = false
---- start animation shit
local function loadParticle(dict)
if not HasNamedPtfxAssetLoaded(dict) then
RequestNamedPtfxAsset(dict)
end
while not HasNamedPtfxAssetLoaded(dict) do
Wait(0)
end
SetPtfxAssetNextCall(dict)
end
local function MethCooking(coords, offset, rotation)
CreateThread(function()
local animDict, animName = "anim@amb@business@meth@meth_monitoring_cooking@cooking@", "chemical_pour_short_cooker"
ps.requestModel('ig_priest', 500)
local worker1 = CreatePed(4, 'ig_priest', coords.x + 1.0, coords.y + 1.0, coords.z - 1.0, 0.0, true, true)
ps.requestAnim(animDict, 500)
SetEntityCoords(worker1, coords)
local targetPosition = GetEntityCoords(worker1)
local animDuration = GetAnimDuration(animDict, animName) * 800
FreezeEntityPosition(worker1, true)
local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y, coords.z + offset.z), rotation
local netScene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3)
NetworkAddPedToSynchronisedScene(worker1, netScene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0)
local sacid = CreateObjectNoOffset("bkr_prop_meth_sacid", targetPosition, 1, 1, 0)
NetworkAddEntityToSynchronisedScene(sacid, netScene, animDict, "chemical_pour_short_sacid", 4.0, -8.0, 1)
local ammonia = CreateObjectNoOffset("bkr_prop_meth_ammonia", targetPosition, 1, 1, 0)
NetworkAddEntityToSynchronisedScene(ammonia, netScene, animDict, "chemical_pour_short_ammonia", 4.0, -8.0, 1)
NetworkStartSynchronisedScene(netScene)
Wait(animDuration)
NetworkStopSynchronisedScene(netScene)
DeleteObject(sacid) DeleteObject(ammonia)
FreezeEntityPosition(worker1, false)
if inside then
MethCooking(coords, offset, rotation)
end
end)
end
local function SmashMeth(coords, offset, rotation)
CreateThread(function()
local ver = ""
local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char02"
ps.requestAnim(animDict, 500)
local ped = CreatePed(4, 'ig_priest', coords.x + 1.0, coords.y + 1.0, coords.z - 1.0, 0.0, true, true)
local targetPosition = coords
SetEntityCoords(ped, targetPosition)
Wait(1)
local animDuration = GetAnimDuration(animDict, animName) * 800
FreezeEntityPosition(ped, true)
local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y, coords.z + offset.z), rotation
local netScene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3)
NetworkAddPedToSynchronisedScene(ped, netScene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0)
local objects, sceneObjects = {}, {
{ hash = "w_me_hammer", animName = "break_weigh_" .. ver .. "hammer"},
{ hash = "bkr_Prop_Meth_SmashedTray_01_frag_", animName = "break_weigh_"..ver.."tray01"},
{ hash = "bkr_Prop_Meth_Tray_02a", animName = "break_weigh_"..ver.."tray01^1"},
{ hash = "bkr_Prop_Meth_Tray_02a", animName = "break_weigh_"..ver.."tray01^2"},
{ hash = "bkr_Prop_Meth_SmashedTray_01_frag_", animName = "break_weigh_"..ver.."tray01^3"},
}
for i=1, #sceneObjects, 1 do
local obj = CreateObjectNoOffset(sceneObjects[i].hash, targetPosition, true, true, true)
NetworkAddEntityToSynchronisedScene(obj, netScene, animDict, sceneObjects[i].animName, 4.0, -8.0, 1)
objects[#objects+1] = obj
end
NetworkStartSynchronisedScene(netScene)
Wait(animDuration)
NetworkStopSynchronisedScene(netScene)
for i=1, #objects, 1 do
DeleteObject(objects[i])
end
RemoveAnimDict(animDict)
FreezeEntityPosition(ped, false)
if inside then
SmashMeth(coords, offset, rotation)
end
end)
end
local function BagMeth(coords, offset, rotation)
CreateThread(function()
local ver = ""
local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01"
ps.requestAnim(animDict, 500)
local animDuration = GetAnimDuration(animDict, animName) * 1000
local ped = CreatePed(4, 'ig_priest', coords.x + 1.0, coords.y + 1.0, coords.z - 1.0, 0.0, true, true)
SetEntityCoords(ped, coords)
local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y, coords.z + offset.z), rotation
local scenes = {
{
{ hash = "bkr_prop_meth_bigbag_04a", animName = "break_weigh_"..ver.."box01"},
{ hash = "bkr_prop_meth_bigbag_03a", animName = "break_weigh_"..ver.."box01^1"},
{ hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01"}
},
{
{ hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^1"},
{ hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^2"},
{ hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^3"}
},
{
{ hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^4"},
{ hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^5"},
{ hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^6"}
},
{
{ hash = "bkr_prop_meth_scoop_01a", animName = "break_weigh_"..ver.."scoop"},
{ hash = "bkr_prop_coke_scale_01", animName = "break_weigh_"..ver.."scale"},
{ hash = "bkr_prop_fakeid_penclipboard", animName = "break_weigh_"..ver.."pen"}
},
{
{ hash = "bkr_prop_fakeid_clipboard_01a", animName = "break_weigh_"..ver.."clipboard"},
{ hash = "bkr_Prop_Meth_Tray_02a", animName = "break_weigh_"..ver.."tray01^5"}
}
}
local scenesList, entitiesList = {}, {}
for i=1, #scenes, 1 do
local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3)
NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0)
for j=1, #scenes[i], 1 do
local s = scenes[i][j]
RequestModel(s.hash)
while not HasModelLoaded(s.hash) do
Wait(0)
end
local obj = CreateObjectNoOffset(s.hash, coords, true, true, true)
SetModelAsNoLongerNeeded(s.hash)
entitiesList[#entitiesList+1] = obj
NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1)
end
scenesList[#scenesList+1] = scene
end
DisableCamCollisionForEntity(ped)
FreezeEntityPosition(ped, true)
for i=1, #scenesList, 1 do
NetworkStartSynchronisedScene(scenesList[i])
end
Wait(animDuration-11000)
for i=1, #scenesList, 1 do
NetworkStopSynchronisedScene(scenesList[i])
end
for i=1, #entitiesList, 1 do
DeleteEntity(entitiesList[i])
end
RemoveAnimDict(animDict)
FreezeEntityPosition(ped, false)
if inside then
BagMeth(coords, offset, rotation)
end
end)
end
RegisterCommand('TestMethLab', function()
TriggerServerEvent('TestMethLab')
Wait(2000)
SetEntityCoords(PlayerPedId(), vector3(1004.66, -3199.98, -38.99)) -- Example coordinates
end)
RegisterCommand('RestoreMethLab', function()
TriggerServerEvent('RestoreMethLab')
end)
RegisterCommand('methcook', function()
local coords = vector3(1006.09, -3200.59, -38.52)
local offset = vector3(4.79, 2.13, -0.41)
local rotation = vector3(0.0, 0.0, 0.0)
inside = true
MethCooking(coords, offset, rotation)
SmashMeth(vector3(1012.04, -3194.96, -38.99), vector3(-3.143311, -1.666748, -1.010128), vector3(0,0,0.0))
BagMeth(vector3(1014.25, -3194.93, -38.99), vector3(-4.9, -1.70, -1.01), vector3(0,0,0.0))
end)
+2 -5
View File
@@ -4,6 +4,7 @@ description "drugs by mustache dom"
fx_version "cerulean"
game "gta5"
version '3.9.0'
client_scripts {
'client/functions.lua',
'client/animationsandfunctions.lua',
@@ -12,10 +13,10 @@ client_scripts {
}
server_scripts {
'@oxmysql/lib/MySQL.lua',
'server/functions.lua',
'server/plantSpawns.lua',
'serverRun.lua',
'@oxmysql/lib/MySQL.lua',
}
shared_scripts {
@@ -25,11 +26,7 @@ shared_scripts {
lua54 'yes'
files {
'stream/mushroom.ytyp',
'stream/mushroom.ydr',
'client/**.lua',
'server/**.lua',
'locales/**.lua'
}
data_file 'DLC_ITYP_REQUEST' 'stream/mushroom.ytyp'
+161
View File
@@ -0,0 +1,161 @@
local locations = MySQL.query.await('SELECT * FROM druglabs WHERE type = ?', {'cocaine'})
ps.registerCallback('md-drugs:server:GetCokeLabLocations', function()
return locations
end)
RegisterNetEvent('TestCokeLab', function(num)
local src = source
saveBucket(src, num)
SetEntityCoords(GetPlayerPed(src), vector3(1088.62, -3187.54, -38.99))
local labData = MySQL.query.await('SELECT * FROM druglabs WHERE id = ?', {num})
if labData and #labData > 0 then
TriggerClientEvent('md-drugs:client:EnterCokeLab', src, labData[1])
else
ps.notify(src, 'Lab data not found.', 'error')
end
end)
RegisterNetEvent('RestoreCokeLab', function(num)
local src = source
restoreBucket(src)
local loc = json.decode(locations[num].coords)
SetEntityCoords(GetPlayerPed(src), vector3(loc.x, loc.y, loc.z))
end)
ps.registerCallback('md-drugs:server:GetAvailableEmployees',function(source)
local src = source
local identifier = ps.getIdentifier(src)
local hasLab = MySQL.query.await('SELECT * FROM druglabs WHERE owner = ?', {identifier})
if hasLab and #hasLab > 0 then
return MySQL.query.await('SELECT * FROM drug_employees', {})
end
end)
RegisterNetEvent('md-drugs:server:HireEmployee', function(employeeId)
local src = source
local identifier = ps.getIdentifier(src)
local hasLab = MySQL.query.await('SELECT * FROM druglabs WHERE owner = ?', {identifier})
if not hasLab or #hasLab == 0 then
ps.notify(src, 'You do not own a drug lab.', 'error')
return
end
local employee = MySQL.query.await('SELECT * FROM drug_employees WHERE id = ?', {employeeId})
if not employee or #employee == 0 then
ps.notify(src, 'Employee not found.', 'error')
return
end
local employeeData = employee[1]
local currentEmployees = json.decode(hasLab[1].employees) or {}
for _, emp in ipairs(currentEmployees) do
if emp.type == employeeData.type then
ps.notify(src, 'You already have an employee of this type hired.', 'error')
return
end
end
if ps.removeMoney(src, 'bank', employeeData.salary * 10) then
table.insert(currentEmployees, employeeData)
MySQL.update.await('UPDATE druglabs SET employees = ? WHERE owner = ?', {json.encode(currentEmployees), identifier})
MySQL.query.await('DELETE FROM drug_employees WHERE id = ?', {employeeId})
TriggerClientEvent('md-drugs:client:EmployeeHired', src, employeeId)
end
end)
RegisterNetEvent('md-drugs:server:cokeAddStock',function(stock)
local src = source
local identifier = ps.getIdentifier(src)
local hasLab = MySQL.query.await('SELECT * FROM druglabs WHERE owner = ?', {identifier})
if not hasLab or #hasLab == 0 then
ps.notify(src, 'You do not own a drug lab.', 'error')
return
end
local stockCheck = verifyHas(src, stock)
if not stockCheck then
ps.notify(src, 'You do not have enough items to add to the lab.', 'error')
return
end
for item, amount in pairs(stock) do
ps.removeItem(src, item, amount)
end
local currentStock = json.decode(hasLab[1].inputItems) or {}
for item, amount in pairs(stock) do
currentStock[item] = (currentStock[item] or 0) + amount
end
MySQL.update.await('UPDATE druglabs SET inputItems = ? WHERE owner = ?', {json.encode(currentStock), identifier})
ps.notify(src, 'Stock added to your lab successfully.', 'success')
end)
ps.registerCallback('md-drugs:server:getCokeLabItemCount',function(source)
local src = source
local identifier = ps.getIdentifier(src)
local hasLab = MySQL.query.await('SELECT * FROM druglabs WHERE owner = ?', {identifier})
if not hasLab or #hasLab == 0 then
ps.notify(src, 'You do not own a drug lab.', 'error')
return
end
local stock = json.decode(hasLab[1].inputItems) or {}
local inputData, itemOrder = {}, {}
for item, amount in pairs(stock) do
table.insert(inputData, {
type = 'number',
max = amount,
title = ps.getItemLabel(item),
required = true,
min = 0,
item = item,
})
itemOrder[item] = amount
end
return {input = inputData, order = itemOrder}
end)
RegisterNetEvent('md-drugs:server:cokeTakeDrugs', function(data)
local src = source
local identifier = ps.getIdentifier(src)
ps.debug(data)
local hasLab = MySQL.query.await('SELECT * FROM druglabs WHERE owner = ?', {identifier})
if not hasLab or #hasLab == 0 then
ps.notify(src, 'You do not own a drug lab.', 'error')
return
end
local stock = json.decode(hasLab[1].inputItems) or {}
if next(stock) == nil then
ps.notify(src, 'No drugs available to take.', 'error')
return
end
for item, amount in pairs(data) do
if not stock[item] then
goto skip
end
if stock[item] < amount then
ps.notify(src, 'Insufficient stock for ' .. ps.getItemLabel(item) .. '.', 'error')
goto skip
end
if amount == 0 then
goto skip
end
if ps.addItem(src, item, amount) then
stock[item] = stock[item] - amount
if stock[item] == 0 then
stock[item] = nil
end
else
ps.notify(src, 'Failed to add ' .. ps.getItemLabel(item) .. ' to your inventory.', 'error')
end
::skip::
end
MySQL.update.await('UPDATE druglabs SET inputItems = ? WHERE owner = ?', {json.encode(stock), identifier})
end)
+33
View File
@@ -16,6 +16,39 @@ function timeOut(src, event)
timeOutThread(src)
return false
end
-- Drug Labs Functions
local Buckets = {}
function setBucket(src, bucket)
if src and bucket then
Player(src).state:set('instance', bucket, true)
SetPlayerRoutingBucket(src, bucket)
return true
else
return false
end
end
function saveBucket(src, bucket)
Buckets[ps.getIdentifier(src)] = {original = GetEntityRoutingBucket(GetPlayerPed(src)), new = bucket}
setBucket(src, bucket)
end
function restoreBucket(src)
local id = ps.getIdentifier(src)
if Buckets[id] then
setBucket(src, Buckets[id].original)
Buckets[id] = nil
end
end
local firstNames = {'John', 'Jacob', 'Matt', 'Michael', 'Chris', 'David', 'James', 'Robert', 'William', 'Joseph', 'Daniel', 'Lucas', 'Mason', 'Ethan', 'Alexander', 'Liam'}
local lastNames = {'Smith', 'Johnson', 'Williams', 'Jones', 'Brown', 'Davis', 'Miller', 'Wilson', 'Moore', 'Taylor', 'Anderson', 'Thomas', 'Jackson', 'White', 'Harris', 'Martin'}
function generateRandomName()
local firstName = firstNames[math.random(#firstNames)]
local lastName = lastNames[math.random(#lastNames)]
return firstName .. ' ' .. lastName
end
function verifyHas(source, items)
local need = 0
+12
View File
@@ -0,0 +1,12 @@
RegisterNetEvent('TestMethLab', function()
local src = source
saveBucket(src, 2)
TriggerClientEvent('md-methlab:client:EnterMethLab', src)
end)
RegisterNetEvent('RestoreMethLab', function()
local src = source
restoreBucket(src)
end)
+2
View File
@@ -43,6 +43,7 @@ Config.minigametype = 'ps_circle' -- look above for options or choose none if yo
Config.Drugs = { -- want a drug turn on? keep it true, want it turned off, mark it false
cocaine = true,
cocainelab = true,
consumables = true,
cornerselling = true,
crack = true,
@@ -52,6 +53,7 @@ Config.Drugs = { -- want a drug turn on? keep it true, want it turned off, mark
lsd = true,
mescaline = true,
meth = true,
methlab = true,
oxyruns = true,
pharma = true,
shrooms = true,
Binary file not shown.
Binary file not shown.