diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua
index f1a89b6..2fb9662 100644
--- a/client/animationsandfunctions.lua
+++ b/client/animationsandfunctions.lua
@@ -1,8 +1,7 @@
local QBCore = exports['qb-core']:GetCoreObject()
local started = nil
-
-local function loadParticle(dict)
+ function loadParticle(dict)
if not HasNamedPtfxAssetLoaded(dict) then
RequestNamedPtfxAsset(dict)
end
@@ -64,26 +63,11 @@ local scenePos, sceneRot = vector3(1008.734, -3196.646, -39.99), vector3(0.0, 0.
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"
- },
+ { 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)
@@ -110,70 +94,28 @@ local ver = ""
local scenePos, sceneRot = vector3(1008.734, -3196.646, -39.99), vector3(0.0, 0.0, 1.08)
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_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^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_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_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"
- }
+ { 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 = {}, {}
@@ -237,18 +179,9 @@ function CutCoke()
local scenePos, sceneRot = vector3(1090.37+.9, -3193.61-1.68, -39.60), vector3(0.0, 0.0, 0.00)
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"
- }
+ { 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"}
},
}
@@ -305,52 +238,22 @@ local ver = ""
local scenePos, sceneRot = vector3(1090.62+4.3, -3196.2+3, -38.99-1), vector3(360.0, 360.0, 180.08)
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 = `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 = `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_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"
- },
+ { hash = `bkr_prop_fakeid_clipboard_01a`, animName = "break_weigh_"..ver.."clipboard"},
}
}
@@ -477,6 +380,7 @@ function AlienEffect()
StopScreenEffect("DrugsMichaelAliensFightOut")
end
+local hit = 0
function SpawnCarPedChase()
local ped = GetEntityCoords(PlayerPedId())
local stoploc = vector3(-1157.63, -3056.71, 13.94)
@@ -501,47 +405,21 @@ else
repeat -- repeats Wait(1000) only until
Wait(1000)
until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0 -- either the distance is within 20 OR the driver is dead
+ RemoveBlip(leancar)
if GetEntityHealth(driver) == 0 then -- once one of those thing ends, the loop breaks and carries on from here
- if Config.oxtarget then
- local options = {
- {
- name = 'leancar',
- icon = 'fa-solid fa-car',
- label = 'Steal From Car',
- onSelect = function()
- if not minigame(2,8) then return end
- TriggerServerEvent('md-drugs:server:givelean')
- started = nil
- if math.random(1,100) <= 30 then
- DeleteVehicle(leancar)
- DeleteEntity(driver)
- DeleteEntity(pilot2)
- end
- end,
- }
- }
- exports.ox_target:addLocalEntity(leancar, options)
- else
- exports['qb-target']:AddTargetEntity(leancar, {
- options = {
- {
- name = 'leancar',
- icon = 'fa-solid fa-car',
- label = 'Steal From Car',
- action = function()
- if not minigame(2,8) then return end
- TriggerServerEvent('md-drugs:server:givelean')
- started = nil
- if math.random(1,100) <= 30 then
- DeleteVehicle(leancar)
- DeleteEntity(driver)
- DeleteEntity(pilot2)
- end
- end,
- }
- }
- })
- end
+ AddSingleModel(leancar, { name = 'leancar', icon = 'fa-solid fa-car', label = 'Steal From Car',
+ action = function()
+ hit = hit + 1
+ if not minigame(2,8) then return end
+ TriggerServerEvent('md-drugs:server:givelean')
+ started = nil
+ if math.random(1,100) <= 30 or hit == 4 then
+ hit = 0
+ DeleteVehicle(leancar)
+ DeleteEntity(driver)
+ DeleteEntity(pilot2)
+ end
+ end}, nil)
else
repeat -- this second loop is to spawn the helicopter when the truck is in distance
Wait(1000)
@@ -590,46 +468,21 @@ else
Wait(1000)
until #(GetEntityCoords(methdriver) - stoploc) < 20.0 or GetEntityHealth(methdriver) == 0
if GetEntityHealth(methdriver) == 0 then
- if Config.oxtarget then
- local options = {
- {
- name = 'methcar',
- icon = 'fa-solid fa-car',
- label = 'Steal From Car',
- onSelect = function()
- if not minigame(2,8) then return end
- TriggerServerEvent('md-drugs:server:givemethingridients')
- startedmeth = nil
- if math.random(1,100) <= 30 then
- DeleteVehicle(methcar)
- DeleteEntity(methdriver)
- DeleteEntity(methpilot)
- end
- end,
- }
- }
- exports.ox_target:addLocalEntity(methcar, options)
- else
- exports['qb-target']:AddTargetEntity(methcar, {
- options = {
- {
- name = 'methcar',
- icon = 'fa-solid fa-car',
- label = 'Steal From Car',
- action = function()
- if not minigame(2,8) then return end
- TriggerServerEvent('md-drugs:server:givemethingridients')
- startedmeth = nil
- if math.random(1,100) <= 30 then
- DeleteVehicle(methcar)
- DeleteEntity(methdriver)
- DeleteEntity(methpilot)
- end
- end,
- }
- }
- })
- end
+ AddSingleModel(methcar,{
+ name = 'methcar',
+ icon = 'fa-solid fa-car',
+ label = 'Steal From Car',
+ action = function()
+ if not minigame(2,8) then return end
+ TriggerServerEvent('md-drugs:server:givemethingridients')
+ startedmeth = nil
+ if math.random(1,100) <= 30 then
+ DeleteVehicle(methcar)
+ DeleteEntity(methdriver)
+ DeleteEntity(methpilot)
+ end
+ end,
+ }, nil )
else
repeat
Wait(1000)
@@ -653,54 +506,40 @@ end
end
function SetUpPeds()
+ AddRelationshipGroup('setups')
local ped = GetEntityCoords(PlayerPedId())
-local CokePed = CreatePed(0, "g_m_y_famdnf_01", ped.x+3, ped.y-5, ped.z-1, 90.0, true, true)
-local CokePed2 = CreatePed(0,"g_m_y_famdnf_01", ped.x+6, ped.y-10, ped.z-1, 90.0, true, true)
-local CokePed3 = CreatePed(0,"g_m_y_famdnf_01", ped.x+-2, ped.y+5, ped.z-1, 90.0, true, true)
-local CokePed4 = CreatePed(0,"g_m_y_famdnf_01", ped.x+8, ped.y-12, ped.z-1, 90.0, true, true)
-local CokePed5 = CreatePed(0,"g_m_y_famdnf_01", ped.x+5, ped.y-2, ped.z-1, 90.0, true, true)
-local CokePed6 = CreatePed(0,"g_m_y_famdnf_01", ped.x+2, ped.y-20, ped.z-1, 90.0, true, true)
-local CokePed7 = CreatePed(0,"g_m_y_famdnf_01", ped.x+1, ped.y-10, ped.z-1, 90.0, true, true)
-AddRelationshipGroup('setups')
-local peds = {CokePed, CokePed2,CokePed3, CokePed4, CokePed5,CokePed6, CokePed7}
-for k, v in pairs (ped) do
- SetPedRelationshipGroupDefaultHash(v, 'setups')
+local peds = {
+ {x = ped.x+3, y = ped.y-5, z = ped.z-1, },
+ {x = ped.x+6, y = ped.y-10, z = ped.z-1,},
+ {x = ped.x+-2,y = ped.y+5, z = ped.z-1,},
+ {x = ped.x+8, y = ped.y-12, z = ped.z-1,},
+ {x = ped.x+5, y = ped.y-2, z = ped.z-1, },
+ {x = ped.x+2, y = ped.y-20, z = ped.z-1,},
+ {x = ped.x+1, y = ped.y-10, z = ped.z-1,},
+}
+for i = 1, #peds do
+ local k = peds[i]
+ print(GetPedRelationshipGroupHash(i) )
+ i = CreatePed(0, "g_m_y_famdnf_01", k.x, k.y, k.z, 90.0, true, true)
+ SetPedRelationshipGroupHash(i, 'setups')
+ GiveWeaponToPed(i, "weapon_pistol", 1, false, true)
+ TaskCombatPed(i, PlayerPedId(), 0, 16)
+ SetPedCombatAttributes(i, 46, true)
end
-SetPedArmour(CokePed, 200)
-SetPedCanSwitchWeapon(CokePed, true)
-GiveWeaponToPed(CokePed, "weapon_pistol", 1, false, true)
-TaskCombatPed(CokePed, PlayerPedId(), 0, 16)
-GiveWeaponToPed(CokePed2, "weapon_pistol", 1, false, true)
-TaskCombatPed(CokePed2, PlayerPedId(), 0, 16)
-GiveWeaponToPed(CokePed3, "weapon_pistol", 1, false, true)
-TaskCombatPed(CokePed3, PlayerPedId(), 0, 16)
-GiveWeaponToPed(CokePed4, "weapon_pistol", 1, false, true)
-TaskCombatPed(CokePed4, PlayerPedId(), 0, 16)
-GiveWeaponToPed(CokePed5, "weapon_pistol", 1, false, true)
-TaskCombatPed(CokePed5, PlayerPedId(), 0, 16)
-GiveWeaponToPed(CokePed6, "weapon_pistol", 1, false, true)
-TaskCombatPed(CokePed6, PlayerPedId(), 0, 16)
-GiveWeaponToPed(CokePed7, "weapon_pistol", 1, false, true)
-TaskCombatPed(CokePed7, PlayerPedId(), 0, 16)
-SetPedCombatAttributes(CokePed, 46, true)
-SetPedCombatAttributes(CokePed2, 46, true)
-SetPedCombatAttributes(CokePed3, 46, true)
-SetPedCombatAttributes(CokePed4, 46, true)
-SetPedCombatAttributes(CokePed5, 46, true)
-SetPedCombatAttributes(CokePed6, 46, true)
-SetPedCombatAttributes(CokePed7, 46, true)
+
end
RegisterCommand('DrugRep', function()
if not Config.TierSystem then return end
+ local rep = lib.callback.await('md-drugs:server:GetRep', false)
lib.registerContext({
id = 'DrugRep',
title = 'Drug Reputation',
options = {
- {icon = "fa-solid fa-face-flushed", title = 'Cocaine: '..QBCore.Functions.GetPlayerData().metadata.coke},
- {icon = "fa-solid fa-syringe", title = 'Heroin: '..QBCore.Functions.GetPlayerData().metadata.heroin},
- {icon = "fa-solid fa-vial", title = 'LSD: '..QBCore.Functions.GetPlayerData().metadata.lsd},
- {icon = "fa-solid fa-plug", title = 'Dealer: '..QBCore.Functions.GetPlayerData().metadata.dealerrep},
+ {icon = "fa-solid fa-face-flushed", title = 'Cocaine: '..rep.coke},
+ {icon = "fa-solid fa-syringe", title = 'Heroin: '..rep.heroin},
+ {icon = "fa-solid fa-vial", title = 'LSD: '..rep.lsd},
+ {icon = "fa-solid fa-plug", title = 'Dealer: '..rep.dealerrep},
}
})
lib.showContext('DrugRep')
diff --git a/client/cocaine.lua b/client/cocaine.lua
index 1a82378..66ebd51 100644
--- a/client/cocaine.lua
+++ b/client/cocaine.lua
@@ -14,31 +14,8 @@ RegisterNetEvent('coke:respawnCane', function(loc)
local hash = GetHashKey(v.model)
if not CocaPlant[loc] then
CocaPlant[loc] = CreateObject(hash, v.location, false, true, true)
- Freeze(CocaPlant[loc], true, v.heading)
- local options = {
- {
- icon = "fas fa-hand",
- label = "pick Cocaine",
- action = function()
- if not pick(loc) then return end
- end
- }
- }
- local optionsox = {
- {
- icon = "fas fa-hand",
- label = "pick Cocaine",
- distance = 2.5,
- onSelect = function()
- if not pick(loc) then return end
- end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(CocaPlant[loc], optionsox)
- else
- exports['qb-target']:AddTargetEntity(CocaPlant[loc], {options = options, distance = 2.5})
- end
+ Freeze(CocaPlant[loc], true, v.heading)
+ AddSingleModel(CocaPlant[loc], {icon = 'fas fa-hand', label = 'Pick Cocaine', action = function() if not pick(loc) then return end end}, loc)
end
end)
@@ -54,32 +31,9 @@ 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)
- local options = {
- {
- icon = "fas fa-hand",
- label = "pick Cocaine",
- action = function()
- if not pick(k) then return end
- end
- }
- }
- local optionsox = {
- {
- icon = "fas fa-hand",
- label = "pick Cocaine",
- distance = 2.5,
- onSelect = function()
- if not pick(k) then return end
- end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(CocaPlant[k], optionsox)
- else
- exports['qb-target']:AddTargetEntity(CocaPlant[k], {options = options, distance = 2.5})
+ AddSingleModel(CocaPlant[k], {icon = 'fas fa-hand', label = 'Pick Cocaine', action = function() if not pick(k) then return end end}, k)
end
end
- end
end)
AddEventHandler('onResourceStart', function(resource)
@@ -137,50 +91,13 @@ RegisterNetEvent("md-drugs:client:bagcoke", function()
end)
CreateThread(function()
- local options = {
- { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = "cut up", canInteract = function()
- if cuttingcoke == nil and baggingcoke == nil then return true end
- end
- },
- }
- local options2 = {
- { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = "bagging", canInteract = function()
- if baggingcoke == nil and cuttingcoke == nil then return true end end }, }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = vector3(1093.17, -3195.74, -39.19 -1), size = vec3(1,1,1), options = options})
- exports.ox_target:addBoxZone({coords = vector3(1093.17, -3195.74, -39.19 -1), size = vec3(1,1,1), options = options2})
- else
- exports['qb-target']:AddBoxZone("cutcokepowder",vector3(1093.17, -3195.74, -39.19 -1),1.5, 1.75, {name = "cutcokepowder", minZ = -40.0,maxZ = -38.0,}, { options = options, distance = 2.0 })
- exports['qb-target']:AddBoxZone("bagcokepowder",vector3(1090.29, -3195.66, -39.13 - 1),1.5, 1.75, {name = "bagcokepowder", minZ = -40, maxZ = -38,}, {options = options2, distance = 2.0})
- end
if Config.FancyCokeAnims == false then
- for k, v in pairs (Config.CuttingCoke) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = "Cut Coke", data = k, distance = 2.0,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- },
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("cutcoke"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="cutcoke"..k, heading = 156.0,minZ = v.loc.z-1, maxZ = v.loc.z+1, }, {options = options, distance = 1.5})
- end
- end
- for k, v in pairs (Config.BaggingCoke) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = "Bag Coke", data = k, distance = 2.0,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- },
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("bagcoke"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="bagcoke"..k, heading = 156.0,minZ = v.loc.z-1, maxZ = v.loc.z+1, }, {options = options, distance = 1.5})
- end
- end
+ AddBoxZoneMulti('cuttcoke', Config.CuttingCoke, { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = "Cut Coke"})
+ AddBoxZoneMulti('baggcoke', Config.BaggingCoke, { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = "Bag Coke"})
+ else
+ AddBoxZoneSingle('cutcoke', vector3(1093.17, -3195.74, -39.19),
+ { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = "cut up", canInteract = function()if cuttingcoke == nil and baggingcoke == nil then return true end end })
+ AddBoxZoneSingle('bagcokepowder', vector3(1090.29, -3195.66, -39.13),
+ { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = "bagging", canInteract = function() if baggingcoke == nil and cuttingcoke == nil then return true end end })
end
end)
diff --git a/client/cornerselling.lua b/client/cornerselling.lua
index 870e813..d862af3 100644
--- a/client/cornerselling.lua
+++ b/client/cornerselling.lua
@@ -1,11 +1,47 @@
local QBCore = exports['qb-core']:GetCoreObject()
local sell = false
+local sold = false
+local targbusy = false
+
+local function sellDrug(item, amount, price, targ)
+ PoliceCall(20)
+ targbusy = true
+ if IsPedInAnyVehicle(PlayerPedId(), true) then
+ Notify('STRANGER DANGER, I WONT GET IN THE CAR WITH YOU', 'error')
+ FreezeEntityPosition(targ, false)
+ ClearPedTasks(targ)
+ Wait(10000)
+ DeletePed(targ)
+ targbusy = false
+ sold = true
+ sell = false
+ return end
+ if not progressbar('Selling ' .. GetLabel(item) .. '!', 4000, 'uncuff') then return end
+ TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, amount, price)
+ FreezeEntityPosition(targ, false)
+ ClearPedTasks(targ)
+ Wait(10000)
+ DeletePed(targ)
+ targbusy = false
+ sold = true
+ end
+
+local function deny(targ)
+ PoliceCall(20)
+ targbusy = true
+ if not progressbar('Telling This Dumbass To Leave!', 4000, 'argue5') then return end
+ FreezeEntityPosition(targ, false)
+ ClearPedTasks(targ)
+ Wait(10000)
+ DeletePed(targ)
+ targbusy = false
+ sold = true
+end
function Cornersell()
local targ = lib.GetClosestPed(GetEntityCoords(PlayerPedId()), 8)
if targ == nil then return end
- if IsPedInAnyVehicle(targ, false) or GetEntityHealth(targ) == 0 then return end
- local sold = false
+ if IsPedInAnyVehicle(targ, false) or GetEntityHealth(targ) == 0 or not IsPedHuman(targ) then return end
TaskGoToCoordAnyMeans(targ, GetEntityCoords(PlayerPedId()), 1.0, 0, 0, 0, 0)
repeat
Wait(1000)
@@ -13,110 +49,31 @@ function Cornersell()
lib.requestAnimDict("rcmme_tracey1")
TaskStartScenarioInPlace(targ, "WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT", 0, false)
FreezeEntityPosition(targ, true)
- local item, amount = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false)
+ local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false)
if item == 'nothing' then Notify(' You Aint Got Shit', 'error') sell = false FreezeEntityPosition(targ, false) ClearPedTasks(targ) return false end
- local bagAmount = math.random(1, amount)
- if bagAmount > 15 then bagAmount = math.random(1,15) end
- local table = QBConfig.DrugsPrice[item]
- local price = math.random(table['min'], table['max'] ) * bagAmount
- local targbusy = false
- local options = {
- { label = 'Sell ' .. bagAmount .. ' Of ' .. GetLabel(item) .. ' For $' .. price .. '!', icon = "fas fa-eye",
- onSelect = function()
- PoliceCall(20)
- targbusy = true
- if IsPedInAnyVehicle(PlayerPedId(), true) then
- Notify('STRANGER DANGER, I WONT GET IN THE CAR WITH YOU', 'error')
- FreezeEntityPosition(targ, false)
- ClearPedTasks(targ)
- Wait(10000)
- DeletePed(targ)
- targbusy = false
- sold = true
- sell = false
- return end
- if not progressbar('Selling ' .. GetLabel(item) .. '!', 4000, 'uncuff') then return end
- TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, bagAmount, price)
- FreezeEntityPosition(targ, false)
- ClearPedTasks(targ)
- Wait(10000)
- DeletePed(targ)
- targbusy = false
- sold = true
-
- end,
- canInteract = function()
- if not targbusy then return true end end,
- distance = 2.0
- },
- { label = 'Deny Price', icon = "fas fa-eye",
- onSelect = function()
- PoliceCall(20)
- targbusy = true
- if not progressbar('Telling This Dumbass To Leave!', 4000, 'argue5') then return end
- FreezeEntityPosition(targ, false)
- ClearPedTasks(targ)
- Wait(10000)
- DeletePed(targ)
- targbusy = false
- sold = true
- end,
- canInteract = function()
- if not targbusy then return true end end,
- distance = 2.0
- },
- }
- local optionsqb = {
- { label = 'Sell ' .. bagAmount .. ' Of ' .. GetLabel(item) .. ' For $' .. price .. '!', icon = "fas fa-eye",
+ local options = {
+ { label = 'Sell ' .. amount .. ' Of ' .. GetLabel(item) .. ' For $' .. price .. '!', icon = "fas fa-eye",
action = function()
- PoliceCall(20)
- targbusy = true
- if IsPedInAnyVehicle(PlayerPedId(), true) then
- Notify('STRANGER DANGER, I WONT GET IN THE CAR WITH YOU', 'error')
- FreezeEntityPosition(targ, false)
- ClearPedTasks(targ)
- Wait(10000)
- DeletePed(targ)
- targbusy = false
- sold = true
- sell = false
- return end
- if not progressbar('Selling ' .. GetLabel(item) .. '!', 4000, 'uncuff') then return end
- TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, bagAmount, price)
- FreezeEntityPosition(targ, false)
- ClearPedTasks(targ)
- Wait(10000)
- DeletePed(targ)
- targbusy = false
- sold = true
-
+ sellDrug(item, amount, price, targ)
end,
- canInteract = function()
- if not targbusy then return true end end,
- distance = 2.0
+ onSelect = function()
+ sellDrug(item, amount, price, targ)
+ end,
+ canInteract = function()
+ if not targbusy then return true end end,
},
{ label = 'Deny Price', icon = "fas fa-eye",
action = function()
- PoliceCall(20)
- targbusy = true
- if not progressbar('Telling This Dumbass To Leave!', 4000, 'argue5') then return end
- FreezeEntityPosition(targ, false)
- ClearPedTasks(targ)
- Wait(10000)
- DeletePed(targ)
- targbusy = false
- sold = true
+ deny(targ)
end,
+ onSelect = function()
+ deny(targ)
+ end,
canInteract = function()
if not targbusy then return true end end,
- distance = 2.0
},
- }
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(targ, options)
- else
- exports['qb-target']:AddTargetEntity(targ, { options = optionsqb, distance = 2.0})
- end
+ }
+ AddMultiModel(targ, options, nil)
repeat
Wait(1000)
until sold
@@ -125,7 +82,7 @@ end
RegisterNetEvent('md-drugs:client:cornerselling', function()
if not GetCops(QBConfig.MinimumDrugSalePolice) then return end
- local item, amount = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false)
+ local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false)
if item ~= 'nothing' then
if sell then
Notify('Lazy Ass Cant Even Sell Drugs', 'error')
diff --git a/client/deliveries.lua b/client/deliveries.lua
index 961a8ba..fb3056f 100644
--- a/client/deliveries.lua
+++ b/client/deliveries.lua
@@ -1,40 +1,5 @@
local QBCore = exports['qb-core']:GetCoreObject()
-local currentDealer = nil
-local dealerIsHome = false
-local waitingDelivery = nil
-local activeDelivery = nil
-local deliveryTimeout = 0
-local waitingKeyPress = false
-local dealerCombo = nil
-local drugDeliveryZone
-
--- Handlers
-
-AddStateBagChangeHandler('isLoggedIn', nil, function(_, _, value)
- if value then
- QBCore.Functions.TriggerCallback('md-drugs:server:RequestConfig', function(DealerConfig)
- QBConfig.Dealers = DealerConfig
- end)
- Wait(1000)
- InitZones()
- else
- if dealerCombo then dealerCombo:destroy() end
- end
-end)
-
--- Functions
-
-local function GetClosestDealer()
- local ped = PlayerPedId()
- local pCoords = GetEntityCoords(ped)
- for k, v in pairs(QBConfig.Dealers) do
- local dealerCoords = vector3(v.coords.x, v.coords.y, v.coords.z)
- if #(pCoords - dealerCoords) < 2.0 then
- currentDealer = k
- break
- end
- end
-end
+local isActive = false
RegisterNetEvent('md-drugs:client:opendealermenu', function()
local dealermenu = {}
if Config.StupidassNewQbItemName then
@@ -80,281 +45,75 @@ RegisterNetEvent('md-drugs:client:opendealermenu', function()
end
lib.showContext('dealermenu')
end)
-local function RandomDeliveryItemOnRep()
- local myRep = QBCore.Functions.GetPlayerData().metadata["dealerrep"]
- local availableItems = {}
- for k, _ in pairs(QBConfig.DeliveryItems) do
- if QBConfig.DeliveryItems[k]["minrep"] <= myRep then
- availableItems[#availableItems+1] = k
- end
- end
- return availableItems[math.random(1, #availableItems)]
-end
-local function RequestDelivery()
- if not waitingDelivery then
- GetClosestDealer()
-
- local amount = math.random(1, 3)
- local item = RandomDeliveryItemOnRep()
-
- Notify(Lang.Delivery.search, 'success')
- if Config.NearbyDeliveries == true then
- local playerPed = PlayerPedId()
- local playerCoords = GetEntityCoords(playerPed)
- local nearbyLocations = {}
- -- Filter out the nearby locations
- for _, location in ipairs(Config.DeliveryLocations) do
- local distance = #(playerCoords - location.coords)
- if distance <= Config.DeliveryWithin then
- nearbyLocations[#nearbyLocations + 1] = location
- end
- end
-
- -- Select a random location from the nearby locations
- if #nearbyLocations > 0 then
- local selectedLocation = nearbyLocations[math.random(1, #nearbyLocations)]
- waitingDelivery = {
- ["coords"] = selectedLocation.coords,
- ["locationLabel"] = selectedLocation.label,
- ["amount"] = amount,
- ["dealer"] = currentDealer,
- ["itemData"] = Config.DeliveryItems[item],
- ["item"] = item
- }
- else
- Notify(Lang.Delivery.none, 'error')
-
- end
- else
- local location = math.random(1, #QBConfig.DeliveryLocations)
-
- waitingDelivery = {
- ["coords"] = QBConfig.DeliveryLocations[location]["coords"],
- ["locationLabel"] = QBConfig.DeliveryLocations[location]["label"],
- ["amount"] = amount,
- ["dealer"] = currentDealer,
- ["itemData"] = QBConfig.DeliveryItems[item],
- ["item"] = item
- }
- if QBConfig.Debug == true then
- print(QBConfig.DeliveryLocations[location]["coords"])
- print(QBConfig.DeliveryLocations[location]["label"])
- end
- end
-
- TriggerServerEvent('md-drugs:server:giveDeliveryItems', waitingDelivery)
- SetTimeout(2000, function()
- TriggerServerEvent('qb-phone:server:sendNewMail', {
- sender = QBConfig.Dealers[currentDealer]["name"],
- subject = "Delivery Location",
- message = "Deliver This For Me",
-
- })
- end)
- TriggerEvent("md-drugs:client:setLocation",waitingDelivery)
- else
- Notify(Lang.Delivery.busy, 'error')
- end
-end
-
-local function DeliveryTimer()
- CreateThread(function()
- while deliveryTimeout - 1 > 0 do
- deliveryTimeout = deliveryTimeout - 1
- Wait(1000)
- end
- deliveryTimeout = 0
- end)
-end
-
-
-
-local function DeliverStuff()
- if deliveryTimeout > 0 then
- Wait(500)
- TriggerEvent('animations:client:EmoteCommandStart', {'uncuff'})
- PoliceCall(20)
- progressbar(Lang.Delivery.pack, 4000, 'uncuff')
- TriggerServerEvent('md-drugs:server:successDelivery', activeDelivery, true)
- activeDelivery = nil
- exports['qb-target']:RemoveZone('drugDeliveryZone')
- ClearPedTasks(PlayerPedId())
- else
- TriggerServerEvent('md-drugs:server:successDelivery', activeDelivery, false)
- end
- deliveryTimeout = 0
-end
-
-local function SetMapBlip(x, y)
- SetNewWaypoint(x, y)
- Notify(Lang.Delivery.found, 'success');
-end
-
-
-
-
-function InitZones()
- if next(QBConfig.Dealers) == nil then return end
-
- for k,v in pairs(QBConfig.Dealers) do
+CreateThread(function()
+ local dealer = {}
+ local getDealers = lib.callback.await('md-drugs:server:getDealers', false)
+ for k,v in pairs(getDealers) do
local Ped = "g_m_y_famdnf_01"
- RequestModel(Ped)
- while not HasModelLoaded(Ped) do
- Wait(0)
- end
- testdealer = CreatePed(0, Ped,v.coords.x,v.coords.y,v.coords.z-1, 90.0, false, false)
- Freeze(testdealer, true, 90)
- exports["qb-target"]:AddBoxZone("dealer_"..k, vector3(v.coords.x, v.coords.y, v.coords.z), 1.5, 1.5, {
- name = "dealer_"..k,
- heading = v.heading,
- minZ = v.coords.z - 1,
- maxZ = v.coords.z + 1,
- debugPoly = false,
- }, {
- options = {
- {
- icon = 'fas fa-user-secret',
- label = "Deliver",
- action = function()
- RequestDelivery()
- end,
- canInteract = function()
- GetClosestDealer()
- local hours = GetClockHours()
- local min = QBConfig.Dealers[currentDealer]["time"]["min"]
- local max = QBConfig.Dealers[currentDealer]["time"]["max"]
- if max < min then
- if hours <= max then
- if not waitingDelivery then
- return true
- end
- elseif hours >= min then
- if not waitingDelivery then
- return true
- end
- end
- else
- if hours >= min and hours <= max then
- if not waitingDelivery then
- return true
- end
- end
- end
- end
- },
- {
- icon = 'fas fa-user-secret',
- label = "Open Shop",
- action = function()
- TriggerEvent('md-drugs:client:opendealermenu')
- end,
- canInteract = function()
- GetClosestDealer()
- local hours = GetClockHours()
- local min = QBConfig.Dealers[currentDealer]["time"]["min"]
- local max = QBConfig.Dealers[currentDealer]["time"]["max"]
- if max < min then
- if hours <= max then
- return true
- elseif hours >= min then
- return true
- end
- else
- if hours >= min and hours <= max then
- return true
- end
- end
- end
- }
- },
- distance = 1.5
- })
+ lib.requestModel(Ped, Config.RequestModelTime)
+ local loc = json.decode(v.coords)
+ dealer[k] = CreatePed(0, Ped,loc.x,loc.y, loc.z-1, loc.h, false, false)
+ Freeze(dealer[k], true, loc.h)
+ local options = {
+ {
+ icon = 'fas fa-user-secret',
+ label = "Deliver For " .. v.name,
+ action = function()
+ local bool, item, amount, coords = lib.callback.await('md-drugs:server:GetDeliveryItem', false, k)
+ if bool then
+ Email('Not A Drug Dealer', 'Hurry Up And Get The Package To The Buyer', 'I Swear To God If It Doesnt Get There I Will Tell Your Mom You Said Fuck Just Bring ' .. amount .. ' Of '.. GetLabel(item) .. '!' )
+ TriggerEvent('md-drugs:client:setLocation', {bool = bool, item = item, amount = amount, coords = coords})
+ end
+ end,
+ onSelect = function()
+ local bool, item, amount, coords = lib.callback.await('md-drugs:server:GetDeliveryItem', false, k)
+ if item then
+ TriggerEvent('md-drugs:client:setLocation', {bool = bool, item = item, amount = amount, coords = coords})
+ Email('Not A Drug Dealer', 'Hurry Up And Get The Package To The Buyer', 'I Swear To God If It Doesnt Get There I Will Tell Your Mom You Said Fuck Just Bring ' .. amount .. ' Of '.. GetLabel(item) .. '!' )
+ end
+ end
+ },
+ {
+ icon = 'fas fa-user-secret',
+ label = "Open " .. v.name .. "'s Shop",
+ action = function()
+ TriggerEvent('md-drugs:client:opendealermenu')
+ end,
+ onSelect = function()
+ TriggerEvent('md-drugs:client:opendealermenu')
+ end
+
+ }
+ }
+ AddMultiModel(dealer[k], options)
end
-
-end
-
--- Events
-
-RegisterNetEvent('md-drugs:client:RefreshDealers', function(DealerData)
- if dealerCombo then dealerCombo:destroy() end
- QBConfig.Dealers = DealerData
- Wait(1000)
- InitZones()
end)
-RegisterNetEvent('md-drugs:client:updateDealerItems', function(itemData, amount)
- TriggerServerEvent('md-drugs:server:updateDealerItems', itemData, amount, currentDealer)
-end)
-
-RegisterNetEvent('md-drugs:client:setDealerItems', function(itemData, amount, dealer)
- QBConfig.Dealers[dealer]["products"][itemData.slot].amount = QBConfig.Dealers[dealer]["products"][itemData.slot].amount - amount
-end)
-
-RegisterNetEvent('md-drugs:client:setLocation', function(locationData)
- if activeDelivery then
- SetMapBlip(activeDelivery["coords"]["x"], activeDelivery["coords"]["y"])
- Notify(Lang.Delivery.already, 'error')
+RegisterNetEvent('md-drugs:client:setLocation', function(data)
+ local coord = json.decode(data.coords)
+ if isActive then
+ Blip(vector3(coord.x, coord.y, coord.z), 'Drop Off')
return
end
- activeDelivery = locationData
- deliveryTimeout = 300
- DeliveryTimer()
- SetMapBlip(activeDelivery["coords"].x, activeDelivery["coords"].y)
- local Ped = "g_m_y_famdnf_01"
- RequestModel(Ped)
- while not HasModelLoaded(Ped) do
- Wait(0)
- end
-
- Buyer = CreatePed(0, Ped,activeDelivery["coords"].x, activeDelivery["coords"].y, activeDelivery["coords"].z-1, 180.0, false, false)
- Freeze(Buyer, true, 180)
- exports['qb-target']:AddTargetEntity(Buyer, {
- options = {
- {
- icon = 'fas fa-user-secret',
- label = "Hand Off",
- action = function()
- DeliverStuff()
- Wait(4000)
- DeleteEntity(Buyer)
- waitingDelivery = nil
- end,
- canInteract = function()
- if waitingDelivery then
- return true
- end
- end
- }
- },
- distance = 1.5
- })
-
-end)
-
-RegisterNetEvent('md-drugs:client:sendDeliveryMail', function(type, deliveryData)
- if type == 'perfect' then
- TriggerServerEvent('qb-phone:server:sendNewMail', {
- sender = QBConfig.Dealers[deliveryData["dealer"]]["name"],
- subject = "Delivery",
- message = "You did it"
- })
- elseif type == 'bad' then
- TriggerServerEvent('qb-phone:server:sendNewMail', {
- sender = QBConfig.Dealers[deliveryData["dealer"]]["name"],
- subject = "Delivery",
- message = "You Fucked Me Over"
- })
- elseif type == 'late' then
- TriggerServerEvent('qb-phone:server:sendNewMail', {
- sender = QBConfig.Dealers[deliveryData["dealer"]]["name"],
- subject = "Delivery",
- message = "Better Late Than Dead"
- })
- end
-end)
-
-RegisterCommand('checkrep', function()
- local drugrep = QBCore.Functions.GetPlayerData().metadata["dealerrep"]
- Notify(Lang.Delivery.checkrep..drugrep)
-end, false)
+ isActive = true
+ Blip(vector3(coord.x, coord.y, coord.z), 'Drop Off')
+ Buyer = CreatePed(0, "g_m_y_famdnf_01",coord.x, coord.y, coord.z-1, 180.0, false, false)
+ Freeze(Buyer, true, 180)
+ AddSingleModel(Buyer, {
+ icon = 'fas fa-user-secret',
+ label = "Hand Off",
+ action = function()
+ if not progressbar('Delivering The Package', 4000, 'uncuff') then return end
+ isActive = false
+ DeletePed(Buyer)
+ RemoveBlip(deliveryBlip)
+ TriggerServerEvent('md-drugs:server:giveDeliveryItems', data.item, data.amount)
+ end,
+ canInteract = function()
+ if isActive then
+ return true
+ end
+ end
+ }, nil)
+end)
\ No newline at end of file
diff --git a/client/functions.lua b/client/functions.lua
index 2f72fac..3b94d99 100644
--- a/client/functions.lua
+++ b/client/functions.lua
@@ -49,27 +49,59 @@ function progressbar(text, time, anim)
until cancelled or test
if test then return true end
else
- print"dude, it literally tells you what you need to set it as in the config"
+ print"^1 SCRIPT ERROR: Md-DRUGS set your progressbar with one of the options!"
end
end
function minigame(num1, num2)
- local check
+ local game = Config.Minigames
if minigametype == 'ps' then
+ local check
exports['ps-ui']:Circle(function(success)
check = success
- end, num1, num2)
+ end, game['ps'].amount, game['ps'].speed)
return check
elseif minigametype == 'ox' then
- num1 = 'easy'
- if num2 <= 6 then num2 = 'hard' elseif num2 >= 7 and num2 <= 12 then num2 = 'medium' else num2 = 'easy' end
- local success = lib.skillCheck({num1, num2}, {'1', '2', '3', '4'})
- return success
- elseif minigametype == 'none' then
- return true
- else
- print"dude, it literally tells you what you need to set it as in the config"
+ local success = lib.skillCheck(game['ox'], {'1', '2', '3', '4'})
+ return success
+ elseif minigametype == 'blcirprog' then
+ local success = exports.bl_ui:CircleProgress(game['blcirprog'].amount, game['blcirprog'].speed)
+ return success
+ elseif minigametype == 'blprog' then
+ local success = exports.bl_ui:Progress(game['blprog'].amount, game['blprog'].speed)
+ return success
+ elseif minigametype == 'blkeyspam' then
+ local success = exports.bl_ui:KeySpam(game['blkeyspam'].amount, game['blprog'].difficulty)
+ return success
+ elseif minigametype == 'blkeycircle' then
+ local success = exports.bl_ui:KeyCircle(game['blkeycircle'].amount, game['blkeycircle'].difficulty, game['blkeycircle'].keynumbers)
+ return success
+ elseif minigametype == 'blnumberslide' then
+ local success = exports.bl_ui:NumberSlide(game['blnumberslide'].amount, game['blnumberslide'].difficulty, game['blnumberslide'].keynumbers)
+ return success
+ elseif minigametype == 'blrapidlines' then
+ local success = exports.bl_ui:RapidLines(game['blrapidlines'].amount, game['blrapidlines'].difficulty, game['blrapidlines'].numberofline)
+ return success
+ elseif minigametype == 'blcircleshake' then
+ local success = exports.bl_ui:CircleShake(game['blcircleshake'].amount, game['blcircleshake'].difficulty, game['blcircleshake'].stages)
+ return success
+ elseif minigametype == 'glpath' then
+ exports["glow_minigames"]:StartMinigame(function(success)
+ if success then return true else return false end
+ end, "path", game['glpath'])
+ elseif minigametype == 'glspot' then
+ exports["glow_minigames"]:StartMinigame(function(success)
+ if success then return true else return false end
+ end, "spot", game['glspot'])
+ elseif minigametype == 'glmath' then
+ exports["glow_minigames"]:StartMinigame(function(success)
+ if success then return true else return false end
+ end, "math", game['glmath'])
+ elseif minigametype == 'none' then
+ return true
+ else
+ print"^1 SCRIPT ERROR: Md-DRUGS set your minigame with one of the options!"
end
end
@@ -82,8 +114,8 @@ end
elseif notifytype == 'okok' then
exports['okokNotify']:Alert('', text, 4000, type, false)
else
- print"dude, it literally tells you what you need to set it as in the config"
- end
+ print"^1 SCRIPT ERROR: Md-DRUGS set your notification with one of the options!"
+ end
end
function GetImage(img)
@@ -126,13 +158,32 @@ end
function ItemCheck(item)
local success
if GetResourceState('ox_inventory') == 'started' then
- if exports.ox_inventory:GetItemCount(item) >= 1 then return true else Notify('You Need ' .. GetLabel(item) .. " !", 'error') end
+ if exports.ox_inventory:GetItemCount(item) >= 1 then return true else Notify('You Need ' .. GetLabel(item) .. " !", 'error') return false end
else
if QBCore.Shared.Items[item] == nil then print("There Is No " .. item .. " In Your QB Items.lua") return end
- if QBCore.Functions.HasItem(item) then success = item return success else Notify('You Need ' .. QBCore.Shared.Items[item].label .. " !", 'error') end
+ if QBCore.Functions.HasItem(item) then return true else Notify('You Need ' .. QBCore.Shared.Items[item].label .. " !", 'error') return false end
end
end
+function ItemCheckMulti(item)
+ local need = 0
+ local has = 0
+ for k,v in pairs (item) do
+ need = need + 1
+ if GetResourceState('ox_inventory') == 'started' then
+ if exports.ox_inventory:GetItemCount(v) >= 1 then has = has + 1 else Notify('You Need ' .. GetLabel(v) .. " !", 'error') end
+ else
+ if QBCore.Shared.Items[v] == nil then print("There Is No " .. item .. " In Your QB Items.lua") return end
+ if QBCore.Functions.HasItem(v) then has = has + 1 else Notify('You Need ' .. QBCore.Shared.Items[v].label .. " !", 'error') end
+ end
+ end
+ if need == has then
+ return true
+ else
+ return false
+ end
+end
+
function Email(sender, subject, message)
if Config.Phone == 'yflip' then
local receiver = GetPlayerServerId(PlayerId())
@@ -212,4 +263,221 @@ function Freeze(entity, toggle, head)
FreezeEntityPosition(entity, toggle)
SetEntityHeading(entity, head)
SetBlockingOfNonTemporaryEvents(entity, toggle)
-end
\ No newline at end of file
+end
+
+function tele(coords)
+ DoScreenFadeOut(500)
+ Wait(1000)
+ SetEntityCoords(PlayerPedId(),coords.x, coords.y, coords.z)
+ Wait(1000)
+ DoScreenFadeIn(500)
+end
+
+function Blip(entity, text)
+ local deliveryBlip = AddBlipForCoord(entity)
+ SetBlipSprite(deliveryBlip, 1)
+ SetBlipDisplay(deliveryBlip, 2)
+ SetBlipScale(deliveryBlip, 1.0)
+ SetBlipAsShortRange(deliveryBlip, false)
+ SetBlipColour(deliveryBlip, 27)
+ BeginTextCommandSetBlipName("STRING")
+ AddTextComponentSubstringPlayerName(text)
+ EndTextCommandSetBlipName(deliveryBlip)
+ SetBlipRoute(deliveryBlip, true)
+end
+
+function RemoveBlips()
+ RemoveBlip(deliveryBlip)
+end
+
+function AddBoxZoneSingle(name, loc, data)
+ if Config.Target == 'qb' then
+ exports['qb-target']:AddBoxZone(name, loc, 1.5, 1.75, {name = name, minZ = loc.z-1,maxZ = loc.z +1},
+ { options = {
+ {
+ type = data.type or nil,
+ event = data.event or nil,
+ action = data.action or nil,
+ icon = data.icon,
+ label = data.label,
+ data = data.data,
+ canInteract = data.canInteract,
+ }
+ },
+ distance = 2.0
+ })
+ elseif Config.Target == 'ox' then
+ exports.ox_target:addBoxZone({coords = loc, size = vec3(1,1,1), options = {
+ {
+ type = data.type or nil,
+ event = data.event or nil,
+ onSelect = data.action or nil,
+ distance = 2.5,
+ icon = data.icon,
+ label = data.label,
+ data = data.data,
+ canInteract = data.canInteract,
+ }
+ }, })
+ end
+end
+
+function AddBoxZoneMulti(name, table, data)
+ for k, v in pairs (table) do
+ if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
+ if Config.Target == 'qb' then
+ exports['qb-target']:AddBoxZone(name .. k, v.loc, 1.5, 1.75, {name = name..k, minZ = v.loc.z-1.50,maxZ = v.loc.z +1.5},
+ { options = {
+ {
+ type = data.type or nil,
+ event = data.event or nil,
+ action = data.action or nil,
+ icon = data.icon,
+ label = data.label,
+ data = k,
+ canInteract = data.canInteract or function()
+ if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
+ }
+ },
+ distance = 2.5
+ })
+ elseif Config.Target == 'ox' then
+ exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1), options = {
+ {
+ type = data.type or nil,
+ event = data.event or nil,
+ onSelect = data.action or nil,
+ icon = data.icon,
+ label = data.label,
+ data = k,
+ distance = 2.5,
+ canInteract = data.canInteract or function()
+ if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
+ }
+ }, })
+ end
+ end
+end
+
+function AddSingleModel(model, data, num)
+ if Config.Target == 'qb' then
+ exports['qb-target']:AddTargetEntity(model, {options = {
+ {icon = data.icon, label = data.label, event = data.event or nil, action = data.action or nil, data = num }
+ }, distance = 2.5})
+ elseif Config.Target == 'ox' then
+ exports.ox_target:addLocalEntity(model, {icon = data.icon, label = data.label, event = data.event or nil, onSelect = data.action or nil, data = num, distance = 2.5 })
+ end
+end
+
+function AddMultiModel(model, data, num)
+ if Config.Target == 'qb' then
+ exports['qb-target']:AddTargetEntity(model, {options = data, distance = 2.5})
+ elseif Config.Target == 'ox' then
+ exports.ox_target:addLocalEntity(model, data)
+ end
+end
+
+local created = false
+local heading = 180.0
+function StartRay()
+ local run = true
+ local pedcoord = GetEntityCoords(PlayerPedId())
+ local table = CreateObject('v_ret_ml_tablea', pedcoord.x, pedcoord.y, pedcoord.z+1, heading, false, false)
+ repeat
+ local hit, entityHit, endCoords, surfaceNormal, matHash = lib.raycast.cam(511, 4, 10)
+ if not created then
+ created = true
+ lib.showTextUI([[[E] To Place
+ [DEL] To Cancel
+ [<-] To Move Left
+ [->] To Move Right]])
+ else
+ SetEntityCoords(table, endCoords.x, endCoords.y, endCoords.z+1)
+ SetEntityHeading(table, heading)
+ SetEntityCollision(table, false, false)
+ SetEntityAlpha(table, 100)
+ end
+ if IsControlPressed(0, 174) then
+ heading = heading - 2
+ end
+ if IsControlPressed(0, 175) then
+ heading = heading + 2
+ end
+ if IsControlPressed(0, 38) then
+ lib.hideTextUI()
+ run = false
+ DeleteObject(table)
+ created = false
+ return endCoords, heading
+ end
+
+ if IsControlPressed(0, 178) then
+ lib.hideTextUI()
+ run = false
+ created = false
+ DeleteObject(table)
+ return nil, nil
+ end
+ Wait(0)
+ until run == false
+end
+
+function StartRay2()
+ local run = true
+ local pedcoord = GetEntityCoords(PlayerPedId())
+ local table = CreateObject('bkr_prop_coke_press_01aa', pedcoord.x, pedcoord.y, pedcoord.z+1, heading, false, false)
+ repeat
+ local hit, entityHit, endCoords, surfaceNormal, matHash = lib.raycast.cam(511, 4, 10)
+ if not created then
+ created = true
+ lib.showTextUI([[[E] To Place
+ [DEL] To Cancel
+ [<-] To Move Left
+ [->] To Move Right]])
+ else
+ SetEntityCoords(table, endCoords.x, endCoords.y, endCoords.z+1)
+ SetEntityHeading(table, heading)
+ SetEntityCollision(table, false, false)
+ SetEntityAlpha(table, 100)
+ end
+ if IsControlPressed(0, 174) then
+ heading = heading - 2
+ end
+ if IsControlPressed(0, 175) then
+ heading = heading + 2
+ end
+ if IsControlPressed(0, 38) then
+ lib.hideTextUI()
+ run = false
+ DeleteObject(table)
+ created = false
+ return endCoords, heading
+ end
+
+ if IsControlPressed(0, 178) then
+ lib.hideTextUI()
+ run = false
+ created = false
+ DeleteObject(table)
+ return nil, nil
+ end
+ Wait(0)
+ until run == false
+end
+
+
+RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
+ Wait(3000)
+ local check = lib.callback.await('md-drugs:server:GetRep', false)
+
+ return
+end)
+local active = false
+RegisterNetEvent('md-drugs:client:minusTier', function(data)
+ if active then return end
+ if not data then return end
+ active = true
+ if not progressbar('Cutting This ' ..GetLabel(data.item) .. ' More', 4000, 'uncuff') then return end
+ TriggerServerEvent('md-drugs:server:AddMas', data)
+ active = false
+end)
\ No newline at end of file
diff --git a/client/heroin.lua b/client/heroin.lua
index 63ca514..87407ee 100644
--- a/client/heroin.lua
+++ b/client/heroin.lua
@@ -1,52 +1,29 @@
local QBCore = exports['qb-core']:GetCoreObject()
-local CocaPlant = {}
local PoppyPlants = {}
local herointable = false
-local function loadParticle(dict)
- if not HasNamedPtfxAssetLoaded(dict) then
- RequestNamedPtfxAsset(dict)
- end
- while not HasNamedPtfxAssetLoaded(dict) do
- Wait(0)
- end
- SetPtfxAssetNextCall(dict)
+
+local function pickher(loc)
+ if not progressbar(Lang.Heroin.pick, 4000, 'uncuff') then return end
+ TriggerServerEvent("heroin:pickupCane", loc)
end
+
CreateThread(function()
local Ped = "g_m_y_famdnf_01"
lib.requestModel("g_m_y_famdnf_01", Config.RequestModelTime)
local labkitlocation = Config.buyheroinlabkit
local heroinkitdealer = CreatePed(0, Ped, labkitlocation.x, labkitlocation.y, labkitlocation.z-1, labkitlocation.w, false, false)
Freeze(heroinkitdealer, true, labkitlocation.w)
- local options = {
- { label = "Buy Heroin Lab Kit", icon = "fas fa-eye", event = "md-drugs:client:buyheroinlabkit", distance = 2.0},
- }
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(heroinkitdealer, options)
- else
- exports['qb-target']:AddTargetEntity(heroinkitdealer, { options = options, distance = 2.0})
- end
+ AddSingleModel(heroinkitdealer, { label = "Buy Heroin Lab Kit", icon = "fas fa-eye", event = "md-drugs:client:buyheroinlabkit", distance = 2.0}, nil )
end)
---- plant spawns dont edit
RegisterNetEvent('heroin:respawnCane', function(loc)
local v = GlobalState.PoppyPlants[loc]
local hash = GetHashKey(v.model)
-
if not PoppyPlants[loc] then
PoppyPlants[loc] = CreateObject(hash, v.location, false, true, true)
Freeze(PoppyPlants[loc], true, v.heading)
- exports['qb-target']:AddTargetEntity(PoppyPlants[loc], {
- options = { {
- icon = "fas fa-hand",
- label = "pick Poppies",
- action = function()
- if not progressbar(Lang.Heroin.pick, 4000, 'uncuff') then return end
- TriggerServerEvent("heroin:pickupCane", loc)
- end
- }
- },
- distance = 2.5
- })
+ AddSingleModel(PoppyPlants[loc], {icon = "fas fa-hand", label = "pick Poppies", action = function() pickher(loc) end}, loc )
end
end)
@@ -66,18 +43,7 @@ RegisterNetEvent("heroin:init", function()
if not v.taken then
PoppyPlants[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
Freeze(PoppyPlants[k], true, v.heading)
- exports['qb-target']:AddTargetEntity(PoppyPlants[k], {
- options = { {
- icon = "fas fa-hand",
- label = "Pick Poppies",
- action = function()
- if not progressbar(Lang.Heroin.pick, 4000, 'uncuff') then return end
- TriggerServerEvent("heroin:pickupCane", k)
- end
- }
- },
- distance = 2.5
- })
+ AddSingleModel(PoppyPlants[k], {icon = "fas fa-hand", label = "pick Poppies", action = function() pickher(k) end}, k )
end
end
end)
@@ -126,37 +92,37 @@ RegisterNetEvent("md-drugs:client:buyheroinlabkit", function()
TriggerServerEvent("md-drugs:server:getheroinlabkit")
end)
-RegisterNetEvent("md-drugs:client:setheroinlabkit")
-AddEventHandler("md-drugs:client:setheroinlabkit", function()
+
+RegisterNetEvent("md-drugs:client:setheroinlabkit", function()
if herointable then
Notify(Lang.Heroin.tableout, 'error')
else
-local PedCoords = GetEntityCoords(PlayerPedId())
- if not progressbar(Lang.Heroin.table, 4000, 'uncuff') then TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end
herointable = true
- local heroinlabkit = CreateObject("v_ret_ml_tablea", PedCoords.x+1, PedCoords.y+1, PedCoords.z-1, true, false)
+ local location, head = StartRay()
+ if not location then herointable = false TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end
+ if not progressbar(Lang.Heroin.table, 4000, 'uncuff') then TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end
+ local heroinlabkit = CreateObject("v_ret_ml_tablea", location.x, location.y, location.z, true, false)
+ SetEntityHeading(heroinlabkit, head)
PlaceObjectOnGroundProperly(heroinlabkit)
local options = {
{ event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = "Cook Heroin", data = heroinlabkit},
{ event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = "Pick Up", data = heroinlabkit, canInteract = function() if herointable then return true end end},
}
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(heroinlabkit, options)
- else
- exports['qb-target']:AddTargetEntity(heroinlabkit, {options = options})
- end
+ AddMultiModel(heroinlabkit, options, heroinlabkit)
end
end)
RegisterNetEvent("md-drugs:client:heatliquidheroin", function(data)
-local PedCoords = GetEntityCoords(PlayerPedId())
+ local loc = GetEntityCoords(data.data)
+ local head = GetEntityHeading(data.data)
if not ItemCheck('emptyvial') then return end
if not minigame(2, 8) then
TriggerServerEvent("md-drugs:server:failheatingheroin")
DeleteObject(data.data)
- Wait(100)
- local dirtylabkitheroin = CreateObject("v_ret_ml_tablea", PedCoords.x+1, PedCoords.y+1, PedCoords.z-1, true, false)
+ local dirtylabkitheroin = CreateObject("v_ret_ml_tablea", loc.x, loc.y, loc.z-1, true, false)
+ SetEntityHeading(dirtylabkitheroin, head)
+ PlaceObjectOnGroundProperly(dirtylabkitheroin)
loadParticle("core")
heroinkit = StartParticleFxLoopedOnEntity("exp_air_molotov", dirtylabkitheroin, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false)
SetParticleFxLoopedAlpha(heroinkit, 3.0)
@@ -164,11 +130,7 @@ local PedCoords = GetEntityCoords(PlayerPedId())
local options = {
{ event = "md-drugs:client:cleanheroinlabkit", icon = "fas fa-box-circle-check", label = "Clean It", data = dirtylabkitheroin}
}
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(dirtylabkitheroin,options )
- else
- exports['qb-target']:AddTargetEntity(dirtylabkitheroin, {options = options})
- end
+ AddMultiModel(dirtylabkitheroin, options, nil )
return end
if not progressbar(Lang.Heroin.success, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:heatliquidheroin")
@@ -181,11 +143,18 @@ RegisterNetEvent("md-drugs:client:cleanheroinlabkit", function(data)
TriggerServerEvent("md-drugs:server:removecleaningkitheroin", data.data)
end)
-RegisterNetEvent("md-drugs:client:deletedirtyheroin", function(data)
-DeleteObject(data)
-herointable = false
-Wait(1000)
-TriggerEvent("md-drugs:client:setheroinlabkit")
+RegisterNetEvent("md-drugs:client:deletedirtyheroin", function(data)
+local location = GetEntityCoords(data)
+local head = GetEntityHeading(data)
+ DeleteObject(data)
+ local heroinlabkit = CreateObject("v_ret_ml_tablea", location.x, location.y, location.z-1, true, false)
+ SetEntityHeading(heroinlabkit, head)
+ PlaceObjectOnGroundProperly(heroinlabkit)
+ local options = {
+ { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = "Cook Heroin", data = heroinlabkit},
+ { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = "Pick Up", data = heroinlabkit, canInteract = function() if herointable then return true end end},
+ }
+ AddMultiModel(heroinlabkit, options, heroinlabkit)
end)
diff --git a/client/lean.lua b/client/lean.lua
index ffdeee3..202bcfd 100644
--- a/client/lean.lua
+++ b/client/lean.lua
@@ -5,14 +5,7 @@ CreateThread(function()
lib.requestModel(current, Config.RequestModelTime)
local SyrupLocation = CreatePed(0, current,Config.SyrupVendor.x,Config.SyrupVendor.y,Config.SyrupVendor.z-1, Config.SyrupVendor.w, false, false)
Freeze(SyrupLocation, true, Config.SyrupVendor.w)
- local options = {
- { type = "client", label = "Get Task", icon = "fas fa-eye", event = "md-drugs:client:getsyruplocationtobuy", distance = 2.0},
- }
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(SyrupLocation, options)
- else
- exports['qb-target']:AddTargetEntity(SyrupLocation, { options = options, distance = 2.0})
- end
+ AddSingleModel(SyrupLocation, { type = "client", label = "Get Task", icon = "fas fa-eye", event = "md-drugs:client:getsyruplocationtobuy", distance = 2.0}, nil )
end)
@@ -20,3 +13,43 @@ RegisterNetEvent("md-drugs:client:getsyruplocationtobuy", function()
Notify(Lang.Lean.marked, "success")
SpawnCarPedChase()
end)
+
+RegisterNetEvent('md-drugs:client:leancraft', function()
+local store = {}
+local label = {}
+local items = lib.callback.await('md-drugs:server:GetRecipe', false,'lean', 'cups')
+for k, v in pairs (items) do
+ label = {}
+ local item = ''
+ for m, d in pairs (items[k].take) do
+ table.insert(label, GetLabel(m) .. ' X ' .. d)
+ end
+ for m,d in pairs (items[k].give) do
+ item = m
+ end
+ store[#store + 1] = {
+ icon = GetImage(item),
+ description = table.concat(label, ", "),
+ title = GetLabel(item),
+ event = 'md-drugs:client:stirlean',
+ args = {
+ item = item,
+ recipe = 'weed',
+ num = k,
+ label = 'Cooking Up ' .. GetLabel(item),
+ table = 'edibles'
+
+ }
+ }
+ lib.registerContext({id = 'leanCraft',title = "Make Lean", options = store})
+end
+lib.showContext('leanCraft')
+end)
+local busy = false
+RegisterNetEvent('md-drugs:client:stirlean', function(data)
+if busy then return end
+ busy = true
+if not progressbar(data.label, 4000, 'uncuff') then busy = false return end
+TriggerServerEvent('md-drugs:server:finishcup', data)
+busy = false
+end)
\ No newline at end of file
diff --git a/client/lsd.lua b/client/lsd.lua
index 34ee9a5..ab63013 100644
--- a/client/lsd.lua
+++ b/client/lsd.lua
@@ -17,14 +17,7 @@ local Ped = "g_m_y_famdnf_01"
lib.requestModel(Ped, Config.RequestModelTime)
local tabdealer = CreatePed(0, Ped,Config.buylsdlabkit.x,Config.buylsdlabkit.y,Config.buylsdlabkit.z-1, Config.buylsdlabkit.w, false, false)
Freeze(tabdealer, true, Config.buylsdlabkit.w)
- local options = {
- { type = "client", label = "Buy LSD Lab Kit", icon = "fas fa-eye", event = "md-drugs:client:buylabkit", distance = 2.0}
- }
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(tabdealer, options)
- else
- exports['qb-target']:AddTargetEntity(tabdealer, {options = options, distance = 2.0})
- end
+ AddSingleModel(tabdealer,{ type = "client", label = "Buy LSD Lab Kit", icon = "fas fa-eye", event = "md-drugs:client:buylabkit", distance = 2.0}, tabdealer )
end)
@@ -41,29 +34,25 @@ RegisterNetEvent("md-drugs:client:getdiethylamide", function(data)
TriggerServerEvent('md-drugs:server:getdiethylamide', data.data)
end)
-RegisterNetEvent("md-drugs:client:setlsdlabkit")
-AddEventHandler("md-drugs:client:setlsdlabkit", function()
+RegisterNetEvent("md-drugs:client:setlsdlabkit", function()
if tableout then
Notify(Lang.lsd.tableout, 'error')
TriggerServerEvent('md-drugs:server:getlabkitback')
else
tableout = true
- local PedCoords = GetEntityCoords(PlayerPedId())
+ local loc, head = StartRay()
+ if not loc then tableout = false TriggerServerEvent('md-drugs:server:getlabkitback') return end
if not progressbar(Lang.lsd.place, 4000, 'uncuff') then TriggerServerEvent('md-drugs:server:getlabkitback') return end
- local labkit = CreateObject("v_ret_ml_tablea", PedCoords.x+1, PedCoords.y+1, PedCoords.z-1, true, false)
+ local labkit = CreateObject("v_ret_ml_tablea", loc.x, loc.y, loc.z-1, true, false)
+ SetEntityHeading(labkit, head)
PlaceObjectOnGroundProperly(labkit)
-
local options = {
- { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = "Heat Liquid" , data = labkit, },
- { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = "Refine", data = labkit, },
- { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = "Dab Sheets", data = labkit, },
- { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = "Pick Up", data = labkit, canInteract = function() if tableout then return true end end},
+ { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = "Heat Liquid" , data = labkit, },
+ { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = "Refine", data = labkit, },
+ { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = "Dab Sheets", data = labkit, },
+ { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = "Pick Up", data = labkit, canInteract = function() if tableout then return true end end},
}
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(labkit, options)
- else
- exports['qb-target']:AddTargetEntity(labkit, {options = options})
- end
+ AddMultiModel(labkit, options, labkit)
end
end)
@@ -75,26 +64,23 @@ RegisterNetEvent("md-drugs:client:getlabkitback", function(data)
end)
RegisterNetEvent("md-drugs:client:heatliquid", function(data)
- local PedCoords = GetEntityCoords(PlayerPedId())
+ local PedCoords = GetEntityCoords(data.data)
dict = "scr_ie_svm_technical2"
if not ItemCheck('lysergic_acid') then return end
if not ItemCheck('diethylamide') then return end
if not minigame(2, 8) then
TriggerServerEvent("md-drugs:server:failheating")
DeleteObject(data.data)
- local dirtylabkit = CreateObject("v_ret_ml_tablea", PedCoords.x+1, PedCoords.y+1, PedCoords.z-1, true, false)
+ local dirtylabkit = CreateObject("v_ret_ml_tablea", PedCoords.x, PedCoords.y, PedCoords.z-1, true, false)
loadParticle(dict)
exitPtfx = StartParticleFxLoopedOnEntity("scr_dst_cocaine", dirtylabkit, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false)
PlaceObjectOnGroundProperly(dirtylabkit)
SetParticleFxLoopedAlpha(exitPtfx, 3.0)
- local options = {
- { event = "md-drugs:client:cleanlabkit", icon = "fas fa-box-circle-check", label = "Clean It", data = dirtylabkit },
+ Wait(100)
+ local options = {
+ { event = "md-drugs:client:cleanlabkit", icon = "fas fa-box-circle-check", label = "Clean It", data = dirtylabkit}
}
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(dirtylabkit, options)
- else
- exports['qb-target']:AddTargetEntity(dirtylabkit, { options = options})
- end
+ AddMultiModel(dirtylabkit, options, nil )
return end
if not progressbar(Lang.lsd.heat, 7000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:heatliquid")
@@ -103,17 +89,22 @@ end)
RegisterNetEvent("md-drugs:client:cleanlabkit", function(data)
if not ItemCheck('cleaningkit') then return end
if not progressbar(Lang.lsd.clean, 4000, 'clean') then return end
- tableout = false
- TriggerServerEvent("md-drugs:server:removecleaningkit", data.data)
+ local check = lib.callback.await('md-drugs:server:removecleaningkit')
+ if check then
+ local coord = GetEntityCoords(data.data)
+ DeleteObject(data.data)
+ local labkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z-1, true, false)
+ PlaceObjectOnGroundProperly(labkit)
+ local options = {
+ { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = "Heat Liquid" , data = labkit, },
+ { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = "Refine", data = labkit, },
+ { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = "Dab Sheets", data = labkit, },
+ { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = "Pick Up", data = labkit, canInteract = function() if tableout then return true end end},
+ }
+ AddMultiModel(labkit, options, labkit)
+ end
end)
-
-RegisterNetEvent("md-drugs:client:resetlsdkit", function(data)
-DeleteObject(data)
-TriggerEvent("md-drugs:client:setlsdlabkit")
-end)
-
-
RegisterNetEvent("md-drugs:client:refinequalityacid", function()
if not ItemCheck('lsd_one_vial') then return end
if not minigame(2, 8) then TriggerServerEvent("md-drugs:server:failrefinequality") return end
diff --git a/client/mescaline.lua b/client/mescaline.lua
index 4125a75..b02a55b 100644
--- a/client/mescaline.lua
+++ b/client/mescaline.lua
@@ -8,19 +8,17 @@ function LoadModel(hash)
Wait(3000)
end
end
-
+local function pick(loc)
+ if not progressbar(Lang.mescaline.pick, 4000, 'uncuff') then return end
+ TriggerServerEvent("Mescaline:pickupCane", loc)
+end
RegisterNetEvent('Mescaline:respawnCane', function(loc)
local v = GlobalState.Mescaline[loc]
local hash = GetHashKey(v.model)
if not Mescaline[loc] then
Mescaline[loc] = CreateObject(hash, v.location, false, true, true)
Freeze(Mescaline[loc], true, v.heading)
- exports['qb-target']:AddTargetEntity(Mescaline[loc], {
- options = {
- {icon = "fas fa-hand",label = "pick Cactus",action = function() if not progressbar(Lang.mescaline.pick, 4000, 'uncuff') then return end TriggerServerEvent("Mescaline:pickupCane", loc)end}
- },
- distance = 2.5
- })
+ AddSingleModel(Mescaline[loc], {icon = "fas fa-hand",label = "pick Cactus",action = function() pick(loc) end}, loc )
end
end)
@@ -40,11 +38,7 @@ RegisterNetEvent("Mescaline:init", function()
if not v.taken then
Mescaline[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
Freeze(Mescaline[k], true, v.heading)
- exports['qb-target']:AddTargetEntity(Mescaline[k], {
- options = { { icon = "fas fa-hand", label = "Pick Mescaline", action = function() if not progressbar(Lang.mescaline.pick, 4000, 'uncuff') then return end TriggerServerEvent("Mescaline:pickupCane", k) end}
- },
- distance = 2.5
- })
+ AddSingleModel(Mescaline[k], {icon = "fas fa-hand",label = "pick Cactus",action = function() pick(k) end}, k)
end
end
end)
diff --git a/client/meth.lua b/client/meth.lua
index 1a8ca64..d65da0e 100644
--- a/client/meth.lua
+++ b/client/meth.lua
@@ -5,6 +5,9 @@ local heated = nil
local active = nil
local function startcook()
+ if not ItemCheck('empty_weed_bag') then return end
+ if not ItemCheck('acetone') then return end
+ if not ItemCheck('ephedrine') then return end
if amonia == nil then
active = true
TriggerServerEvent("md-drugs:server:startcook")
@@ -35,49 +38,10 @@ if tray then
tray = false
DeleteObject(trays)
local bucket = CreateObject(`bkr_prop_meth_bigbag_03a`, vector3(1012.85, -3194.29, -39.2), true, true, true)
- SetEntityHeading(bucket, 90.0)
+ Freeze(bucket, true, 90.0)
SmashMeth()
-
- local options = {
- {
- name = 'bucket',
- icon = 'fa-solid fa-car',
- label = 'Bag Meth',
- action = function()
- DeleteObject(bucket)
- amonia = nil
- heated = nil
- tray = nil
- active = nil
- BagMeth()
- TriggerServerEvent('md-drugs:server:getmeth')
-
- end,
-
- }
- }
- local optionsox = {
- {
- name = 'bucket',
- icon = 'fa-solid fa-car',
- label = 'Bag Meth',
- onSelect = function()
- DeleteObject(bucket)
- amonia = nil
- heated = nil
- tray = nil
- active = nil
- BagMeth()
- TriggerServerEvent('md-drugs:server:getmeth')
- end,
-
- }
- }
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(bucket, optionsox)
- else
- exports['qb-target']:AddTargetEntity(bucket, {options = options, distance = 2.0})
- end
+ Wait(100)
+ AddSingleModel(bucket, {name = 'bucket',icon = 'fa-solid fa-car',label = 'Bag Meth',action = function() DeleteObject(bucket)amonia = nil heated = nil tray = nil active = nil BagMeth() TriggerServerEvent('md-drugs:server:getmeth')end,}, bucket)
end
end
@@ -109,109 +73,58 @@ CreateThread(function()
end)
CreateThread(function()
- exports['qb-target']:AddBoxZone("methteleout", Config.MethTeleIn, 1.5, 1.75, { name = "methteleout", heading = 11.0, debugPoly = false, minZ = Config.MethTeleIn.z - 2, maxZ = Config.MethTeleIn.z + 2,}, {
- options = {
- {name = 'teleout', icon = "fas fa-sign-in-alt", label = "Enter Building", action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleOut) end},
- },
- distance = 2.5
- })
- exports['qb-target']:AddBoxZone("methtelein", Config.MethTeleOut, 1.5, 1.75, {name = "methtelein",heading = 11.0,debugPoly = false,minZ = Config.MethTeleOut.z - 2,maxZ = Config.MethTeleOut.z + 2,}, {
- options = {
- { name = 'teleout', icon = "fas fa-sign-in-alt", label = "Exit Building", action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleIn) end },
- },
- distance = 2.5
- })
- exports['qb-target']:AddBoxZone("maze", vector3(-95.55, -806.73, 44.04), 1.5, 1.75, { name = "maze", heading = 11.0, debugPoly = false, minZ = 44 - 2, maxZ = 44 + 2, }, {
- options = {
- { name = 'die', icon = "fas fa-sign-in-alt", label = "dont click this", action = function() SetEntityCoords(PlayerPedId(), vector3(-75.36, -837.24, 318.93)) end},
- },
- distance = 2.5
- })
+
+ AddBoxZoneSingle("methTeleOut",Config.MethTeleIn, {name = 'teleout', icon = "fas fa-sign-in-alt", label = "Enter Building", action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleOut) end} )
+ AddBoxZoneSingle("methtelein",Config.MethTeleOut, {name = 'teleout', icon = "fas fa-sign-in-alt", label = "Enter Building", action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleOut) end} )
local itemreqcook = { "ephedrine", "acetone" }
- exports['qb-target']:AddBoxZone("ingridientsmeth", vector3(1005.7, -3201.28, -39.55), 1.5, 1.75,{ name = "ingridientsmeth", heading = 11.0, debugPoly = false, minZ = -39 - 2, maxZ = -39 + 2,}, {
- options = {
- { name = 'methcook', icon = "fas fa-sign-in-alt", label = "Cook Meth", item = itemreqcook, action = function() startcook() end,
- canInteract = function()
- if amonia == nil and active == nil then
- return true
- end
- end,
- },
- { name = 'grabtray', icon = "fas fa-sign-in-alt", label = "Grab Tray", distance = 5, action = function() trayscarry() end,
- canInteract = function()
- if heated and amonia and tray == nil then return true end
- end,
- },
+ local options = {
+ { name = 'methcook', icon = "fas fa-sign-in-alt", label = "Cook Meth", action = function() startcook() end,
+ canInteract = function()
+ if amonia == nil and active == nil then
+ return true
+ end
+ end,
},
- distance = 2.5
- })
- exports['qb-target']:AddBoxZone("boxmeth", vector3(1012.15, -3194.04, -39.20), 1.5, 1.75,{ name = "boxmeth", heading = 3.0, debugPoly = false, minZ = -39 - 2, maxZ = -39 + 2,}, {
- options = {
- {name = 'boxmeth',icon = "fas fa-sign-in-alt",label = "Box Up Meth",distance = 5,action = function() smash()end,
- canInteract = function()
- if tray then return true end
- end,
- },
+ { name = 'grabtray', icon = "fas fa-sign-in-alt", label = "Grab Tray", action = function() trayscarry() end,
+ canInteract = function()
+ if heated and amonia and tray == nil then return true end
+ end,
},
- })
- exports['qb-target']:AddBoxZone("adjustdials", vector3(1007.89, -3201.17, -38.99), 1.5, 1.75,{ name = "adjustdials", heading = 11.0, debugPoly = false, minZ = -39 - 2, maxZ = -39 + 2,}, {
- options = {
- { name = 'adjustdials', icon = "fas fa-sign-in-alt", label = "Adjust Dials", distance = 5, action = function() dials() end,
- canInteract = function()
- if amonia and heated == nil then return true end end
- },
- },
- })
+ }
+ AddBoxZoneSingle("cookmeth",vector3(1005.7, -3201.28, -39.55), options )
+ AddBoxZoneSingle('boxmeth', vector3(1012.15, -3194.04, -39.20), {name = 'boxmeth',icon = "fas fa-sign-in-alt",label = "Box Up Meth",action = function() smash()end,
+ canInteract = function()
+ if tray then return true end
+ end})
+ AddBoxZoneSingle('adjustdials',vector3(1007.89, -3201.17, -38.99),{ name = 'adjustdials', icon = "fas fa-sign-in-alt", label = "Adjust Dials", distance = 5, action = function() dials() end,
+ canInteract = function()
+ if amonia and heated == nil then return true end end
+ })
if Config.MethHeist == false then
- for k, v in pairs (Config.MethEph) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- exports['qb-target']:AddBoxZone("methep"..k, v.loc, v.l, v.w, { name = "methep"..k, heading = v.rot, minZ = v.loc.z - 1.0, maxZ = v.loc.z + 2.0,}, {
- options = {
- {icon = "fas fa-sign-in-alt", label = "Steal Ephedrine", event = 'md-drugs:client:stealeph', data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- },
- },
- distance = 2.5
- })
- end
- for k, v in pairs (Config.Methace) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- exports['qb-target']:AddBoxZone("methace"..k, v.loc, v.l, v.w, { name = "methace"..k, heading = v.rot, minZ = v.loc.z - 1.0, maxZ = v.loc.z + 2.0,}, {
- options = {
- {icon = "fas fa-sign-in-alt", label = "Steal Acetone", event = 'md-drugs:client:stealace', data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- },
- },
- distance = 2.5
- })
- end
+ AddBoxZoneMulti('methep', Config.MethEph, {icon = "fas fa-sign-in-alt", label = "Steal Ephedrine", event = 'md-drugs:client:stealeph'})
+ AddBoxZoneMulti('methace', Config.Methace, {icon = "fas fa-sign-in-alt", label = "Steal Acetone", event = 'md-drugs:client:stealace'})
end
end)
CreateThread(function()
-if Config.MethHeist == false then
-else
+if not Config.MethHeist == false then
local current = "g_m_y_famdnf_01"
lib.requestModel(current, Config.RequestModelTime)
local CurrentLocation = Config.MethHeistStart
local methdealer = CreatePed(0, current, CurrentLocation.x, CurrentLocation.y, CurrentLocation.z - 1, false, false)
Freeze(methdealer, true, 220.0)
- exports['qb-target']:AddTargetEntity(methdealer, {
- options = {
- {
- label = "Get Mission",
- icon = "fas fa-eye",
- action = function()
- Notify(Lang.meth.mission, "success")
- SpawnMethCarPedChase()
- end,
- },
- }
- })
+ Wait(100)
+ AddSingleModel(methdealer,{
+ label = "Get Mission",
+ icon = "fas fa-eye",
+ action = function()
+ Notify(Lang.meth.mission, "success")
+ SpawnMethCarPedChase()
+ end,
+ },nil )
end
end)
+
RegisterNetEvent("md-drugs:client:stealeph", function(data)
if not progressbar('Stealing Ephedrine', 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:geteph", data.data)
diff --git a/client/oxyruns.lua b/client/oxyruns.lua
index 715ebbb..69f132c 100644
--- a/client/oxyruns.lua
+++ b/client/oxyruns.lua
@@ -2,73 +2,56 @@ local QBCore = exports['qb-core']:GetCoreObject()
local deliveryBlip = nil
local carryPackage = nil
-
-RegisterNetEvent("md-drugs:client:getoxytruck", function()
-if TriggerServerEvent('md-drugs:server:payfortruck') then
-end
-end)
-
-
-RegisterNetEvent("md-drugs:Client:getoxylocation", function()
- local coords = Config.truckspawn
- local ModelHash = "burrito3" -- Use Compile-time hashes to get the hash of this model
- lib.requestModel(ModelHash, Config.RequestModelTime)
- local oxycar = CreateVehicle(ModelHash,Config.truckspawn.x, Config.truckspawn.y,Config.truckspawn.z, Config.truckspawn.h, true, false)
- SetEntityHeading(oxycar, coords.w)
+RegisterNetEvent("md-drugs:client:GetOxyCar", function()
+ lib.requestModel("burrito3", Config.RequestModelTime)
+ local paid = lib.callback.await('md-drugs:server:payfortruck', false)
+ if not paid then return end
+ local oxycar = CreateVehicle("burrito3",Config.truckspawn.x, Config.truckspawn.y,Config.truckspawn.z, Config.truckspawn.h, true, false)
exports[Config.Fuel]:SetFuel(oxycar, 100.0)
TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(oxycar))
Notify(Lang.oxy.truck, 'success')
TriggerEvent("md-drugs:client:getoxylocationroute")
SetVehicleEngineOn(oxycar, true, true)
- local options = {
- { event = "md-drugs:client:getfromtrunk", icon = "fas fa-box-circle-check", label = "Get Package"},
- }
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(oxycar, options)
- else
- exports['qb-target']:AddTargetEntity(oxycar, {options = options, distance = 2.0})
- end
-
+ AddSingleModel(oxycar, { event = "md-drugs:client:getfromtrunk", icon = "fas fa-box-circle-check", label = "Get Package"}, nil )
end)
RegisterNetEvent("md-drugs:client:getoxylocationroute", function()
- Wait(100)
- local unlucky = math.random(1,100)
local CurrentLocation = Config.oxylocations[math.random(#Config.oxylocations)]
- local unluck = math.random(1,100)
- if deliveryBlip ~= nil then
- RemoveBlip(deliveryBlip)
- end
if CurrentLocation ~= nil then
- deliveryBlip = AddBlipForCoord(CurrentLocation)
+ local deliveryBlip = AddBlipForCoord(CurrentLocation)
SetBlipSprite(deliveryBlip, 1)
SetBlipDisplay(deliveryBlip, 2)
SetBlipScale(deliveryBlip, 1.0)
SetBlipAsShortRange(deliveryBlip, false)
SetBlipColour(deliveryBlip, 27)
BeginTextCommandSetBlipName("STRING")
- AddTextComponentSubstringPlayerName("drug Meet")
+ AddTextComponentSubstringPlayerName(text)
EndTextCommandSetBlipName(deliveryBlip)
SetBlipRoute(deliveryBlip, true)
- local current = "g_m_y_famdnf_01"
- lib.requestModel(current, Config.RequestModelTime)
+ local current = "g_m_y_famdnf_01"
+ lib.requestModel(current, Config.RequestModelTime)
local oxybuyer = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false)
- Freeze(oxybuyer, true, CurrentLocation.w)
- repeat
- Wait(1000)
- until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x,CurrentLocation.y,CurrentLocation.z)) < 5.0
+ Freeze(oxybuyer, true, CurrentLocation.w)
+ repeat
+ Wait(1000)
+ until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x,CurrentLocation.y,CurrentLocation.z)) < 5.0
RemoveBlip(deliveryBlip)
- PoliceCall(Config.PoliceAlertOxy)
- local options = {
- { type = "client", label = "Talk To Buyer", icon = "fas fa-eye", event = "md-drugs:client:giveoxybox", ped = oxybuyer},
- }
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(oxybuyer, options)
- else
- exports['qb-target']:AddTargetEntity(oxybuyer, {options = options, distance = 2.0})
- end
+ PoliceCall(Config.PoliceAlertOxy)
+ AddSingleModel(oxybuyer, { type = "client", label = "Talk To Buyer", icon = "fas fa-eye",
+ action = function()
+ if carryPackage then
+ if not progressbar(Lang.oxy.hand, 4000, 'uncuff') then return end
+ TriggerServerEvent("md-drugs:server:giveoxybox")
+ DeleteEntity(oxybuyer)
+ DetachEntity(carryPackage, true, true)
+ DeleteObject(carryPackage)
+ carryPackage = nil
+ else
+ Notify(Lang.oxy.empty, "error")
+ end
+ end}, oxybuyer)
end
end)
@@ -95,6 +78,7 @@ end)
RegisterNetEvent("md-drugs:client:giveoxybox", function(data)
+
if carryPackage then
if not progressbar(Lang.oxy.hand, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:giveoxybox")
diff --git a/client/shrooms.lua b/client/shrooms.lua
index 5be41a6..5507ebc 100644
--- a/client/shrooms.lua
+++ b/client/shrooms.lua
@@ -9,18 +9,17 @@ function LoadModel(hash)
Wait(3000)
end
end
-
+local function pick(loc)
+ if not progressbar(Lang.Shrooms.pick, 4000, 'uncuff') then return end
+ TriggerServerEvent("shrooms:pickupCane", loc)
+end
RegisterNetEvent('shrooms:respawnCane', function(loc)
local v = GlobalState.shrooms[loc]
local hash = GetHashKey(v.model)
if not shrooms[loc] then
shrooms[loc] = CreateObject(hash, v.location, false, true, true)
Freeze(shrooms[loc], true, v.heading)
- exports['qb-target']:AddTargetEntity(shrooms[loc], {
- options = { { icon = "fas fa-hand", label = "pick shrooms", action = function() if not progressbar(Lang.Shrooms.pick, 4000, 'uncuff') then return end TriggerServerEvent("shrooms:pickupCane", loc) end }
- },
- distance = 2.5
- })
+ AddSingleModel(shrooms[loc],{ icon = "fas fa-hand", label = "pick shrooms", action = function() pick(loc) end }, loc )
end
end)
AddEventHandler('onResourceStart', function(resource)
@@ -61,11 +60,7 @@ end)
if not v.taken then
shrooms[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
Freeze(shrooms[k], true, v.heading)
- exports['qb-target']:AddTargetEntity(shrooms[k], {
- options = { { icon = "fas fa-hand", label = "Pick shrooms", action = function() if not progressbar(Lang.Shrooms.pick, 4000, 'uncuff') then return end TriggerServerEvent("shrooms:pickupCane", k) end }
- },
- distance = 2.5
- })
+ AddSingleModel(shrooms[k],{ icon = "fas fa-hand", label = "pick shrooms", action = function() pick(k) end }, k )
end
end
end)
diff --git a/client/target.lua b/client/target.lua
index 3648042..c25572c 100644
--- a/client/target.lua
+++ b/client/target.lua
@@ -1,298 +1,23 @@
local QBCore = exports['qb-core']:GetCoreObject()
CreateThread(function()
-
-if Config.oxtarget then
- coketelein = exports.ox_target:addBoxZone({ coords = Config.CokeTeleIn, size = vec(1,1,3), rotation = 0, debug = false,
- options = {
- {name = 'teleout',icon = "fas fa-sign-in-alt",label = "Enter Building",distance = 5,
- onSelect = function()
- DoScreenFadeOut(500)
- Wait(1000)
- SetEntityCoords(PlayerPedId(),Config.CokeTeleOut.x, Config.CokeTeleOut.y, Config.CokeTeleOut.z)
- Wait(1000)
- DoScreenFadeIn(500)
- end
- },
- },
- })
- coketeleout = exports.ox_target:addBoxZone({ coords = Config.CokeTeleOut, size = vec(1,1,3), rotation = 0, debug = false,
- options = {
- {name = 'teleout',icon = "fas fa-sign-in-alt",label = "Exit Building",distance = 5,
- onSelect = function()
- DoScreenFadeOut(500)
- Wait(500)
- SetEntityCoords(PlayerPedId(),Config.CokeTeleIn)
- Wait(500)
- DoScreenFadeIn(500)
- end,
-
- },
- },
- })
-else
- exports['qb-target']:AddBoxZone("coketelein",Config.CokeTeleIn,1.5, 1.75, { name = "coketelein",heading = 156.0,debugPoly = false,minZ = Config.CokeTeleIn.z-2,maxZ = Config.CokeTeleIn.z+2,}, {
- options = {
- {
- name = 'teleout',
- icon = "fas fa-sign-in-alt",
- label = "Enter Building",
- action = function()
- DoScreenFadeOut(500)
- Wait(500)
- SetEntityCoords(PlayerPedId(),Config.CokeTeleOut)
- Wait(500)
- DoScreenFadeIn(500)
- end,
-
- },
- },
- })
- exports['qb-target']:AddBoxZone("CokeTeleOut",Config.CokeTeleOut,1.5, 1.75, {name = "CokeTeleOut",heading = 156.0,debugPoly = false,minZ = Config.CokeTeleOut.z-2,maxZ = Config.CokeTeleOut.z+2,}, {
- options = {
- {
- name = 'teleout',
- icon = "fas fa-sign-in-alt",
- label = "Exit Building",
- action = function()
- DoScreenFadeOut(500)
- Wait(500)
- SetEntityCoords(PlayerPedId(),Config.CokeTeleIn)
- Wait(500)
- DoScreenFadeIn(500)
- end,
-
- },
- },
- })
-end
- -- cocaine ( Bagging and Cutting is in Cocaine.lua due to globals used :))
- for k, v in pairs (Config.MakePowder) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:makepowder", icon = "fas fa-sign-in-alt", label = "chop it up", data = k, distance = 2.0,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- },
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("makepowder"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="makepowder"..k, heading = 156.0,minZ = v.loc.z-1, maxZ = v.loc.z+1, }, {options = options, distance = 1.5})
- end
- end
- ------------- lsd
- for k, v in pairs (Config.lysergicacid) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:getlysergic", icon = "fas fa-sign-in-alt", label = "stealing", data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false, rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("getlysergic"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="getlysergic"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
- for k, v in pairs (Config.diethylamide) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:getdiethylamide", icon = "fas fa-sign-in-alt", label = "stealing", data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("getdiethylamide"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="getdiethylamide"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
- for k, v in pairs (Config.gettabs) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:buytabs", icon = "fas fa-sign-in-alt", label = "Buy Tabs", data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("buytabs"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="buytabs"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
- ------ heroin
- for k, v in pairs (Config.dryplant) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:dryplant", icon = "fas fa-sign-in-alt", label = "Dry Poppies", data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("dryplant"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="dryplant"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
- for k, v in pairs (Config.cutheroinone) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:cutheroin", icon = "fas fa-sign-in-alt", label = "Cut Heroin", data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("cutheroin"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="cutheroin"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
- for k, v in pairs (Config.fillneedle) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:fillneedle", icon = "fas fa-sign-in-alt", label = "Fill Needles", data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("fillneedle"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="fillneedle"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
- ------- crack
- for k, v in pairs (Config.makecrack) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:makecrackone", icon = "fas fa-sign-in-alt", label = "Cook Crack", data = k, distance = 2.0,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("makecrackone"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="makecrackone"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
- for k, v in pairs (Config.bagcrack) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:bagcrack", icon = "fas fa-sign-in-alt", label = "Bag Crack", data = k, distance = 2.0,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("bagcrack"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="bagcrack"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
- ------- pharma
- for k, v in pairs (Config.FillPrescription) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:fillprescription", icon = "fas fa-sign-in-alt", label = "Fill Prescription", data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("fillprescription"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="fillprescription"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
- -------- oxy runs
- local options2 = {
- { event = "md-drugs:client:getoxytruck", icon = "fas fa-sign-in-alt", label = "Pay For Truck",},
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = Config.Payfortruck, size = vec3(1,1,1),debugPoly = false,rotation = 90.0, options = options2,})
- else
- exports['qb-target']:AddBoxZone("payfortruck" ,Config.Payfortruck, 1.0, 1.0, {name ="payfortruck", heading = 156.0,minZ = Config.Payfortruck.z-2, maxZ = Config.Payfortruck.z+2, }, {options = options2, distance = 1.5})
- end
- ------------ mescaline
- local options3 = {
- { type = "client", event = "md-drugs:client:drymescaline", icon = "fas fa-sign-in-alt", label = "Dry Out"},
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = Config.DryOut, size = vec3(1,1,1),debugPoly = false,rotation = 90.0, options = options3,})
- else
- exports['qb-target']:AddBoxZone("DryOut" ,Config.DryOut, 1.0, 1.0, {name ="DryOut", heading = 156.0,minZ = Config.DryOut.z-2, maxZ = Config.DryOut.z+2, }, {options = options3, distance = 1.5})
- end
- ------ XTC
- for k, v in pairs (Config.isosafrole) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:stealisosafrole", icon = "fas fa-sign-in-alt", label = "Steal Isosafrole", data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("stealisosafrole"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="stealisosafrole"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
- for k, v in pairs (Config.mdp2p) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:stealmdp2p", icon = "fas fa-sign-in-alt", label = "Steal MDP2P", data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("stealmdp2p"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="stealmdp2p"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
-
- for k, v in pairs (Config.rawxtcloc) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- { type = "client", event = "md-drugs:client:makingrawxtc", icon = "fas fa-sign-in-alt", label = "Make Raw XTC", data = k,
- canInteract = function()
- if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
- }
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("makingrawxtc"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="makingrawxtc"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
- local options4 = {
- { type = "client", event = "md-drugs:client:buypress", icon = 'fas fa-eye', label = 'Buy Press',},
- }
- if Config.oxtarget then
- exports.ox_target:addBoxZone({ coords = Config.buypress, size = vec3(2,2,2), debugPoly = false, rotation = 45, options = options4})
- else
- exports['qb-target']:AddBoxZone("buypress" ,Config.buypress, 1.0, 1.0, {name ="buypress", heading = 156.0,minZ = Config.buypress.z-2, maxZ = Config.buypress.z+2, }, {options = options4, distance = 1.5})
- end
- for k, v in pairs(Config.stamp) do
- if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
- local options = {
- {type = "client", event = "md-drugs:client:stampwhite", icon = 'fas fa-eye', label = 'Stamp Pills', data = k, canInteract = function() if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end },
-
- }
-
- if Config.oxtarget then
- exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1),debugPoly = false,rotation = v.rot, options = options,})
- else
- exports['qb-target']:AddBoxZone("stampxtc"..k ,vector3(v.loc.x, v.loc.y, v.loc.z), v.l, v.w, {name ="stampxtc"..k, heading = 156.0,minZ = v.loc.z-2, maxZ = v.loc.z+2, }, {options = options, distance = 1.5})
- end
- end
-
+ AddBoxZoneMulti('makepowder', Config.MakePowder, { type = "client", event = "md-drugs:client:makepowder", icon = "fas fa-sign-in-alt", label = "chop it up"}) -- coke
+ AddBoxZoneSingle('telecokein', Config.CokeTeleIn, {name = 'teleout',icon = "fas fa-sign-in-alt",label = "Enter Building",action = function() tele(Config.CokeTeleOut) end,}) -- coke
+ AddBoxZoneSingle('telecokeout', Config.CokeTeleOut, {name = 'teleout',icon = "fas fa-sign-in-alt",label = "Exit Building",action = function() tele(Config.CokeTeleIn) end,}) -- coke
+ AddBoxZoneMulti('steallysergic', Config.lysergicacid, { type = "client", event = "md-drugs:client:getlysergic", icon = "fas fa-sign-in-alt", label = "stealing Lysergic"}) -- lsd
+ AddBoxZoneMulti('stealdiethylamide', Config.diethylamide, {type = "client", event = "md-drugs:client:getdiethylamide", icon = "fas fa-sign-in-alt", label = "stealing Diethylamide"}) -- lsd
+ AddBoxZoneMulti('gettabs', Config.gettabs, {type = "client", event = "md-drugs:client:buytabs", icon = "fas fa-sign-in-alt", label = "Buy Tabs"}) -- lsd
+ AddBoxZoneMulti('dryheroin', Config.dryplant, {type = "client",event = "md-drugs:client:dryplant", icon = "fas fa-sign-in-alt", label = "Dry Poppies"}) -- heroin
+ AddBoxZoneMulti('cutheroin', Config.cutheroinone, {type = "client", event = "md-drugs:client:cutheroin", icon = "fas fa-sign-in-alt", label = "Cut Heroin"}) -- heroin
+ AddBoxZoneMulti('fillneedle', Config.fillneedle, {type = "client", event = "md-drugs:client:fillneedle", icon = "fas fa-sign-in-alt", label = "Fill Needles"}) -- heroin
+ AddBoxZoneMulti('makecrack', Config.makecrack, {type = "client", event = "md-drugs:client:makecrackone", icon = "fas fa-sign-in-alt", label = "Cook Crack"}) -- crack
+ AddBoxZoneMulti('bagcrack', Config.bagcrack, {type = "client", event = "md-drugs:client:bagcrack", icon = "fas fa-sign-in-alt", label = "Bag Crack"}) -- crack
+ AddBoxZoneMulti('fillprescription', Config.FillPrescription, {type = "client", event = "md-drugs:client:fillprescription", icon = "fas fa-sign-in-alt", label = "Fill Prescription"}) -- pharma
+ AddBoxZoneSingle('payfortruck', Config.Payfortruck, { event = "md-drugs:client:GetOxyCar", icon = "fas fa-sign-in-alt", label = "Pay For Truck"}) -- oxy runs
+ AddBoxZoneSingle('drymescaline', Config.DryOut, { type = "client", event = "md-drugs:client:drymescaline", icon = "fas fa-sign-in-alt", label = "Dry Out"}) -- mescaline
+ AddBoxZoneMulti('stealisosafrole', Config.isosafrole, {type = "client", event = "md-drugs:client:stealisosafrole", icon = "fas fa-sign-in-alt", label = "Steal Isosafrole"}) -- xtc
+ AddBoxZoneMulti('stealmdp2p', Config.mdp2p, {type = "client", event = "md-drugs:client:stealmdp2p", icon = "fas fa-sign-in-alt", label = "Steal MDP2P"}) -- xtc
+ AddBoxZoneMulti('rawxtcloc', Config.rawxtcloc, {type = "client", event = "md-drugs:client:makingrawxtc", icon = "fas fa-sign-in-alt", label = "Make Raw XTC"}) -- xtc
+ AddBoxZoneSingle('buypress', Config.buypress, { type = "client",event = "md-drugs:client:buypress", icon = 'fas fa-eye', label = 'Buy Press'}) -- xtc
+ AddBoxZoneMulti('stamp', Config.stamp, {type = "client", event = "md-drugs:client:stampwhite", icon = 'fas fa-eye', label = 'Stamp Pills'}) -- xtc
end)
diff --git a/client/travellingmerchant.lua b/client/travellingmerchant.lua
index d2d45c1..bfed39c 100644
--- a/client/travellingmerchant.lua
+++ b/client/travellingmerchant.lua
@@ -3,26 +3,15 @@ local QBCore = exports['qb-core']:GetCoreObject()
CreateThread(function()
local current = "g_m_y_famdnf_01"
lib.requestModel(current, Config.RequestModelTime)
- local CurrentLocation = Config.Travellingmerchant[math.random(#Config.Travellingmerchant)]
+ local num = lib.callback.await('md-drugs:server:GetMerchant', false)
+ local CurrentLocation = Config.Travellingmerchant[num]
local travellingmerchant = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false)
Freeze(travellingmerchant, true, CurrentLocation.w)
- if Config.oxtarget then
- local options = {
- { label = "Travelling Merchant", icon = "fas fa-eye", onSelect = function() lib.showContext('travellingmerchant') end},
- }
- exports.ox_target:addLocalEntity(travellingmerchant, options)
- else
- exports['qb-target']:AddTargetEntity(travellingmerchant, {
- options = {
- { label = "Travelling Merchant", icon = "fas fa-eye", action = function() lib.showContext('travellingmerchant') end},
- }
- })
- end
+ AddSingleModel(travellingmerchant, { label = "Travelling Merchant", icon = "fas fa-eye", action = function() lib.showContext('travellingmerchant') end}, nil)
end)
CreateThread(function()
local ShopMenu = {}
-
for k, v in pairs (Config.Items.items) do
ShopMenu[#ShopMenu + 1] = {
icon = GetImage(v.name),
@@ -37,13 +26,12 @@ CreateThread(function()
num = k
}
}
-
lib.registerContext({id = 'travellingmerchant',title = "Travelling Merchant", options = ShopMenu})
end
end)
-RegisterNetEvent("md-drugs:client:travellingmerchantox", function(data) local dialog
+RegisterNetEvent("md-drugs:client:travellingmerchantox", function(data)
local price = data.cost
local settext = "Amnt: "..data.amount.." | Cost: "..price or "Cost: "..price
local max = data.amount
diff --git a/client/weed.lua b/client/weed.lua
index 9c20536..0998749 100644
--- a/client/weed.lua
+++ b/client/weed.lua
@@ -10,32 +10,31 @@ function LoadModel(hash)
end
end
+local function hasJob()
+ if Config.Joblock then
+ if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
+ return true else return false end
+ else
+ return true end
+ end
+
+
RegisterNetEvent('weed:respawnCane', function(loc)
local v = GlobalState.WeedPlant[loc]
local hash = GetHashKey(v.model)
if not HasModelLoaded(hash) then LoadModel(hash) end
if not WeedPlant[loc] then
WeedPlant[loc] = CreateObject(hash, v.location.x, v.location.y, v.location.z-3.5, false, true, true)
- Freeze(WeedPlant[loc],true, v.heading)
- exports['qb-target']:AddTargetEntity(WeedPlant[loc], {
- options = {
- {
- icon = "fas fa-hand",
- label = "Pick Weed",
- action = function()
- if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end
- TriggerServerEvent("weed:pickupCane", loc)
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- return true end
- else
- return true end end,
- }
- },
-distance = 2.5
- })
+ Freeze(WeedPlant[loc],true, v.heading)
+ AddSingleModel(WeedPlant[loc],
+ {
+ icon = "fas fa-hand",
+ label = "Pick Weed",
+ action = function()
+ if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end
+ TriggerServerEvent("weed:pickupCane", loc)
+ end
+ }, loc)
end
end)
@@ -50,26 +49,16 @@ RegisterNetEvent("weed:init", function()
if not HasModelLoaded(hash) then LoadModel(hash) end
if not v.taken then
WeedPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z-3.5, false, true, true)
- Freeze(WeedPlant[k],true, v.heading)
- exports['qb-target']:AddTargetEntity(WeedPlant[k], {
- options = {
- {
- icon = "fas fa-hand",
- label = "Pick Weed",
- action = function()
- if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end
- TriggerServerEvent("weed:pickupCane", k)
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- return true end
- else
- return true end end,
- }
- },
- distance = 2.5
- })
+ Freeze(WeedPlant[k],true, v.heading)
+ AddSingleModel(WeedPlant[k],
+ {
+ icon = "fas fa-hand",
+ label = "Pick Weed",
+ action = function()
+ if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end
+ TriggerServerEvent("weed:pickupCane", k)
+ end
+ }, k)
end
end
end)
@@ -98,234 +87,74 @@ AddEventHandler('onResourceStop', function(resourceName)
end)
CreateThread(function()
+ AddBoxZoneMulti('weeddry', Config.WeedDry, {
+ name = 'dryweed',
+ icon = "fas fa-sign-in-alt",
+ label = "Dry Weed",
+ distance = 1,
+ action = function()
+ if not ItemCheck('wetcannabis') then return end
+ if drying then
+ Notify(Lang.Weed.busy, "error")
+ else
+ local loc = GetEntityCoords(PlayerPedId())
+ local weedplant = CreateObject("bkr_prop_weed_drying_01a", loc.x, loc.y+.2, loc.z, true, false)
+ drying = true
+ FreezeEntityPosition(weedplant, true)
+ Notify("Wait A little Bit To Dry", "success")
+ Wait(math.random(1000,5000))
+ Notify("Take Down The Weed", "success")
+ AddSingleModel(weedplant, {
+ icon = "fas fa-sign-in-alt",
+ label = "Pick Up Weed",
+ action = function()
+ DeleteEntity(weedplant)
+ drying = false
+ TriggerServerEvent('md-drugs:server:dryoutweed')
+ end,
+ canInteract = function()
+ if hasJob() then return true end end
+ }, nil)
+ end
+ end,
+ canInteract = function()
+ if hasJob() then return true end end
+ })
+AddBoxZoneSingle('teleinweedout', Config.Teleout, { name = 'teleout', icon = "fas fa-sign-in-alt", label = "Enter Building", distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Telein) end,
+ canInteract = function() if hasJob() then return true end end
+})
+AddBoxZoneSingle('teleinweedin', Config.Telein, { name = 'teleout', icon = "fas fa-sign-in-alt", label = "Exit Building", distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Teleout) end,
+ canInteract = function() if hasJob() then return true end end
+})
+AddBoxZoneSingle('MakeButterCrafting', Config.MakeButter, {label = 'Open Butter Menu', action = function() lib.showContext('ButterCraft') end, icon = "fas fa-sign-in-alt",
+canInteract = function() if hasJob() then return true end end
+})
-for k, v in pairs (Config.WeedDry) do
-
-exports['qb-target']:AddBoxZone("weeddry"..k,v,1.5, 1.75, {name = "weeddry"..k,heading = 11.0,debugPoly = false,minZ = v.z-2,maxZ = v.z+2,}, {
- options = {
- {
- name = 'dryweed',
- icon = "fas fa-sign-in-alt",
- label = "Dry Weed",
- distance = 1,
- item = "wetcannabis",
- action = function()
- if drying then
- Notify(Lang.Weed.busy, "error")
- else
- local loc = GetEntityCoords(PlayerPedId())
- local weedplant = CreateObject("bkr_prop_weed_drying_01a", loc.x, loc.y+.2, loc.z, true, false)
- drying = true
- FreezeEntityPosition(weedplant, true)
- Notify("Wait A little Bit To Dry", "success")
- Wait(math.random(1000,5000))
- Notify("Take Down The Weed", "success")
- local options = {
- {
- icon = "fas fa-sign-in-alt",
- label = "Pick Up Weed",
- action = function()
- DeleteEntity(weedplant)
- drying = false
- TriggerServerEvent('md-drugs:server:dryoutweed')
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- return true end
- else
- return true end end,
- }
- }
- local optionsox = {
- {
- icon = "fas fa-sign-in-alt",
- label = "Pick Up Weed",
- onSelect = function()
- DeleteEntity(weedplant)
- drying = false
- TriggerServerEvent('md-drugs:server:dryoutweed')
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- return true end
- else
- return true end end,
- }
- }
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(weedplant, optionsox )
- else
- exports['qb-target']:AddTargetEntity(weedplant, {options = options})
- end
- end
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- if drying == false then
- return true end end
- else
- return true end end,
- },
- },
-})
-end
-exports['qb-target']:AddBoxZone("teleinweed",Config.Telein,1.5, 1.75, {name = "teleinweed",heading = 11.0,debugPoly = false,minZ = Config.Telein.z-2,maxZ = Config.Telein.z+2,}, {
- options = {
- { name = 'teleout', icon = "fas fa-sign-in-alt", label = "Enter Building", distance = 2.0,
- action = function()
- SetEntityCoords(PlayerPedId(),Config.Teleout)
-
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- return true end
- else
- return true end end,
- },
- },
-})
-exports['qb-target']:AddBoxZone("teleinweedout",Config.Teleout,1.5, 1.75, { name = "teleinweedout",heading = 11.0,debugPoly = false,minZ = Config.Teleout.z-2,maxZ = Config.Teleout.z+2,}, {
-options = {
- { name = 'teleout', icon = "fas fa-sign-in-alt", label = "Exit Building", distance = 2.0,
- action = function()
- SetEntityCoords(PlayerPedId(),Config.Telein)
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- return true end
- else
- return true end end,
- },
- },
-})
-exports['qb-target']:AddBoxZone("MakeButter",Config.MakeButter,1.5, 1.75, {name = "MakeButter",heading = 11.0,debugPoly = false,minZ = Config.MakeButter.z-2,maxZ = Config.MakeButter.z+2,}, {
-options = {
- {
- name = 'butter',
- icon = "fas fa-sign-in-alt",
- label = "Make Butter",
- action = function()
- if not ItemCheck('mdbutter') and not ItemCheck('grindedweed') then return end
- if not minigame(2, 8) then return end
- if not progressbar(Lang.Weed.canna, 4000, 'uncuff') then return end
- TriggerServerEvent("md-drugs:server:makebutter")
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- return true end
- else
- return true end end,
- },
- {
- name = 'makebrownies',
- icon = "fas fa-sign-in-alt",
- label = "Make Brownies",
- item = "cannabutter",
- action = function()
- if not ItemCheck('cannabutter') and not ItemCheck('flour') and not ItemCheck('chocolate') then return end
- if not minigame(2, 8) then return end
- if not progressbar(Lang.Weed.brown, 4000, 'uncuff') then return end
- TriggerServerEvent("md-drugs:server:makebrownies")
-
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- return true end
- else
- return true end end,
- },
- {
- name = 'makecookies',
- icon = "fas fa-sign-in-alt",
- label = "Make Cookies",
- item = "cannabutter",
- action = function()
- if not ItemCheck('cannabutter') and not ItemCheck('flour') then return end
- if not minigame(2, 8) then return end
- if not progressbar(Lang.Weed.cook, 4000, 'uncuff') then return end
- TriggerServerEvent("md-drugs:server:makecookies")
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- return true end
- else
- return true end end,
- },
- {
- name = 'makechocolate',
- icon = "fas fa-sign-in-alt",
- label = "Make Chocolate",
- item = "cannabutter",
- action = function()
- if not ItemCheck('cannabutter') and not ItemCheck('chocolate') then return end
- if not minigame(2, 8) then return end
- if not progressbar(Lang.Weed.choc, 4000, 'uncuff') then return end
- TriggerServerEvent("md-drugs:server:makechocolate")
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- return true end
- else
- return true end end,
- },
- {
- name = 'makemuffin',
- icon = "fas fa-sign-in-alt",
- label = "Make Muffin",
- item = "cannabutter",
- action = function()
- if not ItemCheck('cannabutter') and not ItemCheck('flour') then return end
- if not minigame(2, 8) then return end
- if not progressbar(Lang.Weed.muff, 4000, 'uncuff') then return end
- TriggerServerEvent("md-drugs:server:makemuffin")
- end,
- canInteract = function()
- if Config.Joblock then
- if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
- return true end
- else
- return true end end,
- },
- },
-})
-exports['qb-target']:AddBoxZone("makeoil",Config.MakeOil,1.5, 1.75, {name = "makeoil",heading = 11.0,debugPoly = false,minZ = Config.MakeOil.z-2,maxZ = Config.MakeOil.z+2,}, {
-options = {
- {
- name = 'Oil',
- icon = "fas fa-sign-in-alt",
- label = "Make Oil",
- action = function()
- if not ItemCheck('butane') and not ItemCheck('grindedweed') then return end
- if not minigame(2, 8) then
- local explosion = math.random(1,100)
- local loc = GetEntityCoords(PlayerPedId())
- if explosion <= 99 then
- AddExplosion(loc.x, loc.y, loc.z, 49, 10, true, false, true, true)
- exploded = true
- Notify(Lang.Weed.stovehot, "error")
- Wait(1000 * 30)
- exploded = nil
- end
- return end
- if not progressbar(Lang.Weed.shat, 4000, 'uncuff') then return end
- TriggerServerEvent("md-drugs:server:makeoil")
- end,
- canInteract = function()
- if exploded == nil then return true end
- end,
- },
- },
-})
+AddBoxZoneSingle('makeoil',Config.MakeOil, {
+ name = 'Oil',
+ icon = "fas fa-sign-in-alt",
+ label = "Make Oil",
+ action = function()
+ if not ItemCheckMulti({'butane', 'grindedweed'}) then return end
+ if not minigame(2, 8) then
+ local explosion = math.random(1,100)
+ local loc = GetEntityCoords(PlayerPedId())
+ if explosion <= 99 then
+ AddExplosion(loc.x, loc.y, loc.z, 49, 10, true, false, true, true)
+ exploded = true
+ Notify(Lang.Weed.stovehot, "error")
+ Wait(1000 * 30)
+ exploded = nil
+ end
+ return end
+ if not progressbar(Lang.Weed.shat, 4000, 'uncuff') then return end
+ TriggerServerEvent("md-drugs:server:makeoil")
+ end,
+ canInteract = function()
+ if hasJob() and exploded == nil then return true end
+ end,
+} )
end)
CreateThread(function()
@@ -352,29 +181,14 @@ CreateThread(function()
FreezeEntityPosition(stove2, true)
end)
-RegisterNetEvent('md-drugs:client:bluntwraps', function(args)
- lib.registerContext({
- id = 'bluntroll',
- title = 'Blunt Types',
- menu = 'bluntroll',
- options = {
- { title = 'Roll Blunt', description = 'Roll A Regular Blunt', icon = 'check', serverEvent = 'md-drugs:server:rollblunt'},
- { title = 'Dip Blunt Wrap In Lean', description = 'Roll A Lean Blunt', icon = 'check', serverEvent = 'md-drugs:server:rollleanblunt'},
- { title = 'Dip Blunt Wrap In Dextro', description = 'Roll A Dextro Blunt', icon = 'check', serverEvent = 'md-drugs:server:rolldextroblunt'},
- { title = 'Roll A Chewy Blunt', description = 'Roll A Chewy Blunt', icon = 'check', serverEvent = 'md-drugs:server:rollchewyblunt'},
- },
- })
- lib.showContext('bluntroll')
-end)
RegisterNetEvent("md-drugs:client:rollanim", function()
if not progressbar(Lang.Weed.roll, 4000, 'uncuff') then return end
end)
+
RegisterNetEvent("md-drugs:client:grind", function()
if not progressbar("grinding", 4000, 'uncuff') then return end
end)
-
-
RegisterNetEvent("md-drugs:client:dodabs", function()
if not progressbar('Doing Dabs', 4000, 'bong2') then return end
@@ -387,27 +201,120 @@ local current = "u_m_m_jesus_01"
lib.requestModel(current, Config.RequestModelTime)
local CurrentLocation = Config.WeedSaleman
- local WeedGuy = CreatePed(0,current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false)
- Freeze(WeedGuy, true, CurrentLocation.w)
- exports['qb-target']:AddTargetEntity(WeedGuy, {
- options = {
- {label = "Weed Shop",icon = "fas fa-eye",action = function() lib.showContext('WeedShop')end},
- }
- })
-for k, v in pairs (Config.Weed.items) do
- WeedShop[#WeedShop + 1] = {
- icon = GetImage(v.name),
- title = GetLabel(v.name),
- description = '$'.. v.price,
- event = "md-drugs:client:travellingmerchantox",
- args = {
- item = v.name,
- cost = v.price,
- amount = v.amount,
- table = Config.Weed.items,
- num = k,
+ local WeedGuy = CreatePed(0,current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.h, false, false)
+ Freeze(WeedGuy, true, CurrentLocation.h)
+ AddSingleModel(WeedGuy, {label = "Weed Shop",icon = "fas fa-eye",action = function() lib.showContext('WeedShop')end}, nil)
+ for k, v in pairs (Config.Weed.items) do
+ WeedShop[#WeedShop + 1] = {
+ icon = GetImage(v.name),
+ title = GetLabel(v.name),
+ description = '$'.. v.price,
+ event = "md-drugs:client:travellingmerchantox",
+ args = {
+ item = v.name,
+ cost = v.price,
+ amount = v.amount,
+ table = Config.Weed.items,
+ num = k,
+ }
}
- }
- lib.registerContext({id = 'WeedShop',title = "Weed Shop", options = WeedShop})
+ lib.registerContext({id = 'WeedShop',title = "Weed Shop", options = WeedShop})
end
end)
+
+CreateThread(function()
+local items = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'edibles')
+local items2 = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'blunts')
+local items3 = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'bluntwrap')
+local craft = {}
+local blunt = {}
+local bluntwrap = {}
+local label = {}
+for k, v in pairs (items) do
+ label = {}
+ local item = ''
+ for m, d in pairs (items[k].take) do
+ table.insert(label, GetLabel(m) .. ' X ' .. d)
+ end
+ for m,d in pairs (items[k].give) do
+ item = m
+ end
+ craft[#craft + 1] = {
+ icon = GetImage(item),
+ description = table.concat(label, ", "),
+ title = GetLabel(item),
+ event = "md-drugs:client:MakeWeedItems",
+ args = {
+ item = item,
+ recipe = 'weed',
+ num = k,
+ label = 'Cooking Up ' .. GetLabel(item),
+ table = 'edibles'
+
+ }
+ }
+ lib.registerContext({id = 'ButterCraft',title = "Edible Cooking", options = craft})
+end
+for k, v in pairs (items2) do
+ label = {}
+ local item = ''
+ for m, d in pairs (items2[k].take) do
+ table.insert(label, GetLabel(m) .. ' X ' .. d)
+ end
+ for m, d in pairs (items2[k].give) do
+ item = m
+ end
+ blunt[#blunt + 1] = {
+ icon = GetImage(item),
+ description = table.concat(label, ", "),
+ title = GetLabel(item),
+ event = "md-drugs:client:MakeWeedItems",
+ args = {
+ item = item,
+ recipe = 'weed',
+ num = k,
+ label = 'Rolling A ' .. GetLabel(item),
+ table = 'blunts'
+ }
+ }
+ lib.registerContext({id = 'mddrugsblunts',title = "Roll Blunts", options = blunt})
+end
+for k, v in pairs (items3) do
+ label = {}
+ local item = ''
+ for m, d in pairs (items3[k].take) do
+ table.insert(label, GetLabel(m) .. ' X ' .. d)
+ end
+ for m,d in pairs (items3[k].give) do
+ item = m
+ end
+ bluntwrap[#bluntwrap + 1] = {
+ icon = GetImage(item),
+ description = table.concat(label, ", "),
+ title = GetLabel(item),
+ event = "md-drugs:client:MakeWeedItems",
+ args = {
+ item = item,
+ recipe = 'weed',
+ num = k,
+ label = 'Dipping Syrup To Make ' .. GetLabel(item),
+ table = 'bluntwrap'
+ }
+ }
+ lib.registerContext({id = 'mddrugsbluntwraps',title = "Dip Blunt Wrap", options = bluntwrap})
+end
+end)
+
+RegisterNetEvent("md-drugs:client:MakeWeedItems", function(data)
+ if not minigame() then return end
+ if not progressbar('Making ' .. data.item, 4000, 'uncuff') then return end
+ TriggerServerEvent('md-drugs:server:MakeWeedItems', data)
+end)
+
+RegisterNetEvent('md-drugs:client:makeBluntWrap', function(data)
+ lib.showContext('mddrugsbluntwraps')
+end)
+
+RegisterNetEvent('md-drugs:client:rollBlunt', function(data)
+ lib.showContext('mddrugsblunts')
+end)
diff --git a/client/wholesale.lua b/client/wholesale.lua
index 91ee2c3..5c5579c 100644
--- a/client/wholesale.lua
+++ b/client/wholesale.lua
@@ -9,7 +9,6 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify)
else
TriggerServerEvent('md-drugs:server:RemoveBurner', drug)
Notify(notify, 'success')
- local unlucky = math.random(1,100)
local CurrentLocation = Config.oxylocations[math.random(#Config.oxylocations)]
local timer = 0
miss = true
@@ -23,48 +22,40 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify)
AddTextComponentSubstringPlayerName("drug Meet")
EndTextCommandSetBlipName(deliveryBlip)
SetBlipRoute(deliveryBlip, true)
+ lib.requestModel("g_m_y_famdnf_01", Config.RequestModelTime)
+ local current = "g_m_y_famdnf_01"
+ local drugdealer = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, 90.0, false, false)
+ FreezeEntityPosition(drugdealer, true)
+ SetEntityInvincible(drugdealer, true)
+ AddSingleModel(drugdealer, {
+ type = "client",
+ label = "Talk To Buyer",
+ icon = "fas fa-eye",
+ action = function()
+ local luck = math.random(1,100)
+ if luck >=101 then
+ TriggerEvent("md-drugs:client:SuccessSale", drug)
+ Wait(4000)
+ DeleteEntity(drugdealer)
+ else
+ TriggerEvent("md-drugs:client:SetUp")
+ Wait(3000)
+ DeleteEntity(drugdealer)
+ end
+ miss = false
+ end,
+ },nil )
repeat
Wait(1000)
timer = timer + 1
until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x, CurrentLocation.y, CurrentLocation.z) ) < 4.0 or timer == Config.WholesaleTimeout + 1
PoliceCall(Config.AlertPoliceWholesale)
+ RemoveBlip(deliveryBlip)
if timer <= Config.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x, CurrentLocation.y, CurrentLocation.z) ) < 4.0 then
timer = 0
- RemoveBlip(deliveryBlip)
- lib.requestModel("g_m_y_famdnf_01", Config.RequestModelTime)
- local current = "g_m_y_famdnf_01"
- local drugdealer = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, 90.0, false, false)
- FreezeEntityPosition(drugdealer, true)
- SetEntityInvincible(drugdealer, true)
- exports['qb-target']:AddTargetEntity(drugdealer, {
- options = {
- {
- type = "client",
- label = "Talk To Buyer",
- icon = "fas fa-eye",
- action = function()
- local luck = math.random(1,100)
- local ped = GetEntityCoords(PlayerPedId())
- if luck <= Config.SuccessfulChance then
- TriggerEvent("md-drugs:client:SuccessSale", drug)
- Wait(4000)
- DeleteEntity(drugdealer)
- else
- TriggerEvent("md-drugs:client:SetUp")
- Wait(3000)
- SetUpPeds()
- Wait(4000)
- DeleteEntity(drugdealer)
- end
- miss = false
- end,
- },
- },
- distance = 2.0
- })
else
Notify('The Buyer Waited To Long')
- RemoveBlip(deliveryBlip)
+ DeleteEntity(drugdealer)
end
end
end)
diff --git a/client/xtc.lua b/client/xtc.lua
index 9ac9470..2909490 100644
--- a/client/xtc.lua
+++ b/client/xtc.lua
@@ -3,23 +3,26 @@ local xtcpress = false
RegisterNetEvent("md-drugs:client:setpress", function(type)
-
if xtcpress then
Notify(Lang.xtc.out, 'error')
else
- local PedCoords = GetEntityCoords(PlayerPedId())
+ local coords, head = StartRay2()
xtcpress = true
progressbar('Setting Press On The Ground', 4000, 'uncuff')
- local press = CreateObject("bkr_prop_coke_press_01aa", PedCoords.x+1, PedCoords.y+1, PedCoords.z-1, true, false)
+ local press = CreateObject("bkr_prop_coke_press_01aa", coords.x, coords.y, coords.z, true, false, false)
PlaceObjectOnGroundProperly(press)
-
+ SetEntityHeading(press, head)
local options = {
- {
+ {
icon = "fas fa-eye",
label = "Make XTC",
+ distance = 2.0,
action = function()
TriggerEvent("md-drugs:client:XTCMenu", type)
end,
+ onSelect = function()
+ TriggerEvent("md-drugs:client:XTCMenu", type)
+ end,
canInteract = function()
if xtcpress then return true end end
},
@@ -28,36 +31,16 @@ RegisterNetEvent("md-drugs:client:setpress", function(type)
label = "Pick Up",
action = function()
TriggerEvent("md-drugs:client:GetPressBack", type, press)
- end,
- canInteract = function()
- if xtcpress then return true end end
- },
- }
- local optionsox = {
- {
- icon = "fas fa-eye",
- label = "Make XTC",
- onSelect = function()
- TriggerEvent("md-drugs:client:XTCMenu", type)
- end,
- canInteract = function()
- if xtcpress then return true end end
- },
- {
- icon = "fas fa-eye",
- label = "Pick Up",
+ end,
onSelect = function()
TriggerEvent("md-drugs:client:GetPressBack", type, press)
- end,
+ end,
+ distance = 2.0,
canInteract = function()
if xtcpress then return true end end
},
}
- if Config.oxtarget then
- exports.ox_target:addLocalEntity(press, optionsox)
- else
- exports['qb-target']:AddTargetEntity(press, { options = options})
- end
+ AddMultiModel(press, options, nil)
end
end)
@@ -196,7 +179,7 @@ RegisterNetEvent("md-drugs:client:exchangepresses", function(data)
end)
RegisterNetEvent("md-drugs:client:buypress", function()
- local img = GetImage('singlepress'),
+ local img = GetImage('singlepress')
lib.registerContext({
id = 'buypresses',
title = 'Purchase Presses',
diff --git a/patchnotes.txt b/patchnotes.txt
index b01471d..b67b5b2 100644
--- a/patchnotes.txt
+++ b/patchnotes.txt
@@ -41,3 +41,63 @@ should be fully compatible with qbx without needing to make a couple edits now
Added support for fivemerr logs
3.5.8 -> 3.5.9
added command /cornersell **you only need to update server/cornserselling.lua** from previous update
+
+3.5.9 - > 3.7.0
+
+im bad at numbers sue me kek
+
+a lot has been changed with this version
+The main thing to update from 3.5.9 to 3.7.0 is a couple things in your config
+SAVE YOUR SHARED FOLDER AND COPY AND PASTE IT TO YOUR DESKTOP SO YOU HAVE A SECOND COPY
+
+```
+Config.oxtarget:
+ no longer exists in new version. Change it to
+
+Config.Target = 'qb' -- qb or ox
+
+Config.minigametype:
+changed a little bit. you need to add this table to make things work now
+
+Config.Minigames = {
+ ps = { amount = 2, speed = 8,},
+ ox = { 'easy', 'easy'}, --easy medium or hard each one corresponds to how many skillchecks and the difficulty
+ blcirprog = { amount = 2, speed = 50}, -- speed = 1-100
+ blprog = { amount = 1, speed = 50}, -- speed = 1-100
+ blkeyspam = { amount = 1, difficulty = 50}, -- difficulty = 1-100
+ blkeycircle = { amount = 1, difficulty = 50, keynumbers = 3},
+ blnumberslide = { amount = 1, difficulty = 50, keynumbers = 3},
+ blrapidlines = { amount = 1, difficulty = 50, numberofline = 3},
+ blcircleshake = { amount = 1, difficulty = 50, stages = 3},
+ glpath = { gridsize = 10, lives = 3, timelimit = 999999},
+ glspot = {gridSize = 6, timeLimit = 999999, charSet = "alphabet", required = 10},
+ glmath = {timeLimit = 300000},
+
+}
+
+what does this do, adds 10 more minigames than before you can use. How to set it, change Config.minigametype to the key of that table like ps ox blcirprog
+
+```
+
+Now thats the config changes so you dont need to reconfig everything as I do my best to not change much in the config and work around what has been done
+
+Whats been added
+```
+i moved tier system to SQL as its better than using metadata
+run the SQL and it will autopopulate your metadata for rep so people wont lose anything
+
+I added a new sql table for deliveries
+
+it not checks overall time for deliveries regardless if you crash or not.
+
+Added new server file called recipes.lua
+
+its what you imagine, about 80-90% of the recipes for md-drugs
+
+```
+
+Is there bugs, probably. But im tired of beta testing it over and over so please report bugs to my discord where i can see them and patch them quickly.
+
+
+
+
diff --git a/readme.md b/readme.md
index 659a546..36158c0 100644
--- a/readme.md
+++ b/readme.md
@@ -145,7 +145,8 @@ then in prop emotes do
}
```
-
+- **STEP 6**
+Run SQL
-- **OPTIONAL STEPS**
diff --git a/server/cocaine.lua b/server/cocaine.lua
index 6115b3d..171c731 100644
--- a/server/cocaine.lua
+++ b/server/cocaine.lua
@@ -21,130 +21,101 @@ end
RegisterNetEvent("coke:pickupCane")
AddEventHandler("coke:pickupCane", function(loc)
- local playerPed = GetPlayerPed(source)
-
- if CheckDist(source, playerPed, Config.CocaPlant[loc].location) then return end
+ 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
TriggerClientEvent("coke:removeCane", -1, loc)
CaneCooldown(loc)
- local Player = QBCore.Functions.GetPlayer(source)
- AddItem('coca_leaf', 1)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked A Coca Leaf With a distance of ' .. dist(source, playerPed, Config.CocaPlant[loc].location) .. ' vectors', 'coke')
+ AddItem(src, 'coca_leaf', 1)
+ 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
- local Player = QBCore.Functions.GetPlayer(src)
- local playerPed = GetPlayerPed(source)
- if CheckDist(source, playerPed, Config.MakePowder[num]['loc']) then return end
- if not Itemcheck(Player, 'coca_leaf', 1, 'true') then return end
+ if CheckDist(src, Config.MakePowder[num]['loc']) then return end
if Config.TierSystem then
- local coke = Player.PlayerData.metadata['coke']
+ local coke = getRep(src, 'coke')
if coke <= Config.Tier1 then
- if RemoveItem("coca_leaf", 1) then
- AddItem("coke", 1)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Raw Coke' .. dist(source, playerPed, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
- end
+ if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier1') then return end
+ Log(GetName(src) .. ' Made Raw Coke' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
elseif coke >= Config.Tier1 and coke <= Config.Tier2 then
- if RemoveItem("coca_leaf", 1) then
- AddItem("cokestagetwo", 1)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Raw Coke tier 2' .. dist(source, playerPed, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
- end
-
+ if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier2') then return end
+ Log(GetName(src) .. ' Made Raw Coke tier 2' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
else
- if RemoveItem("coca_leaf", 1) then
- AddItem("cokestagethree", 1)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Raw Coke tier 3' .. dist(source, playerPed, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
- end
+ if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier3') then return end
+ Log(GetName(src) ..' Made Raw Coke tier 3' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
end
else
- if RemoveItem("coca_leaf", 1) then
- AddItem("coke", 1)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Raw Coke' .. dist(source, playerPed, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
- end
- end
+ if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier1') then return end
+ Log(GetName(src) .. ' Made Raw Coke' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
+ end
end)
-
RegisterServerEvent('md-drugs:server:cutcokeone', function()
local src = source
- local Player = QBCore.Functions.GetPlayer(src)
- if not Itemcheck(Player,'bakingsoda', 1, 'true') then return end
+ local Player = QBCore.Functions.GetPlayer(src)
if Config.TierSystem then
local coke = Player.Functions.GetItemByName('coke')
local coke2 = Player.Functions.GetItemByName('cokestagetwo')
local coke3 = Player.Functions.GetItemByName('cokestagethree')
if coke then
- RemoveItem('coke', 1 )
- RemoveItem('bakingsoda', 1 )
- AddItem('loosecoke', 1)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Coke', 'coke')
+ if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end
+ Log(GetName(src) .. ' Cut Coke', 'coke')
elseif coke2 then
- RemoveItem('cokestagetwo', 1 )
- RemoveItem('bakingsoda', 1 )
- AddItem('loosecokestagetwo', 1)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Coke tier 2', 'coke')
+ if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier2') then return end
+ Log(GetName(src) .. ' Cut Coke tier 2', 'coke')
elseif coke3 then
- RemoveItem('cokestagethree', 1 )
- RemoveItem('bakingsoda', 1 )
- AddItem('loosecokestagethree', 1)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Coke tier 3', 'coke')
+ if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier3') then return end
+ Log(GetName(src) .. ' Cut Coke tier 3', 'coke')
else
- Notifys(Lang.Coke.nocutcoke, "error")
+ Notifys(src,Lang.Coke.nocutcoke, "error")
end
else
- if RemoveItem('coke', 1 ) then
- RemoveItem('bakingsoda', 1 )
- AddItem('loosecoke', 1)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Coke', 'coke')
- else
- Notifys(Lang.Coke.nocutcoke, "error")
- end
+ if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end
+ Log(GetName(src) .. ' Cut Coke', 'coke')
end
end)
RegisterServerEvent('md-drugs:server:bagcoke', function()
local src = source
- local Player = QBCore.Functions.GetPlayer(src)
- if not Itemcheck(Player, 'empty_weed_bag', 1, 'true') then return end
+ local Player = QBCore.Functions.GetPlayer(src)
if Config.TierSystem then
- local coke = Player.PlayerData.metadata['coke']
+ local coke = getRep(source, 'coke')
local locoke = Player.Functions.GetItemByName('loosecoke')
local locoke2 = Player.Functions.GetItemByName('loosecokestagetwo')
local locoke3 = Player.Functions.GetItemByName('loosecokestagethree')
if locoke then
- RemoveItem('loosecoke', 1 )
- RemoveItem('empty_weed_bag', 1)
- AddItem('cokebaggy', 1)
- Player.Functions.SetMetaData('coke', (coke + 1))
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Coke and now has a rep of ' .. coke + 1, 'coke')
+ if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end
+ AddRep(src, 'coke')
+ Log(GetName(src) .. ' Bagged Coke and now has a rep of ' .. coke + 1, 'coke')
elseif locoke2 then
- RemoveItem('loosecokestagetwo', 1 )
- RemoveItem('empty_weed_bag', 1)
- AddItem('cokebaggystagetwo', 1)
- Player.Functions.SetMetaData('coke', (coke + 1))
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Coke tier 2 and now has a rep of ' .. coke + 1, 'coke')
+ if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end
+ AddRep(src, 'coke')
+ Log(GetName(src) .. ' Bagged Coke tier 2 and now has a rep of ' .. coke + 1, 'coke')
elseif locoke3 then
- RemoveItem('loosecokestagethree', 1 )
- RemoveItem('empty_weed_bag', 1)
- AddItem('cokebaggystagethree', 1)
- Player.Functions.SetMetaData('coke', (coke + 1))
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Coke tier 3 and now has a rep of ' .. coke + 1, 'coke')
+ if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier3') then return end
+ AddRep(src, 'coke')
+ Log(GetName(source) .. ' Bagged Coke tier 3 and now has a rep of ' .. coke + 1, 'coke')
else
- Notifys(Lang.Coke.nobagcoke, "error")
+ Notifys(src, Lang.Coke.nobagcoke, "error")
end
else
- if RemoveItem('loosecoke', 1 ) then
- RemoveItem('empty_weed_bag', 1)
- AddItem('cokebaggy', 1)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Coke', 'coke')
- else
- Notifys(Lang.Coke.nobagcoke, "error")
- end
+ if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end
+ Log(GetName(source) .. ' Bagged Coke', 'coke')
end
end)
+local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3}
+for k, v in pairs (cokecut) do
+ QBCore.Functions.CreateUseableItem(k, function(source, item)
+ local src = source
+ local Player = QBCore.Functions.GetPlayer(src)
+ if Player.Functions.GetItemByName(item.name) then
+ if not Itemcheck(src, 'bakingsoda', 1) then return end
+ TriggerClientEvent('md-drugs:client:minusTier', src, {type = 'coke', xt = 'bakingsoda', item = k, amount = v,recieve = 'loosecoke'})
+ end
+ end)
+end
\ No newline at end of file
diff --git a/server/consumables.lua b/server/consumables.lua
index ac7618e..d4fa8b5 100644
--- a/server/consumables.lua
+++ b/server/consumables.lua
@@ -15,9 +15,8 @@ end
RegisterNetEvent('md-drugs:server:removeconsum', function(item)
local src = source
- local Player = QBCore.Functions.GetPlayer(src)
- Player.Functions.RemoveItem(item, 1)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got High With ' .. item .. '!', 'consuming')
+ RemoveItem(source,item, 1)
+ Log(GetName(source) .. ' Got High With ' .. item .. '!', 'consuming')
end)
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
diff --git a/server/cornerselling.lua b/server/cornerselling.lua
index b4fbc28..fbedc37 100644
--- a/server/cornerselling.lua
+++ b/server/cornerselling.lua
@@ -1,21 +1,22 @@
local QBCore = exports['qb-core']:GetCoreObject()
-local StolenDrugs = {}
lib.callback.register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, cb)
- local AvailableDrugs = {}
local Player = QBCore.Functions.GetPlayer(source)
if not Player then return nil end
local type = 0
- for k in pairs(QBConfig.DrugsPrice) do
+ for k, v in pairs(QBConfig.DrugsPrice) do
local item = Player.Functions.GetItemByName(k)
if item and type == 0 then
type = type + 1
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Allowed To Sell ' .. item.name .. '!' , 'cornerselling')
- return item.name, item.amount
+ Log(GetName(source) .. ' Allowed To Sell ' .. item.name .. '!' , 'cornerselling')
+ local amount = math.random(1,item.amount)
+ if amount >= 15 then amount = 15 end
+ local price = math.random(QBConfig.DrugsPrice[k]['min'], QBConfig.DrugsPrice[k]['max']) * amount
+ return item.name, amount, price
end
end
if type == 0 then
- return 'nothing', 0
+ return 'nothing', 0, 0
end
end)
@@ -23,9 +24,8 @@ end)
RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
-
- if RemoveItem(item, amount) then
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Sold ' .. amount .. ' Of ' .. item .. ' For A Price Of ' .. price .. '!' , 'cornerselling')
+ if RemoveItem(src, item, amount) then
+ Log(GetName(src) .. ' Sold ' .. amount .. ' Of ' .. item .. ' For A Price Of ' .. price .. '!' , 'cornerselling')
if QBConfig.MarkedBills then
if price >= QBConfig.DrugsPrice[item]['min'] * amount and price <= QBConfig.DrugsPrice[item]['max'] * amount then
local info = {
@@ -34,27 +34,13 @@ RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price
Player.Functions.AddItem('markedbills', 1, false, info )
end
elseif QBConfig.CustomDirtyMoney then
- Player.Functions.AddItem(QBConfig.CustomDirtyMoneyitem,price)
+ AddItem(src, QBConfig.CustomDirtyMoneyitem, price)
else
Player.Functions.AddMoney('cash', price)
end
end
end)
-RegisterNetEvent('md-drugs:server:robCornerDrugs', function(drugType, amount)
- local src = source
- local Player = QBCore.Functions.GetPlayer(src)
- local availableDrugs = getAvailableDrugs(src)
-
- if not availableDrugs or not Player then return end
-
- local item = availableDrugs[drugType].item
-
- Player.Functions.RemoveItem(item, amount)
- table.insert(StolenDrugs, {item = item, amount = amount})
- TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove", amount)
- TriggerClientEvent('md-drugs:client:refreshAvailableDrugs', src, getAvailableDrugs(src))
-end)
lib.addCommand('cornersell', {
help = 'Sell Things On The Corner',
params = {
@@ -63,6 +49,6 @@ lib.addCommand('cornersell', {
}, function(source, args, raw)
local src = source
local Player = QBCore.Functions.GetPlayer(source)
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Used Command cornersell!' , 'cornerselling')
+ Log(GetName(source) .. ' Used Command cornersell!' , 'cornerselling')
TriggerClientEvent('md-drugs:client:cornerselling', src)
end)
diff --git a/server/crack.lua b/server/crack.lua
index 0495059..6652f9c 100644
--- a/server/crack.lua
+++ b/server/crack.lua
@@ -4,85 +4,63 @@ local QBCore = exports['qb-core']:GetCoreObject()
RegisterServerEvent('md-drugs:server:makecrackone', function(num)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
- local playerPed = GetPlayerPed(source)
- if CheckDist(source, playerPed, Config.makecrack[num]['loc']) then end
- if not Itemcheck(Player, 'bakingsoda', 1, 'true') then return end
+ if CheckDist(src, Config.makecrack[num]['loc']) then return end
if Config.TierSystem then
local locoke = Player.Functions.GetItemByName('loosecoke')
local locoke2 = Player.Functions.GetItemByName('loosecokestagetwo')
local locoke3 = Player.Functions.GetItemByName('loosecokestagethree')
if locoke then
- RemoveItem('loosecoke', 1 )
- RemoveItem('bakingsoda', 1)
- AddItem('crackrock', 1)
- Notifys(Lang.Crack.makecrack, "success")
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Crack', 'crack')
+ if not GetRecipe(src, 'crack', 'cookcrack', 'tier1') then return end
+ Log(GetName(src) .. ' Cut Crack', 'crack')
elseif locoke2 then
- RemoveItem('loosecokestagetwo', 1 )
- RemoveItem('bakingsoda', 1)
- AddItem('crackrockstagetwo', 1)
- Notifys(Lang.Crack.makecrack, "success")
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Crack', 'crack')
+ if not GetRecipe(src, 'crack', 'cookcrack', 'tier2') then return end
+ Log(GetName(src) .. ' Cut Crack', 'crack')
elseif locoke3 then
- RemoveItem('loosecokestagethree', 1 )
- RemoveItem('bakingsoda', 1)
- AddItem('crackrockstagethree', 1)
- Notifys(Lang.Crack.makecrack, "success")
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Crack', 'crack')
+ if not GetRecipe(src, 'crack', 'cookcrack', 'tier3') then return end
+ Log(GetName(src) .. ' Cut Crack', 'crack')
else
- Notifys(Lang.Crack.nocoke, 'error')
+ Notifys(src,Lang.Crack.nocoke, 'error')
end
else
- if RemoveItem('loosecoke', 1 ) then
- RemoveItem('bakingsoda', 1)
- AddItem('crackrock', 1)
- Notifys(Lang.Crack.makecrack, "success")
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Crack', 'crack')
- else
- Notifys(Lang.Crack.nocoke, 'error')
- end
+ if not GetRecipe(src, 'crack', 'cookcrack', 'tier1') then return end
+ Log(GetName(src) .. ' Cut Crack', 'crack')
end
end)
RegisterServerEvent('md-drugs:server:bagcrack', function(num)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
- local playerPed = GetPlayerPed(source)
- if CheckDist(source, playerPed, Config.bagcrack[num]['loc']) then return end
- if not Itemcheck(Player, 'empty_weed_bag', 1, 'true') then return end
+ if CheckDist(src, Config.bagcrack[num]['loc']) then return end
if Config.TierSystem then
local rock = Player.Functions.GetItemByName('crackrock')
local rock2 = Player.Functions.GetItemByName('crackrockstagetwo')
local rock3 = Player.Functions.GetItemByName('crackrockstagethree')
if rock then
- RemoveItem('crackrock', 1 )
- RemoveItem('empty_weed_bag', 1)
- AddItem('baggedcracked', 1)
- Notifys(Lang.Crack.makecrack, "success")
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Crack', 'crack')
+ if not GetRecipe(src, 'crack', 'bagcrack', 'tier1') then return end
+ Log(GetName(src) .. ' Bagged Crack', 'crack')
elseif rock2 then
- RemoveItem('crackrockstagetwo', 1 )
- RemoveItem('empty_weed_bag', 1)
- AddItem('baggedcrackedstagetwo', 1)
- Notifys(Lang.Crack.makecrack, "success")
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Crack', 'crack')
+ if not GetRecipe(src, 'crack', 'bagcrack', 'tier2') then return end
+ Log(GetName(src) .. ' Bagged Crack', 'crack')
elseif rock3 then
- RemoveItem('crackrockstagethree', 1 )
- RemoveItem('empty_weed_bag', 1)
- AddItem('baggedcrackedstagethree', 1)
- Notifys(Lang.Crack.makecrack, "success")
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Crack', 'crack')
+ if not GetRecipe(src, 'crack', 'bagcrack', 'tier3') then return end
+ Log(GetName(src) .. ' Bagged Crack', 'crack')
else
- Notifys(Lang.Crack.nocoke, "error")
+ Notifys(src, Lang.Crack.nocoke, "error")
end
else
- if RemoveItem('crackrock', 1 ) then
- RemoveItem('empty_weed_bag', 1)
- AddItem('baggedcracked', 1)
- Notifys(Lang.Crack.makecrack, "success")
- Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Crack', 'crack')
- else
- Notifys(Lang.Crack.nocoke, "error")
- end
+ if not GetRecipe(src, 'crack', 'bagcrack', 'tier1') then return end
+ Log(GetName(src) .. ' Bagged Crack', 'crack')
end
-end)
\ No newline at end of file
+end)
+
+local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3}
+for k, v in pairs (cokecut) do
+ QBCore.Functions.CreateUseableItem(k, function(source, item)
+ local src = source
+ local Player = QBCore.Functions.GetPlayer(src)
+ if Player.Functions.GetItemByName(item.name) then
+ if not Itemcheck(src, 'bakingsoda', 1) then return end
+ TriggerClientEvent('md-drugs:client:minusTier', src, {type = 'crack', xt = 'bakingsoda', item = k, amount = v,recieve = 'crackrock'})
+ end
+ end)
+end
\ No newline at end of file
diff --git a/server/deliveries.lua b/server/deliveries.lua
index 40f3d7a..5ee95d2 100644
--- a/server/deliveries.lua
+++ b/server/deliveries.lua
@@ -1,128 +1,65 @@
QBCore = exports['qb-core']:GetCoreObject()
--- Functions
-exports('GetDealers', function()
- return QBConfig.Dealers
-end)
-- Callbacks
-QBCore.Functions.CreateCallback('md-drugs:server:RequestConfig', function(_, cb)
- cb(QBConfig.Dealers)
-end)
-
--- Events
-RegisterNetEvent('md-drugs:server:updateDealerItems', function(itemData, amount, dealer)
- local src = source
- local Player = QBCore.Functions.GetPlayer(src)
-
- if not Player then return end
-
- if QBConfig.Dealers[dealer]["products"][itemData.slot].amount - 1 >= 0 then
- QBConfig.Dealers[dealer]["products"][itemData.slot].amount = QBConfig.Dealers[dealer]["products"][itemData.slot].amount - amount
- TriggerClientEvent('md-drugs:client:setDealerItems', -1, itemData, amount, dealer)
+lib.callback.register('md-drugs:server:getDealers', function(data)
+ local check = MySQL.query.await('SELECT * FROM dealers', {})
+ local loc = json.encode({x = 899.98, y = -2603.24, z = 6.11, h = 176.12 })
+ if not check[1] then
+ MySQL.insert('INSERT INTO dealers SET name = ?, coords = ?, time = ?, createdby = ?', {'MD', loc, 'any', 'code Newb'})
+ return false
else
- Player.Functions.RemoveItem(itemData.name, amount)
- Player.Functions.AddMoney('cash', amount * QBConfig.Dealers[dealer]["products"][itemData.slot].price)
- TriggerClientEvent("QBCore:Notify", src, "none Left", "error")
+ return check
+ end
+end)
+
+
+lib.callback.register('md-drugs:server:GetDeliveryItem', function(data)
+ local src = source
+ local Player = QBCore.Functions.GetPlayer(src)
+ local item = math.random(1, #QBConfig.DeliveryItems)
+ local amount = math.random(1,4)
+ local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
+ local locnum = math.random(1, #QBConfig.DeliveryLocations)
+ local coord = json.encode({
+ x = math.floor(QBConfig.DeliveryLocations[locnum].coords.x * 100) / 100,
+ y = math.floor(QBConfig.DeliveryLocations[locnum].coords.y * 100) / 100,
+ z = math.floor(QBConfig.DeliveryLocations[locnum].coords.z * 100) / 100,
+ })
+ if not check[1] then
+ MySQL.insert('INSERT INTO deliveriesdealer SET cid = ?, itemdata = ?, timestart = ?, maxtime = ?, location = ?',
+ {Player.PlayerData.citizenid, json.encode({item = QBConfig.DeliveryItems[item].item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
+ AddItem(Player.PlayerData.source, QBConfig.DeliveryItems[item].item, amount)
+ return true, QBConfig.DeliveryItems[item].item, amount, coord
+ else
+ local time = os.time()
+ local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
+
+ if timeout > 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) Notifys(src, 'You Failed To Make It In Time!', 'error' ) return false end
+ Notifys(src,'You Already Have A Delivery To Make', 'error' ) return false, QBConfig.DeliveryItems[item].item, amount, coord
end
end)
-RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(deliveryData)
+RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
- local item = QBConfig.DeliveryItems[deliveryData.item].item
-
- if Player.Functions.AddItem(item, deliveryData.amount) then
- TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "add")
- end
-end)
-
-RegisterNetEvent('md-drugs:server:successDelivery', function(deliveryData, inTime)
- local src = source
- local Player = QBCore.Functions.GetPlayer(src)
- local item = QBConfig.DeliveryItems[deliveryData.item].item
- local itemAmount = deliveryData.amount
- local payout = deliveryData.itemData.payout * itemAmount
- local copsOnline = QBCore.Functions.GetDutyCount('police')
- local curRep = Player.PlayerData.metadata["dealerrep"]
- local invItem = Player.Functions.GetItemByName(item)
-
-
- if inTime then
- if invItem and invItem.amount >= itemAmount then -- on time correct amount
- Player.Functions.RemoveItem(item, itemAmount)
- if copsOnline > 0 then
- local copModifier = copsOnline * QBConfig.PoliceDeliveryModifier
- if QBConfig.UseMarkedBills then
- local info = {worth = math.floor(payout * copModifier)}
- Player.Functions.AddItem('markedbills', 1, false, info)
- else
- Player.Functions.AddMoney('cash', math.floor(payout * copModifier), 'drug-delivery')
- end
- else
- if QBConfig.UseMarkedBills then
- local info = {worth = payout}
- Player.Functions.AddItem('markedbills', 1, false, info)
- else
- Player.Functions.AddMoney('cash', payout, 'drug-delivery')
- end
- end
- TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove")
- TriggerClientEvent('QBCore:Notify', src, "You Got There In Time!", 'success')
- SetTimeout(math.random(5000, 10000), function()
- TriggerClientEvent('md-drugs:client:sendDeliveryMail', src, 'perfect', deliveryData)
- Player.Functions.SetMetaData('dealerrep', (curRep + QBConfig.DeliveryRepGain))
- end)
- else
- TriggerClientEvent('QBCore:Notify', src, "Wheres The Rest Of It", 'error')-- on time incorrect amount
- if invItem then
- local newItemAmount = invItem.amount
- local modifiedPayout = deliveryData.itemData.payout * newItemAmount
- Player.Functions.RemoveItem(item, newItemAmount)
- TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove")
- Player.Functions.AddMoney('cash', math.floor(modifiedPayout / QBConfig.WrongAmountFee))
- end
- SetTimeout(math.random(5000, 10000), function()
- TriggerClientEvent('md-drugs:client:sendDeliveryMail', src, 'bad', deliveryData)
- if curRep - 1 > 0 then
- Player.Functions.SetMetaData('dealerrep', (curRep - QBConfig.DeliveryRepLoss))
- else
- Player.Functions.SetMetaData('dealerrep', 0)
- end
- end)
- end
- else
- if invItem and invItem.amount >= itemAmount then -- late correct amount
- TriggerClientEvent('QBCore:Notify', src, "Where Were You Slow Ass", 'error')
- Player.Functions.RemoveItem(item, itemAmount)
- Player.Functions.AddMoney('cash', math.floor(payout / QBConfig.OverdueDeliveryFee), "delivery-drugs-too-late")
- TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove")
- SetTimeout(math.random(5000, 10000), function()
- TriggerClientEvent('md-drugs:client:sendDeliveryMail', src, 'late', deliveryData)
- if curRep - 1 > 0 then
- Player.Functions.SetMetaData('dealerrep', (curRep - QBConfig.DeliveryRepLoss))
- else
- Player.Functions.SetMetaData('dealerrep', 0)
- end
- end)
- else
- if invItem then -- late incorrect amount
- local newItemAmount = invItem.amount
- local modifiedPayout = deliveryData.itemData.payout * newItemAmount
- TriggerClientEvent('QBCore:Notify', src, "Late And Missing Product GZ You Suck", 'error')
- Player.Functions.RemoveItem(item, itemAmount)
- Player.Functions.AddMoney('cash', math.floor(modifiedPayout / QBConfig.OverdueDeliveryFee), "delivery-drugs-too-late")
- TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove")
- SetTimeout(math.random(5000, 10000), function()
- TriggerClientEvent('md-drugs:client:sendDeliveryMail', src, 'late', deliveryData)
- if curRep - 1 > 0 then
- Player.Functions.SetMetaData('dealerrep', (curRep - QBConfig.DeliveryRepLoss))
- else
- Player.Functions.SetMetaData('dealerrep', 0)
- end
- end)
+ local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
+ if not check[1] then return end
+ local time = os.time()
+ local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
+ local itemData = json.decode(check[1].itemdata)
+ if timeout >= 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) Notifys(source, 'You Failed To Make It In Time!', 'error' ) return end
+ if item ~= itemData.item then return end
+ if amount ~= itemData.amount then return end
+ if RemoveItem(src, item, amount) then
+ for k, v in pairs (QBConfig.DeliveryItems) do
+ if v.item == item then
+ local income = math.random(v.payout.min, v.payout.max)
+ Player.Functions.AddMoney('cash', income)
+ AddRep(src, 'dealerrep')
end
end
+ MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
end
end)
@@ -173,61 +110,6 @@ QBCore.Commands.Add("deletedealer", "Delete a dealer (Admin Only)", {{
end
end, "admin")
-QBCore.Commands.Add("dealers", "View all dealers (Admin Only)", {}, false, function(source, _)
- local DealersText = ""
- if QBConfig.Dealers ~= nil and next(QBConfig.Dealers) ~= nil then
- for _, v in pairs(QBConfig.Dealers) do
- DealersText = DealersText .. "Name: " .. v["name"] .. "
"
- end
- TriggerClientEvent('chat:addMessage', source, {
- template = '