diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index dd1b94c..5d152aa 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -1,164 +1,5 @@ local started = nil -local function loadParticle(dict) - if not HasNamedPtfxAssetLoaded(dict) then - RequestNamedPtfxAsset(dict) - end - while not HasNamedPtfxAssetLoaded(dict) do - Wait(0) - end - SetPtfxAssetNextCall(dict) -end - -function MethCooking() - local animDict, animName = "anim@amb@business@meth@meth_monitoring_cooking@cooking@", "chemical_pour_short_cooker" - ps.requestAnim(animDict, 500) - SetEntityCoords(PlayerPedId(), vector3(1005.773, -3200.402, -38.524)) - local targetPosition = GetEntityCoords(PlayerPedId()) - local animDuration = GetAnimDuration(animDict, animName) * 800 - FreezeEntityPosition(PlayerPedId(), true) - local scenePos, sceneRot = vector3(1010.656, -3198.445, -38.925), vector3(0.0, 0.0, 0.0) - local netScene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) - NetworkAddPedToSynchronisedScene(PlayerPedId(), netScene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) - local sacid = CreateObjectNoOffset("bkr_prop_meth_sacid", targetPosition, 1, 1, 0) - NetworkAddEntityToSynchronisedScene(sacid, netScene, animDict, "chemical_pour_short_sacid", 4.0, -8.0, 1) - local ammonia = CreateObjectNoOffset("bkr_prop_meth_ammonia", targetPosition, 1, 1, 0) - NetworkAddEntityToSynchronisedScene(ammonia, netScene, animDict, "chemical_pour_short_ammonia", 4.0, -8.0, 1) - NetworkStartSynchronisedScene(netScene) - Wait(animDuration) - NetworkStopSynchronisedScene(netScene) - DeleteObject(sacid) DeleteObject(ammonia) - FreezeEntityPosition(PlayerPedId(), false) - ps.requestModel('hei_prop_heist_thermite', 2000) - loadParticle('scr_ornate_heist') - local thermite = CreateObject('hei_prop_heist_thermite', vector3(1005.76, -3201.3, -39.25), true, false, false) - FreezeEntityPosition(thermite, true) - SetEntityRotation(thermite, 190.0, 90.0, 140.0, 3, true ) - Wait(1000) - local therm = StartParticleFxLoopedOnEntity('scr_heist_ornate_thermal_burn', thermite, 0.0, 1.4, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) - Wait(math.random(10000, 20000)) - StopParticleFxLooped(therm, true) -end - - -function SmashMeth() - local ver = "" - local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char02" - ps.requestAnim(animDict, 500) - local ped = PlayerPedId() - local targetPosition = vector3(1012.628, -3194.619, -39.589) - SetEntityCoords(ped, targetPosition) - Wait(1) - local animDuration = GetAnimDuration(animDict, animName) * 800 - FreezeEntityPosition(ped, true) - local scenePos, sceneRot = vector3(1008.734, -3196.646, -39.99), vector3(0.0, 0.0, 1.08) - local netScene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) - NetworkAddPedToSynchronisedScene(ped, netScene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) - local objects, sceneObjects = {}, { - { hash = "w_me_hammer", animName = "break_weigh_" .. ver .. "hammer"}, - { hash = "bkr_Prop_Meth_SmashedTray_01_frag_", animName = "break_weigh_"..ver.."tray01"}, - { hash = "bkr_Prop_Meth_Tray_02a", animName = "break_weigh_"..ver.."tray01^1"}, - { hash = "bkr_Prop_Meth_Tray_02a", animName = "break_weigh_"..ver.."tray01^2"}, - { hash = "bkr_Prop_Meth_SmashedTray_01_frag_", animName = "break_weigh_"..ver.."tray01^3"}, - } - for i=1, #sceneObjects, 1 do - local obj = CreateObjectNoOffset(sceneObjects[i].hash, targetPosition, true, true, true) - NetworkAddEntityToSynchronisedScene(obj, netScene, animDict, sceneObjects[i].animName, 4.0, -8.0, 1) - objects[#objects+1] = obj - end - NetworkStartSynchronisedScene(netScene) - Wait(animDuration) - NetworkStopSynchronisedScene(netScene) - for i=1, #objects, 1 do - DeleteObject(objects[i]) - end - RemoveAnimDict(animDict) - FreezeEntityPosition(ped, false) -end - -function BagMeth() - local ver = "" - local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01" - ps.requestAnim(animDict, 500) - local animDuration = GetAnimDuration(animDict, animName) * 1000 - local ped = PlayerPedId() - local coords = GetEntityCoords(ped) - 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_openbag_02", animName = "break_weigh_"..ver.."methbag01^1"}, - { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^2"}, - { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^3"} - }, - { - { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^4"}, - { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^5"}, - { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^6"} - }, - { - { hash = "bkr_prop_meth_scoop_01a", animName = "break_weigh_"..ver.."scoop"}, - { hash = "bkr_prop_coke_scale_01", animName = "break_weigh_"..ver.."scale"}, - { hash = "bkr_prop_fakeid_penclipboard", animName = "break_weigh_"..ver.."pen"} - }, - { - { hash = "bkr_prop_fakeid_clipboard_01a", animName = "break_weigh_"..ver.."clipboard"}, - { hash = "bkr_Prop_Meth_Tray_02a", animName = "break_weigh_"..ver.."tray01^5"} - } -} -local scenesList, entitiesList = {}, {} -for i=1, #scenes, 1 do - local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) - NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) - for j=1, #scenes[i], 1 do - local s = scenes[i][j] - RequestModel(s.hash) - while not HasModelLoaded(s.hash) do - Wait(0) - end - local obj = CreateObjectNoOffset(s.hash, coords, true, true, true) - SetModelAsNoLongerNeeded(s.hash) - entitiesList[#entitiesList+1] = obj - NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1) - end - scenesList[#scenesList+1] = scene -end -DisableCamCollisionForEntity(ped) -FreezeEntityPosition(ped, true) -for i=1, #scenesList, 1 do - NetworkStartSynchronisedScene(scenesList[i]) -end - -Wait(animDuration-11000) -for i=1, #scenesList, 1 do - NetworkStopSynchronisedScene(scenesList[i]) -end -for i=1, #entitiesList, 1 do - DeleteEntity(entitiesList[i]) -end -RemoveAnimDict(animDict) -FreezeEntityPosition(ped, false) -end - -function Tray() - local pos = GetEntityCoords(PlayerPedId(), true) - RequestAnimDict('anim@heists@box_carry@') - while (not HasAnimDictLoaded('anim@heists@box_carry@')) do - Wait(7) - end - TaskPlayAnim(PlayerPedId(), 'anim@heists@box_carry@', 'idle', 5.0, -1, -1, 50, 0, false, false, false) - RequestModel("bkr_prop_meth_tray_02a") - while not HasModelLoaded("bkr_prop_meth_tray_02a") do - Wait(0) - end - local trays = CreateObject("bkr_prop_meth_tray_02a", pos.x, pos.y, pos.z, true, true, true) - AttachEntityToEntity(trays, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), 0.01,-0.2, -0.2, 20.0, 0.0, 0.0, true, true, false, true, 1, true) -end - function CutCoke(coords, offset, rotation) local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter" ps.requestAnim(animDict, 500) @@ -365,11 +206,11 @@ end local hit = 0 function SpawnCarPedChase() + ps.debug("SpawnCarPedChase") local stoploc = vector3(-1157.63, -3056.71, 13.94) - local config = ps.callback('md-drugs:server:getLocs', false) - local start = config.StartLoc[math.random(1,#config.StartLoc)] + local start = GlobalState.MDDrugsLocs.StartLoc[math.random(1,#GlobalState.MDDrugsLocs.StartLoc)] if started then - Notify(Lang.lean.act,'error') + ps.notify(Lang.lean.act,'error') else started = true ps.requestModel("pounder", Config.RequestModelTime) @@ -385,28 +226,34 @@ function SpawnCarPedChase() SetPedIntoVehicle(driver, leancar, -1) SetPedFleeAttributes(driver,false) TaskVehicleDriveToCoordLongrange(driver, leancar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0) - SetPedKeepTask(driver, true) - repeat + SetPedKeepTask(driver, true) + repeat Wait(1000) until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0 RemoveBlip(leancar) - if GetEntityHealth(driver) == 0 then - AddSingleModel(leancar, { name = 'leancar', icon = 'fa-solid fa-car', label = Lang.targets.lean.st, - action = function() - hit = hit + 1 - if not minigame() 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) + if GetEntityHealth(driver) == 0 then + ps.entityTarget(leancar, { + { + name = 'leancar', + icon = 'fa-solid fa-car', + label = Lang.targets.lean.st, + action = function() + hit = hit + 1 + if not minigame() 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 + } + }) else DeleteVehicle(leancar) DeleteEntity(driver) DeleteEntity(pilot2) - end + end end end diff --git a/client/functions.lua b/client/functions.lua index e5dc6c0..25e58c3 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -230,7 +230,7 @@ end function GetCops(number) if number == 0 then return true end local amount = ps.callback('md-drugs:server:GetCoppers') - if amount >= number then return true else Notify('You Need '.. number - amount .. ' More Cops To Do This', 'error') end + if amount >= number then return true else ps.notify('You Need '.. number - amount .. ' More Cops To Do This', 'error') end end diff --git a/client/lean.lua b/client/lean.lua index cb1d07d..a61a135 100644 --- a/client/lean.lua +++ b/client/lean.lua @@ -1,41 +1,75 @@ -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 = ps.callback('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 = 'lean', - num = k, - label = 'Cooking Up ' .. GetLabel(item), - table = 'cups' - } - } - sorter(store, 'title') - lib.registerContext({id = 'leanCraft',title = "Make Lean", options = store}) +local started = false +local hit = 0 + +function SpawnCarPedChase() + local stoploc = vector3(-1157.63, -3056.71, 13.94) + local start = GlobalState.MDDrugsLocs.StartLoc[math.random(1,#GlobalState.MDDrugsLocs.StartLoc)] + if started then ps.notify(Lang.lean.act,'error') return end + started = true + ps.callback('md-drugs:server:RegisterLean') + ps.requestModel("pounder", Config.RequestModelTime) + ps.requestModel("ig_priest", Config.RequestModelTime) + ps.requestModel("cargobob3", Config.RequestModelTime) + + local leancar = CreateVehicle("pounder", start.x+3, start.y-2, start.z-1, 52.0, true, false) + local driver = CreatePed(26, "ig_priest", start.x, start.y, start.z, 268.9422, false, false) + local pilot2 = CreatePed(26, "ig_priest", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false) + + FreezeEntityPosition(pilot2, true) + SetEntityInvincible(pilot2, true) + SetEntityAsMissionEntity(leancar) + AddBlipForEntity(leancar) + SetPedIntoVehicle(driver, leancar, -1) + SetPedFleeAttributes(driver,false) + TaskVehicleDriveToCoordLongrange(driver, leancar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0) + SetPedKeepTask(driver, true) + + repeat + Wait(1000) + until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0 + + RemoveBlip(leancar) + + if GetEntityHealth(driver) == 0 then + ps.entityTarget(leancar, { + { + name = 'leancar', + icon = 'fa-solid fa-car', + label = Lang.targets.lean.st, + action = function() + hit = hit + 1 + if not minigame() then return end + TriggerServerEvent('md-drugs:server:givelean') + started = false + if math.random(1,100) <= 30 or hit == 4 then + hit = 0 + DeleteVehicle(leancar) + DeleteEntity(driver) + DeleteEntity(pilot2) + end + end + } + }) + else + DeleteVehicle(leancar) + DeleteEntity(driver) + DeleteEntity(pilot2) + end 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 +local leanPeds = {} +for k, v in pairs (GlobalState.MDDrugsLocs.SyrupVendor) do + ps.requestModel(v.ped) + leanPeds[k] = CreatePed(0, v.ped, v.loc.x, v.loc.y, v.loc.z, false, false) + Freeze(leanPeds[k], true, v.loc.w) + ps.entityTarget(leanPeds[k], { + { + icon = "fa-solid fa-hand-holding-medical", + label = ps.lang('Lean.buylean'), + action = function() + SpawnCarPedChase() + end, + }, + }) +end \ No newline at end of file diff --git a/client/lsd.lua b/client/lsd.lua index ff1687f..093031e 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -13,8 +13,8 @@ local function createLabKit(coord, head) action = function() local dict = "scr_ie_svm_technical2" if not ps.hasItems({ - {name = 'lysergic_acid', amount = 1}, - {name = 'diethylamide', amount = 1} + lysergic_acid = 1, + diethylamide = 1 }) then ps.notify(ps.lang('lsd.need'), 'error') return @@ -90,7 +90,7 @@ local function createLabKit(coord, head) canInteract = function() if dirtylsd then return true end end } } - ps.targetEntity(labkit, options) + ps.entityTarget(labkit, options) end for k, v in pairs (GlobalState.MDDrugsLocs.lysergicacid) do @@ -131,7 +131,7 @@ for k, v in pairs (GlobalState.MDDrugsLocs.diethylamide) do }) end -for k,v in pairs (GlobalState.MDDrugsLocs.gettabs) do +for k, v in pairs (GlobalState.MDDrugsLocs.gettabs) do ps.boxTarget('gettabs'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { { label = ps.lang('targets.lsd.buyt'), @@ -147,16 +147,19 @@ for k,v in pairs (GlobalState.MDDrugsLocs.gettabs) do } }) end - -for k, v in pairs (GlobalState.MDDrugsLocs.buykit) do - ps.boxTarget('buykit'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { +local seller = {} +for k, v in pairs (GlobalState.MDDrugsLocs.buyLSDkit) do + ps.requestModel(v.ped, 1000) + seller[k] = CreatePed(4, v.ped, v.loc.x, v.loc.y, v.loc.z, v.loc.w, false, false) + Freeze(seller[k], true, v.loc.w) + ps.entityTarget(seller[k], { { label = ps.lang('targets.lsd.buy'), icon = 'fa-solid fa-hand-holding-dollar', action = function() if ps.hasItem('lsdlabkit') then ps.notify(ps.lang('lsd.havlabkit'), 'error') return end if not ps.progressbar(ps.lang('lsd.buykit'), 4000, 'uncuff') then return end - TriggerEvent("md-drugs:client:buylabkit") + TriggerServerEvent('md-drugs:server:getlabkit', k) end, canInteract = function() if not handleGang(v.gang) then return false end @@ -167,7 +170,7 @@ for k, v in pairs (GlobalState.MDDrugsLocs.buykit) do end ps.registerCallback("md-drugs:client:setlsdlabkit", function() - if tableout then + if tableout then ps.notify(ps.lang('lsd.tableout'), 'error') return false else diff --git a/client/mescaline.lua b/client/mescaline.lua index 5c9c6e2..7a3992d 100644 --- a/client/mescaline.lua +++ b/client/mescaline.lua @@ -1,16 +1,27 @@ - -RegisterNetEvent("md-drugs:client:drymescaline", function() - if not ItemCheck('cactusbulb') then return end - if not progressbar(Lang.mescaline.dry, 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:drymescaline") -end) +for k, v in pairs (GlobalState.MDDrugsLocs.DryOutMescaline) do + ps.boxTarget('dryoutMesc'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { + { + label = ps.lang('mescaline.dry'), + icon = 'fa-solid fa-temperature-high', + action = function() + if not ps.hasItem('cactusbulb') then ps.notify(ps.lang('mescaline.needbulb'), 'error') return end + if not ps.progressbar(ps.lang('mescaline.dry'), 4000, 'drymescaline') then return end + TriggerServerEvent("md-drugs:server:drymescaline", k) + end, + canInteract = function() + if not handleGang(v.gang) then return false end + return true + end + } + }) +end RegisterNetEvent("md-drugs:client:takemescaline", function() local chance, chance2 = math.random(1,100), math.random(1,100) local weapon = '' if chance2 == 100 then weapon = 'weapon_rpg' else weapon = 'weapon_flaregun' end - if not progressbar(Lang.mescaline.eat, 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('mescaline.eat'), 4000, 'uncuff') then return end if chance <= Config.Badtrip then AlienEffect() local clone = ClonePed(PlayerPedId(), false, false, true) diff --git a/client/meth.lua b/client/meth.lua index c43f2ef..c20d164 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -1,78 +1,223 @@ -local amonia = nil -local tray = nil -local heated = nil -local active = nil +local amonia = false +local tray = false +local heated = false +local active = false +local trays = nil +---- start animation shit +local function loadParticle(dict) + if not HasNamedPtfxAssetLoaded(dict) then + RequestNamedPtfxAsset(dict) + end + while not HasNamedPtfxAssetLoaded(dict) do + Wait(0) + end + SetPtfxAssetNextCall(dict) +end -local function 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 +local function MethCooking(coords, offset, rotation) + local animDict, animName = "anim@amb@business@meth@meth_monitoring_cooking@cooking@", "chemical_pour_short_cooker" + ps.requestAnim(animDict, 500) + SetEntityCoords(PlayerPedId(), coords) + local targetPosition = GetEntityCoords(PlayerPedId()) + local animDuration = GetAnimDuration(animDict, animName) * 800 + FreezeEntityPosition(PlayerPedId(), true) + local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y, coords.z + offset.z), rotation + local netScene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) + NetworkAddPedToSynchronisedScene(PlayerPedId(), netScene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) + local sacid = CreateObjectNoOffset("bkr_prop_meth_sacid", targetPosition, 1, 1, 0) + NetworkAddEntityToSynchronisedScene(sacid, netScene, animDict, "chemical_pour_short_sacid", 4.0, -8.0, 1) + local ammonia = CreateObjectNoOffset("bkr_prop_meth_ammonia", targetPosition, 1, 1, 0) + NetworkAddEntityToSynchronisedScene(ammonia, netScene, animDict, "chemical_pour_short_ammonia", 4.0, -8.0, 1) + NetworkStartSynchronisedScene(netScene) + Wait(animDuration) + NetworkStopSynchronisedScene(netScene) + DeleteObject(sacid) DeleteObject(ammonia) + FreezeEntityPosition(PlayerPedId(), false) + ps.requestModel('hei_prop_heist_thermite', 2000) + loadParticle('scr_ornate_heist') + local thermite = CreateObject('hei_prop_heist_thermite', vector3(1005.76, -3201.3, -39.25), true, false, false) + FreezeEntityPosition(thermite, true) + SetEntityRotation(thermite, 190.0, 90.0, 140.0, 3, true ) + Wait(1000) + local therm = StartParticleFxLoopedOnEntity('scr_heist_ornate_thermal_burn', thermite, 0.0, 1.4, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) + Wait(math.random(10000, 20000)) + StopParticleFxLooped(therm, true) +end + + +local function SmashMeth(coords, offset, rotation) + local ver = "" + local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char02" + ps.requestAnim(animDict, 500) + local ped = PlayerPedId() + local targetPosition = coords + SetEntityCoords(ped, targetPosition) + Wait(1) + local animDuration = GetAnimDuration(animDict, animName) * 800 + FreezeEntityPosition(ped, true) + local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y, coords.z + offset.z), rotation + local netScene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) + NetworkAddPedToSynchronisedScene(ped, netScene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) + local objects, sceneObjects = {}, { + { hash = "w_me_hammer", animName = "break_weigh_" .. ver .. "hammer"}, + { hash = "bkr_Prop_Meth_SmashedTray_01_frag_", animName = "break_weigh_"..ver.."tray01"}, + { hash = "bkr_Prop_Meth_Tray_02a", animName = "break_weigh_"..ver.."tray01^1"}, + { hash = "bkr_Prop_Meth_Tray_02a", animName = "break_weigh_"..ver.."tray01^2"}, + { hash = "bkr_Prop_Meth_SmashedTray_01_frag_", animName = "break_weigh_"..ver.."tray01^3"}, + } + for i=1, #sceneObjects, 1 do + local obj = CreateObjectNoOffset(sceneObjects[i].hash, targetPosition, true, true, true) + NetworkAddEntityToSynchronisedScene(obj, netScene, animDict, sceneObjects[i].animName, 4.0, -8.0, 1) + objects[#objects+1] = obj + end + NetworkStartSynchronisedScene(netScene) + Wait(animDuration) + NetworkStopSynchronisedScene(netScene) + for i=1, #objects, 1 do + DeleteObject(objects[i]) + end + RemoveAnimDict(animDict) + FreezeEntityPosition(ped, false) +end + +local function BagMeth(coords, offset, rotation) + local ver = "" + local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01" + ps.requestAnim(animDict, 500) + local animDuration = GetAnimDuration(animDict, animName) * 1000 + local ped = PlayerPedId() + SetEntityCoords(ped, coords) + local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y, coords.z + offset.z), rotation + local scenes = { + { + { hash = "bkr_prop_meth_bigbag_04a", animName = "break_weigh_"..ver.."box01"}, + { hash = "bkr_prop_meth_bigbag_03a", animName = "break_weigh_"..ver.."box01^1"}, + { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01"} + }, + { + { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^1"}, + { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^2"}, + { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^3"} + }, + { + { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^4"}, + { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^5"}, + { hash = "bkr_prop_meth_openbag_02", animName = "break_weigh_"..ver.."methbag01^6"} + }, + { + { hash = "bkr_prop_meth_scoop_01a", animName = "break_weigh_"..ver.."scoop"}, + { hash = "bkr_prop_coke_scale_01", animName = "break_weigh_"..ver.."scale"}, + { hash = "bkr_prop_fakeid_penclipboard", animName = "break_weigh_"..ver.."pen"} + }, + { + { hash = "bkr_prop_fakeid_clipboard_01a", animName = "break_weigh_"..ver.."clipboard"}, + { hash = "bkr_Prop_Meth_Tray_02a", animName = "break_weigh_"..ver.."tray01^5"} + } +} + local scenesList, entitiesList = {}, {} + for i=1, #scenes, 1 do + local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) + NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) + for j=1, #scenes[i], 1 do + local s = scenes[i][j] + RequestModel(s.hash) + while not HasModelLoaded(s.hash) do + Wait(0) + end + local obj = CreateObjectNoOffset(s.hash, coords, true, true, true) + SetModelAsNoLongerNeeded(s.hash) + entitiesList[#entitiesList+1] = obj + NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1) + end + scenesList[#scenesList+1] = scene + end + DisableCamCollisionForEntity(ped) + FreezeEntityPosition(ped, true) + for i=1, #scenesList, 1 do + NetworkStartSynchronisedScene(scenesList[i]) + end + + Wait(animDuration-11000) + for i=1, #scenesList, 1 do + NetworkStopSynchronisedScene(scenesList[i]) + end + for i=1, #entitiesList, 1 do + DeleteEntity(entitiesList[i]) + end + RemoveAnimDict(animDict) + FreezeEntityPosition(ped, false) +end +---------------------- end animation shit +--- + +local function startcook(num, coords, offset, rotation) + if not amonia then + local adding = ps.callback('md-drugs:server:startcook', num) + if not adding then return end active = true - TriggerServerEvent("md-drugs:server:startcook") - MethCooking() + amonia = true + MethCooking(coords, offset, rotation) amonia = true else - Notify(Lang.meth.inside, "error") + ps.notify(ps.lang('meth.inside'), "error") end end -local function dials() + +local function dials(coords) if amonia == true then - if not minigame() then - AddExplosion(1005.773, -3200.402, -38.524, 49, 10, true, false, true) - ClearPedTasks(PlayerPedId()) - amonia = nil - active = nil + if not ps.minigame('ps-circle', {amount = 2, speed = 8}) then + AddExplosion(coords.x, coords.y,coords.z, 49, 10, true, false, true) + amonia = false + active = false return end - Notify(Lang.meth.increaseheat, "success") - ClearPedTasks(PlayerPedId()) - heated = true - else + ps.notify(ps.lang('meth.increaseheat'), "success") + heated = true end end -local function smash() -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) - Freeze(bucket, true, 90.0) - SmashMeth() - Wait(100) - AddSingleModel(bucket, - {name = 'bucket',icon = "fa-solid fa-sack-xmark",label = Lang.targets.meth.bag, canInteract = function() if active == nil then return false end end, - action = function() - active = nil - DeleteObject(bucket) - amonia = nil - heated = nil - tray = nil - BagMeth() - TriggerServerEvent('md-drugs:server:getmeth') - end,}, bucket) -end +local function smash(coords, offset, rotation, buckets, k) + if tray then + tray = false + DeleteObject(trays) + local bucket = CreateObject("bkr_prop_meth_bigbag_03a", buckets.x, buckets.y, buckets.z, true, true, true) + Freeze(bucket, true, buckets.w) + ps.entityTarget(bucket, { + { + name = 'bucket', + icon = "fa-solid fa-sack-xmark", + label = ps.lang('targets.meth.bag'), + canInteract = function() + if active == false then return false end + end, + action = function() + DeleteObject(bucket) + active = false + amonia = false + heated = false + tray = false + BagMeth(GlobalState.MDDrugsLocs.BagMeth[k].loc, GlobalState.MDDrugsLocs.BagMeth[k].offset, GlobalState.MDDrugsLocs.BagMeth[k].rotation) + TriggerServerEvent('md-drugs:server:getmeth', k) + end, + } + }) + SmashMeth(coords, offset, rotation) + Wait(100) + end end local function trayscarry() if amonia then local pos = GetEntityCoords(PlayerPedId(), true) - RequestAnimDict('anim@heists@box_carry@') - while (not HasAnimDictLoaded('anim@heists@box_carry@')) do - Wait(7) - end - TaskPlayAnim(PlayerPedId(), 'anim@heists@box_carry@', 'idle', 5.0, -1, -1, 50, 0, false, false, - false) - RequestModel("bkr_prop_meth_tray_02a") - while not HasModelLoaded("bkr_prop_meth_tray_02a") do - Wait(0) - end - trays = CreateObject("bkr_prop_meth_tray_02a", pos.x, pos.y, pos.z, true, true, true) - AttachEntityToEntity(trays, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), 0.01, -0.2, - -0.2, 20.0, 0.0, 0.0, true, true, false, true, 1, true) + ps.requestAnim('anim@heists@box_carry@') + TaskPlayAnim(PlayerPedId(), 'anim@heists@box_carry@', 'idle', 5.0, -1, -1, 50, 0, false, false, false) + ps.requestModel('bkr_prop_meth_tray_02a') + trays = CreateObject("bkr_prop_meth_tray_02a", pos.x, pos.y, pos.z, true, true, true) + AttachEntityToEntity(trays, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), 0.01, -0.2,-0.2, 20.0, 0.0, 0.0, true, true, false, true, 1, true) tray = true end end + CreateThread(function() BikerMethLab = exports['bob74_ipl']:GetBikerMethLabObject() BikerMethLab.Style.Set(BikerMethLab.Style.upgrade) @@ -81,46 +226,96 @@ CreateThread(function() RefreshInterior(BikerMethLab.interiorId) end) -CreateThread(function() - local config = ps.callback('md-drugs:server:getLocs', false) - AddBoxZoneSingle("methTeleOut",config.singleSpot.MethTeleIn, {name = 'teleout', icon = "fa-solid fa-door-open", label = Lang.targets.meth.enter, action = function() SetEntityCoords(PlayerPedId(), config.singleSpot.MethTeleOut) end} ) - AddBoxZoneSingle("methtelein",config.singleSpot.MethTeleOut, {name = 'teleout', icon = "fa-solid fa-door-closed", label = Lang.targets.meth.exit, action = function() SetEntityCoords(PlayerPedId(), config.singleSpot.MethTeleIn) end} ) - local options = { - { name = 'methcook', icon = "fa-solid fa-temperature-high", label = Lang.targets.meth.cook, distance = 2.5, action = function() startcook() end, - canInteract = function() - if amonia == nil and active == nil then +for k, v in pairs (GlobalState.MDDrugsLocs.CookMeth) do + ps.boxTarget('cookMeth'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ + { + label = 'Cook Meth', + icon = 'fa-solid fa-temperature-high', + action = function() + startcook(k, v.loc, v.offset or vec3(0,0,0), v.rotation or vector3(0,0,180.0)) + end, + canInteract = function() + if not amonia and not active then return true end - end, + end, }, - { name = 'grabtray', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.tray, distance = 2.5, action = function() trayscarry() end, - canInteract = function() - if heated and amonia and tray == nil then return true end - end, + { + icon = "fas fa-sign-in-alt", + label = ps.lang('targets.meth.tray'), + action = function() trayscarry() end, + canInteract = function() + if heated and amonia and not tray then + return true + end + end, }, - } - AddBoxZoneMultiOptions("cookmeth",vector3(1005.72, -3200.33, -38.52), options ) - AddBoxZoneSingle('boxmeth', vector3(1012.15, -3194.04, -39.20), {name = 'boxmeth',icon = "fa-solid fa-weight-scale",label = Lang.targets.meth.box,action = function() smash()end, + }) +end + +for k, v in pairs (GlobalState.MDDrugsLocs.MethDials) do + ps.boxTarget('adjustMethDials'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ + { + name = 'adjustdials', + icon = "fa-solid fa-temperature-three-quarters", + label = ps.lang('targets.meth.adjust'), + action = function() + dials(GlobalState.MDDrugsLocs.CookMeth[k].loc) + end, canInteract = function() - if tray then return true end - end}) - AddBoxZoneSingle('adjustdials',vector3(1007.89, -3201.17, -38.99),{ name = 'adjustdials', icon = "fa-solid fa-temperature-three-quarters", label = Lang.targets.meth.adjust, - distance = 5, action = function() dials() end, + if amonia and heated == false then return true end + end + } + }) +end + +for k, v in pairs (GlobalState.MDDrugsLocs.MethSmash) do + ps.boxTarget('smashMeth'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ + { + name = 'smash', + icon = "fa-solid fa-weight-scale", + label = ps.lang('targets.meth.smash'), + action = function() + smash(v.loc, v.offset, v.rotation, v.bucket,k) + end, canInteract = function() - if amonia and heated == nil then return true end end - }) - if Config.MethHeist == false then - AddBoxZoneMulti('methep', config.MethEph, {icon = "fa-solid fa-bucket", label = Lang.targets.meth.eph, event = 'md-drugs:client:stealeph'}) - AddBoxZoneMulti('methace', config.Methace, {icon = "fa-solid fa-bucket", label = Lang.targets.meth.ace, event = 'md-drugs:client:stealace'}) + if heated and amonia and tray then return true end + end + } + }) +end + +RegisterCommand('offset', function() + local pos = GetEntityCoords(PlayerPedId()) + Wait(4000) + local offset = GetEntityCoords(PlayerPedId()) - pos + print("Offset: ", offset) +end) + +if not Config.MethHeist then + for k, v in pairs (GlobalState.MDDrugsLocs.MethEph) do + ps.boxTarget('stealMethEph'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ + { + label = 'Steal Ephedrine', + icon = 'fa-solid fa-bucket', + action = function() + if not ps.progressbar('Stealing Ephedrine', 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:geteph", k) + end, + } + }) 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) -end) - -RegisterNetEvent("md-drugs:client:stealace", function(data) - if not progressbar('Stealing Acetone', 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:getace", data.data) -end) \ No newline at end of file + for k, v in pairs (GlobalState.MDDrugsLocs.Methace) do + ps.boxTarget('stealMethAce'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ + { + label = 'Steal Acetone', + icon = 'fa-solid fa-bucket', + action = function() + if not ps.progressbar('Stealing Acetone', 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:getace", k) + end, + } + }) + end +end \ No newline at end of file diff --git a/client/oxyruns.lua b/client/oxyruns.lua index c41161e..1661fa8 100644 --- a/client/oxyruns.lua +++ b/client/oxyruns.lua @@ -9,7 +9,7 @@ RegisterNetEvent("md-drugs:client:GetOxyCar", function() local oxycar = CreateVehicle("burrito3",loc.x, loc.y,loc.z, loc.w, true, false) exports[Config.Fuel]:SetFuel(oxycar, 100.0) TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(oxycar)) - Notify(Lang.oxy.truck, 'success') + ps.notify(Lang.oxy.truck, 'success') TriggerEvent("md-drugs:client:getoxylocationroute") AddSingleModel(oxycar, { event = "md-drugs:client:getfromtrunk", icon = "fa-solid fa-box", label = Lang.targets.oxy.pack}, nil ) end) @@ -30,14 +30,14 @@ RegisterNetEvent("md-drugs:client:getoxylocationroute", function() AddSingleModel(oxybuyer, { type = "client", label = Lang.targets.oxy.talk, icon = "fa-solid fa-dollar-sign", action = function() if carryPackage then - if not progressbar(Lang.oxy.hand, 4000, 'uncuff') then return end + if not ps.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") + ps.notify(Lang.oxy.empty, "error") end end}, oxybuyer) end @@ -46,7 +46,7 @@ end) RegisterNetEvent("md-drugs:client:getfromtrunk", function() if carryPackage then - Notify(Lang.oxy.cantcarry, "error") + ps.notify(Lang.oxy.cantcarry, "error") else local pos = GetEntityCoords(PlayerPedId(), true) lib.requestAnimDict('anim@heists@box_carry@') @@ -61,14 +61,14 @@ end) RegisterNetEvent("md-drugs:client:giveoxybox", function(data) if carryPackage then - if not progressbar(Lang.oxy.hand, 4000, 'uncuff') then return end + if not ps.progressbar(Lang.oxy.hand, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:giveoxybox") DeleteEntity(data.ped) DetachEntity(carryPackage, true, true) DeleteObject(carryPackage) carryPackage = nil else - Notify(Lang.oxy.empty, "error") + ps.notify(Lang.oxy.empty, "error") end end) diff --git a/client/pedspawns.lua b/client/pedspawns.lua index f1e2375..83498d2 100644 --- a/client/pedspawns.lua +++ b/client/pedspawns.lua @@ -22,6 +22,6 @@ CreateThread(function() AddSingleModel(heroinkitdealer, { label = Lang.targets.heroin.kit, icon = "fa-solid fa-money-bill", event = "md-drugs:client:buyheroinlabkit", distance = 2.0}, nil ) AddSingleModel(SyrupLocation, { type = "client", label = Lang.targets.lean.git, icon = "fa-solid fa-circle-info", event = "md-drugs:client:getsyruplocationtobuy", distance = 2.0}, nil ) AddSingleModel(WeedGuy, {label = "Weed Shop",icon = "fa-solid fa-cannabis", action = function() makeMenu('WeedShop') lib.showContext('WeedShop')end}, nil) - AddSingleModel(methdealer,{label = Lang.targets.meth.mission, icon = "fa-solid fa-circle-info", action = function() Notify(Lang.meth.mission, "success") SpawnMethCarPedChase() end,},nil ) + AddSingleModel(methdealer,{label = Lang.targets.meth.mission, icon = "fa-solid fa-circle-info", action = function() ps.notify(Lang.meth.mission, "success") SpawnMethCarPedChase() end,},nil ) AddSingleModel(travellingmerchant, {label = Lang.targets.travel.travel, icon = "fa-solid fa-cart-shopping", action = function() makeMenu('travellingMerchant') lib.showContext('travellingMerchant') end}, nil) end) \ No newline at end of file diff --git a/client/pharma.lua b/client/pharma.lua index 59aa46f..7650c5e 100644 --- a/client/pharma.lua +++ b/client/pharma.lua @@ -1,20 +1,20 @@ ps.registerCallback("md-drugs:client:prescriptionpad", function(data, op) - if getJobType() ~= 'ems' then return end + if ps.getJobType() ~= 'ems' then return end local input = lib.inputDialog('Who To Give A Prescription To?',{ {type = 'select', label = 'Player Name', options = data}, {type = 'select', label = 'Prescription', options = op}}) if not input[1] then return end - if not progressbar(Lang.Pharma.write, 4000, 'notepad') then return end + if not ps.progressbar(Lang.Pharma.write, 4000, 'notepad') then return end return {who = input[1], what = input[2]} end) RegisterNetEvent("md-drugs:client:fillprescription", function(data) - if not progressbar(Lang.Pharma.fill, 4000, 'uncuff') then return end + if not ps.progressbar(Lang.Pharma.fill, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:fillprescription", data.data) end) ps.registerCallback("md-drugs:client:unbottle", function() - if not progressbar(Lang.Pharma.open, 4000, 'uncuff') then return end + if not ps.progressbar(Lang.Pharma.open, 4000, 'uncuff') then return end return true end) diff --git a/client/shrooms.lua b/client/shrooms.lua index d2dedb0..323798d 100644 --- a/client/shrooms.lua +++ b/client/shrooms.lua @@ -1,6 +1,6 @@ RegisterNetEvent('md-drugs:client:takeshrooms', function() - if not progressbar(Lang.Shrooms.eat, 500, 'eat') then return end + if not ps.progressbar(Lang.Shrooms.eat, 500, 'eat') then return end TriggerEvent("evidence:client:SetStatus", "widepupils", 300) EcstasyEffect() end) diff --git a/client/weed.lua b/client/weed.lua index 59fd5f2..0ba52cf 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -19,15 +19,15 @@ CreateThread(function() action = function() if not ItemCheck('wetcannabis') then return end if drying then - Notify(Lang.Weed.busy, "error") + ps.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(Lang.Weed.wait, "success") + ps.notify(Lang.Weed.wait, "success") Wait(math.random(1000,5000)) - Notify(Lang.Weed.take, "success") + ps.notify(Lang.Weed.take, "success") AddSingleModel(weedplant, { icon = "fa-solid fa-cannabis", label = Lang.targets.weed.dpick, @@ -65,11 +65,11 @@ AddBoxZoneSingle('makeoil',config.singleSpot.MakeOil, { local loc = GetEntityCoords(PlayerPedId()) AddExplosion(loc.x, loc.y, loc.z, 49, 10, true, false, true) exploded = true - Notify(Lang.Weed.stovehot, "error") + ps.notify(Lang.Weed.stovehot, "error") Wait(1000 * 30) exploded = false return end - if not progressbar(Lang.Weed.shat, 4000, 'uncuff') then return end + if not ps.progressbar(Lang.Weed.shat, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:makeoil") end, canInteract = function() @@ -97,7 +97,7 @@ CreateThread(function() end) RegisterNetEvent("md-drugs:client:dodabs", function() - if not progressbar('Doing Dabs', 4000, 'bong2') then AlienEffect() return end + if not ps.progressbar('Doing Dabs', 4000, 'bong2') then AlienEffect() return end AlienEffect() end) @@ -128,14 +128,14 @@ local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tab end CreateThread(function() -createBluntOptions('ButterCraft', "Edible Cooking", 'Cooking A ', 'edibles') -createBluntOptions('mddrugsblunts', "Roll Blunts", 'Rolling A ', 'blunts') -createBluntOptions('mddrugsbluntwraps', "Dipping Syrup", 'Dipping Syrup To Make ', 'bluntwrap') +--createBluntOptions('ButterCraft', "Edible Cooking", 'Cooking A ', 'edibles') +--createBluntOptions('mddrugsblunts', "Roll Blunts", 'Rolling A ', 'blunts') +--createBluntOptions('mddrugsbluntwraps', "Dipping Syrup", 'Dipping Syrup To Make ', 'bluntwrap') 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 + if not ps.progressbar('Making ' .. data.item, 4000, 'uncuff') then return end TriggerServerEvent('md-drugs:server:MakeWeedItems', data) end) diff --git a/client/wholesale.lua b/client/wholesale.lua index ebfbbc7..f97d129 100644 --- a/client/wholesale.lua +++ b/client/wholesale.lua @@ -3,7 +3,7 @@ local miss = false RegisterNetEvent("md-drugs:client:GetLocation", function(drug) if not GetCops(Config.PoliceCount) then return end if miss then - Notify(Lang.Wholesale.al, 'error') + ps.notify(Lang.Wholesale.al, 'error') else local loc = drug.location local timer = 0 @@ -20,10 +20,10 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug) action = function() local luck = math.random(1,100) if luck <= Config.SuccessfulChance then - if not progressbar("Wholesaling Drugs", 4000, 'uncuff') then return end + if not ps.progressbar("Wholesaling Drugs", 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:SuccessSale", drug) else - progressbar("YOU FUCKED NOW", 4000, 'uncuff') + ps.progressbar("YOU FUCKED NOW", 4000, 'uncuff') SetUpPeds() end Wait(3000) @@ -39,7 +39,7 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug) if timer <= Config.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 then timer = 0 else - Notify('The Buyer Waited To Long', 'error') + ps.notify('The Buyer Waited To Long', 'error') DeleteEntity(drugdealer) end end diff --git a/client/xtc.lua b/client/xtc.lua index 9699339..f404d7b 100644 --- a/client/xtc.lua +++ b/client/xtc.lua @@ -2,11 +2,11 @@ local xtcpress = false RegisterNetEvent("md-drugs:client:setpress", function(type) if xtcpress then - Notify(Lang.xtc.out, 'error') + ps.notify(Lang.xtc.out, 'error') else local coords, head = StartRay2() xtcpress = true - progressbar('Setting Press On The Ground', 4000, 'uncuff') + ps.progressbar('Setting Press On The Ground', 4000, 'uncuff') local press = CreateObject("bkr_prop_coke_press_01aa", coords.x, coords.y, coords.z, true, false, false) PlaceObjectOnGroundProperly(press) Freeze(press, true, head) @@ -24,12 +24,12 @@ end) ps.registerCallback('md-drugs:client:setpress', function(type) if xtcpress then - Notify(Lang.xtc.out, 'error') + ps.notify(Lang.xtc.out, 'error') return false else local coords, head = StartRay2() xtcpress = true - progressbar('Setting Press On The Ground', 4000, 'uncuff') + ps.progressbar('Setting Press On The Ground', 4000, 'uncuff') local press = CreateObject("bkr_prop_coke_press_01aa", coords.x, coords.y, coords.z, true, false, false) PlaceObjectOnGroundProperly(press) Freeze(press, true, head) @@ -62,34 +62,34 @@ RegisterNetEvent("md-drugs:client:XTCMenu", function(type) end) RegisterNetEvent("md-drugs:client:GetPressBack", function(type, press) - if not progressbar(Lang.xtc.pickup, 5000, 'uncuff') then return end + if not ps.progressbar(Lang.xtc.pickup, 5000, 'uncuff') then return end DeleteObject(press) xtcpress = false TriggerServerEvent("md-drugs:server:getpressback", type) end) RegisterNetEvent("md-drugs:client:stealisosafrole", function(data) - if not minigame() then Notify(Lang.xtc.fail, "error") return end - if not progressbar(Lang.xtc.iso, 4000, 'uncuff') then return end + if not minigame() then ps.notify(Lang.xtc.fail, "error") return end + if not ps.progressbar(Lang.xtc.iso, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stealisosafrole",data.data) end) RegisterNetEvent("md-drugs:client:stealmdp2p", function(data) - if not minigame() then Notify(Lang.xtc.fail, "error") return end - if not progressbar(Lang.xtc.mdp2p, 4000, 'uncuff') then return end + if not minigame() then ps.notify(Lang.xtc.fail, "error") return end + if not ps.progressbar(Lang.xtc.mdp2p, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stealmdp2p", data.data) end) RegisterNetEvent("md-drugs:client:makingrawxtc", function(data) if not ItemCheck('isosafrole') then return end if not ItemCheck('mdp2p') then return end - if not progressbar(Lang.xtc.raw, 4000, 'uncuff') then return end + if not ps.progressbar(Lang.xtc.raw, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:makingrawxtc",data.data) end) RegisterNetEvent("md-drugs:client:MakeXTC", function(data) if not ItemCheck('raw_xtc') then return end - if not progressbar(Lang.xtc.pressing, 4000, 'uncuff') then return end + if not ps.progressbar(Lang.xtc.pressing, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:makextc",data) end) @@ -98,29 +98,29 @@ RegisterNetEvent("md-drugs:client:stampwhite", function(data) options = { { icon = GetImage('white_xtc'), title = 'White XTC', onSelect = function() - if not minigame() then Notify(Lang.xtc.fail, "error") return end - if not progressbar(string.format(Lang.xtc.stamp, 'White'), 4000, 'uncuff') then return end + if not minigame() then ps.notify(Lang.xtc.fail, "error") return end + if not ps.progressbar(string.format(Lang.xtc.stamp, 'White'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stampwhite",data.data) end }, { icon = GetImage('red_xtc'), title = 'Red XTC', onSelect = function() - if not minigame() then Notify(Lang.xtc.fail, "error") return end - if not progressbar(string.format(Lang.xtc.stamp, 'Red'), 4000, 'uncuff') then return end + if not minigame() then ps.notify(Lang.xtc.fail, "error") return end + if not ps.progressbar(string.format(Lang.xtc.stamp, 'Red'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stampred", data.data) end }, { icon = GetImage('orange_xtc'), title = 'Orange XTC', onSelect = function() - if not minigame() then Notify(Lang.xtc.fail, "error") return end - if not progressbar(string.format(Lang.xtc.stamp, 'Orange'), 4000, 'uncuff') then return end + if not minigame() then ps.notify(Lang.xtc.fail, "error") return end + if not ps.progressbar(string.format(Lang.xtc.stamp, 'Orange'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stamporange", data.data) end, }, { icon = GetImage('blue_xtc'), title = 'Blue XTC', onSelect = function() - if not minigame() then Notify(Lang.xtc.fail, "error") return end - if not progressbar(string.format(Lang.xtc.stamp, 'Blue'), 4000, 'uncuff') then return end + if not minigame() then ps.notify(Lang.xtc.fail, "error") return end + if not ps.progressbar(string.format(Lang.xtc.stamp, 'Blue'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stampblue", data.data) end }, @@ -130,13 +130,13 @@ RegisterNetEvent("md-drugs:client:stampwhite", function(data) end) RegisterNetEvent("md-drugs:client:getsinglepress", function() - if not progressbar(Lang.xtc.buyp, 4000, 'uncuff') then return end + if not ps.progressbar(Lang.xtc.buyp, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:buypress") end) RegisterNetEvent("md-drugs:client:exchangepresses", function(data) - if not progressbar(Lang.xtc.buyp, 4000, 'uncuff') then return end + if not ps.progressbar(Lang.xtc.buyp, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:upgradepress", data.data) end) diff --git a/server/consumables.lua b/server/consumables.lua index 92c8fb7..5436544 100644 --- a/server/consumables.lua +++ b/server/consumables.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + --[[ effect options alien @@ -21,7 +21,7 @@ strength = number -- how long you are strong boi ]] local Consume = { -- meth -methbags = { time = 4000, effect = 'meth', anim = "smoke", progressbartext = "Injesting", +methbags = { time = 4000, effect = 'meth', anim = "smoke", ps.progressbartext = "Injesting", add = {health = -20, stress = -10, speed = 40, strength = 10, thirst = -30}}, cokebaggy = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, cokebaggystagetwo = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, @@ -148,9 +148,9 @@ for k, v in pairs(Consume) do local time = v.time or Consumables.defaulttime local effect = v.effect or 0 local anim = v.anim or Consumables.defaultanim - local progressbartext = v.progressbartext or Consumables.defaultprogresstext + local ps.progressbartext = v.ps.progressbartext or Consumables.defaultprogresstext local add = v.add or {hunger = 0} - local done = ps.callback('md-drugs:client:consumedrugs', source, time, effect, anim, progressbartext, add, k) + local done = ps.callback('md-drugs:client:consumedrugs', source, time, effect, anim, ps.progressbartext, add, k) if done then RemoveItem(source, k, 1) end diff --git a/server/cornerselling.lua b/server/cornerselling.lua index 2c01dba..f5beb47 100644 --- a/server/cornerselling.lua +++ b/server/cornerselling.lua @@ -213,7 +213,7 @@ RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price return end AddRep(src, 'cornerselling', Drugs[item].rep * amount) - Log(string.format('%s Sold %s Of %s For A Price Of $%s !', GetName(src),amount, item, price), 'cornerselling') + --Log(string.format('%s Sold %s Of %s For A Price Of $%s !', GetName(src),amount, item, price), 'cornerselling') DrugDeals[ps.getIdentifier(src)] = nil ps.addMoney(src, 'cash', price) end) diff --git a/server/deliveries.lua b/server/deliveries.lua index 1fb6115..82b52af 100644 --- a/server/deliveries.lua +++ b/server/deliveries.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + local dloc = { {coords = vector4(282.48, -1814.32, 27.23, 145.11)}, @@ -122,8 +122,8 @@ ps.registerCallback('md-drugs:server:GetDeliveryItem', function(data) 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, item, amount, coord + if timeout > 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) ps.notify(src, 'You Failed To Make It In Time!', 'error' ) return false end + ps.notify(src,'You Already Have A Delivery To Make', 'error' ) return false, item, amount, coord end end) @@ -135,7 +135,7 @@ RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount) 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 timeout >= 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) ps.notify(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 @@ -169,7 +169,7 @@ lib.addCommand("newdealer", { local result = MySQL.scalar.await('SELECT name FROM dealers WHERE name = ?', { dealerName }) if result then - return Notifys(source,"Already Exists", "error") + return ps.notify(source,"Already Exists", "error") end MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', { @@ -202,8 +202,8 @@ lib.addCommand("deletedealer", { MySQL.query('DELETE FROM dealers WHERE name = ?', { dealerName }) QBConfig.Dealers[dealerName] = nil TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers) - TriggerClientEvent('QBCore:Notify', source, "Dealer Deleted", "success") + TriggerClientEvent('QBCore:ps.notify', source, "Dealer Deleted", "success") else - TriggerClientEvent('QBCore:Notify', source, "Who You Tryna Delete", "error") + TriggerClientEvent('QBCore:ps.notify', source, "Who You Tryna Delete", "error") end end) \ No newline at end of file diff --git a/server/functions.lua b/server/functions.lua index 0dc869f..f46a821 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -1,7 +1,3 @@ -local QBCore, ESX, qbx = {}, {}, nil -local notify = Config.Notify -- qb or ox -local inventory = Config.Inventory -- qb or ox -local invname = '' ------------------------------------------ logging stuff local logs = false @@ -12,311 +8,7 @@ local headers = { ['Content-Type'] = 'application/json', } -if Config.Framework == 'qb' then - QBCore = exports['qb-core']:GetCoreObject() -elseif Config.Framework == 'esx' then - ESX = exports['es_extended']:getSharedObject() -elseif Config.Framework == 'qbx' then - qbx = exports.qbx_core -end - -CreateThread(function() -if logs then - print'^2 Logs Enabled for md-drugs' - if logapi == 'insert string here' then - print'^1 homie you gotta set your api on line 4' - else - print'^2 API Key Looks Good, Dont Trust Me Though, Im Not Smart' - end -else - print'^1 logs disabled for md-drugs' -end -end) - -function Log(message, type) -if logs == false then return end - local buffer = { level = "info", message = message, resource = GetCurrentResourceName(), - metadata = { drugs = type, playerid = source} - } - SetTimeout(500, function() - PerformHttpRequest(endpoint, function(status, _, _, response) - if status ~= 200 then - if type(response) == 'string' then - response = json.decode(response) or response - end - end - end, 'POST', json.encode(buffer), headers) - buffer = nil - end) -end ------------------------------------- Player Stuff functions -function getPlayer(source) - local src = source - if Config.Framework == 'qb' then - local Player = QBCore.Functions.GetPlayer(src) - return Player - elseif Config.Framework == 'esx' then - local Player = ESX.GetPlayerFromId(src) - return Player - elseif Config.Framework == 'qbx' then - local Player = qbx:GetPlayer(source) - return Player - end -end - -function getPlayerByCid(cid) - if Config.Framework == 'qb' then - local Player = QBCore.Functions.GetPlayerByCitizenId(cid) - return Player - elseif Config.Framework == 'esx' then - local Player = ESX.GetPlayerFromIdentifier(cid) - return Player - elseif Config.Framework == 'qbx' then - local Player = qbx:GetPlayerByCitizenId(cid) - return Player - end -end - -function GetName(source) - local src = source - if Config.Framework == 'qb' then - local Player = getPlayer(src) - return Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname - elseif Config.Framework == 'esx' then - local Player = getPlayer(src) - return Player.getName() - elseif Config.Framework == 'qbx' then - local Player = getPlayer(src) - return Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname - end -end - -function getCid(source) - local src = source - if Config.Framework == 'qb' then - local Player = getPlayer(src) - return Player.PlayerData.citizenid - elseif Config.Framework == 'esx' then - local Player = getPlayer(src) - return Player.getIdentifier() - elseif Config.Framework == 'qbx' then - local Player = getPlayer(src) - return Player.PlayerData.citizenid - end -end - -function GetCoords(source) - local ped = GetPlayerPed(source) - local playerCoords = GetEntityCoords(ped) - return playerCoords -end - -function dist(source, coords) - local playerPed = GetPlayerPed(source) - local pcoords = GetEntityCoords(playerPed) - local dist = #(pcoords - coords) - - return dist -end - -function CheckDist(source, coords) - local playerPed = GetPlayerPed(source) - local pcoords = GetEntityCoords(playerPed) - local ok - if #(pcoords - coords) < 4.0 then - return ok - else - DropPlayer(source, 'md-drugs: You Were A Total Of ' .. #(pcoords - coords) .. ' Too Far Away To Trigger This Event') - return false - end -end - - -function Notifys(source, text, type) - local src = source - if notify == 'qb' then - TriggerClientEvent("QBCore:Notify", src, text, type) - elseif notify == 'ox' then - lib.notify(src, { title = text, type = type}) - elseif notify == 'okok' then - TriggerClientEvent('okokNotify:Alert', src, '', text, 4000, type, false) - else - print"^1 Look At The Config For Proper Alert Options" - end -end - -function GetLabels(item) - if inventory == 'qb' then - return QBCore.Shared.Items[item].label - elseif inventory == 'ox' then - local items = exports.ox_inventory:Items() - return items[item].label - end -end - -function CUI(item, useFunction) - if Config.Framework == 'qb' then - QBCore.Functions.CreateUseableItem(item, useFunction) - elseif Config.Framework == 'esx' then - ESX.RegisterUsableItem(item, useFunction) - elseif Config.Framework == 'qbx' then - qbx:CreateUseableItem(item, useFunction) - end -end - -function Itemcheck(source, item, amount) - if inventory == 'qb' then - local Player = getPlayer(source) - local itemchecks = Player.Functions.GetItemByName(item) - if itemchecks and itemchecks.amount >= amount then - return true - else - Notifys(source, 'You Need ' .. amount .. ' Of ' .. GetLabels(item) .. ' To Do this', 'error') - return false - end - elseif inventory == 'ox' then - local items = exports.ox_inventory:GetItem(source, item, nil, false) - if items.count >= amount then - return true - else - Notifys(source, 'You Need ' .. amount .. ' Of ' .. GetLabels(item) .. ' To Do This', 'error') - return false - end - end -end - -function hasItem(source, item, amount) - if inventory == 'qb' then - local Player = getPlayer(source) - local itemchecks = Player.Functions.GetItemByName(item) - if itemchecks and itemchecks.amount >= amount then - return true - else - return false - end - elseif inventory == 'ox' then - local items = exports.ox_inventory:GetItem(source, item, nil, false) - if items == nil then return false end - if items.count >= amount then - return true - else - return false - end - end -end - -function getItemCount(source, item) - if inventory == 'qb' then - local Player = getPlayer(source) - local itemchecks = Player.Functions.GetItemByName(item) - if itemchecks then - return itemchecks.amount - else - return false - end - elseif inventory == 'ox' then - local items = exports.ox_inventory:GetItem(source, item, nil, false) - if items == nil then - print('You are missing ' .. item) - return 0 - end - if items.count >= 1 then - return items.count - else - return 0 - end - end -end -function RemoveItem(source, item, amount) - if inventory == 'qb' then - local Player = getPlayer(source) - if Player.Functions.RemoveItem(item, amount) then - TriggerClientEvent(invname ..":client:ItemBox", source, QBCore.Shared.Items[item], "remove", amount) - return true - else - Notifys(source, 'You Need ' .. amount .. ' Of ' .. GetLabels(item) .. ' To Do This', 'error') - end - elseif inventory == 'ox' then - if exports.ox_inventory:RemoveItem(source, item, amount) then - return true - else - Notifys(source, 'You Need ' .. amount .. ' Of ' .. GetLabels(item) .. ' To Do This', 'error') - end - end -end - -function AddItem(source, item, amount) - if inventory == 'qb' then - local Player = getPlayer(source) - if Player.Functions.AddItem(item, amount) then - TriggerClientEvent(invname ..":client:ItemBox", source, QBCore.Shared.Items[item], "add", amount) - return true - else - print('Failed To Give Item: ' .. item .. ' Check Your qb-core/shared/items.lua') - return false - end - else - if exports.ox_inventory:AddItem(source, item, amount) then - return true - else - print('Failed To Give Item: ' .. item .. ' Check Your ox_inventory/data/items.lua') - return false - end - end -end - -function addMoney(source, type, amount) - if Config.Framework == 'qb' then - local Player = getPlayer(source) - if Player.Functions.AddMoney(type, amount) then - return true - else - return false - end - elseif Config.Framework == 'esx' then - local Player = getPlayer(source) - if Player.addMoney(amount) then - return true - else - return false - end - elseif Config.Framework == 'qbx' then - if qbx:AddMoney(source, type, amount) then - return true - else - return false - end - end -end - -function removeMoney(source, type, amount) - if Config.Framework == 'qb' then - local Player = getPlayer(source) - if Player.Functions.RemoveMoney(type, amount) then - return true - else - return false - end - elseif Config.Framework == 'esx' then - if type == 'bank' then - print('Does Not Support Bank Funds Removing From ESX Defaulted To Cash') - end - local Player = getPlayer(source) - if Player.getMoney() >= amount then - Player.removeMoney(amount) - return true - else - return false - end - elseif Config.Framework == 'qbx' then - if qbx:RemoveMoney(source, type, amount) then - return true - else - return false - end - end -end local function handleFresh(source) local table = json.encode({ coke = 0,lsd = 0,heroin = 0,dealerrep = 0, @@ -351,7 +43,7 @@ end function AddRep(source, type, amount) if not Config.TierSystem then return false end if not amount then amount = 1 end - local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {getCid(source)}) + local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {ps.getIdentifier(source)}) local reps = json.decode(sql[1].drugrep) local update local rep = '' @@ -367,11 +59,11 @@ function AddRep(source, type, amount) end end if update == '' then return false end - MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, getCid(source)}) + MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, ps.getIdentifier(source)}) return true else rep[type] = rep[type] + amount - MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {json.encode(rep), getCid(source)}) + MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {json.encode(rep), ps.getIdentifier(source)}) return true end end @@ -408,73 +100,6 @@ function sortTab(tbl, type) end) end -function getCops() - local amount = 0 - if Config.Framework == 'qb' then - local players = QBCore.Functions.GetQBPlayers() - for k, v in pairs(players) do - if v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then - amount = amount + 1 - end - end - return amount - elseif Config.Framework == 'esx' then - local players = ESX.GetPlayers() - for k, v in pairs(players) do - local xPlayer = ESX.GetPlayerFromId(v) - if xPlayer.job.name == 'police' and xPlayer.job.onduty then - amount = amount + 1 - end - end - return amount - elseif Config.Framework == 'qbx' then - return qbx:GetDutyCountType('leo') - end -end - -function getNear(src) - if Config.Framework == 'qb' then - local near = {} - local players = QBCore.Functions.GetPlayers() - for k, v in pairs (players) do - local targ = QBCore.Functions.GetPlayerByCitizenId(v.PlayerData.citizenid) - local tname = GetName(v.PlayerData.source) - local ped, tped = GetPlayerPed(src), GetPlayerPed(v.PlayerData.source) - local dist = #(GetEntityCoords(ped) - GetEntityCoords(tped)) - if dist < 5.0 then - table.insert(near, {label = tname, value = targ.PlayerData.citizenid}) - end - end - return near - elseif Config.Framework == 'esx' then - local near = {} - local players = ESX.GetPlayers() - for k, v in pairs (players) do - local targ = ESX.GetPlayerFromId(v) - local tname = GetName(v) - local ped, tped = GetPlayerPed(src), GetPlayerPed(v) - local dist = #(GetEntityCoords(ped) - GetEntityCoords(tped)) - if dist < 5.0 then - table.insert(near, {label = tname, value = getCid(v)}) - end - end - return near - elseif Config.Framework == 'qbx' then - local near = {} - local players = qbx:GetPlayers() - for k, v in pairs (players) do - local targ = qbx:GetPlayer(v) - local tname = GetName(v) - local ped, tped = GetPlayerPed(src), GetPlayerPed(v) - local dist = #(GetEntityCoords(ped) - GetEntityCoords(tped)) - if dist < 5.0 then - table.insert(near, {label = tname, value = getCid(v)}) - end - end - return near - end -end - function handleCornersell(source, item, amount, price) if RemoveItem(source, item, amount) then if inventory == 'qb' then @@ -501,27 +126,9 @@ lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args) return getCops() end) -lib.callback.register('md-drugs:server:GetRep', function(source, cb, args) +ps.registerCallback('md-drugs:server:GetRep', function(source, cb, args) local rep = GetAllRep(source) return rep end) -CreateThread(function() - if GetResourceState('ps-inventory') == 'started' then - invname = 'ps-inventory' - elseif GetResourceState('qb-inventory') == 'started' then - invname = 'qb-inventory' - else - invname = 'inventory' - end - local url = "https://raw.githubusercontent.com/Mustachedom/md-drugs/main/version.txt" - local version = GetResourceMetadata('md-drugs', "version" ) - PerformHttpRequest(url, function(err, text, headers) - if (text ~= nil) then - print('^2 Your Version:' .. version .. ' | Current Version:' .. text .. '' ) - end - end, "GET", "", "") - if GetResourceState('ox_lib') ~= 'started' then - print('^1 ox_lib Is A Depndancy, Not An Optional ') - end -end) +ps.versionCheck('md-drugs', 'https://raw.githubusercontent.com/Mustachedom/md-drugs/refs/heads/hushhushmotherfucker/version.txt', 'https://github.com/Mustachedom/md-drugs/') \ No newline at end of file diff --git a/server/heroin.lua b/server/heroin.lua index 79481c0..a4d3f7b 100644 --- a/server/heroin.lua +++ b/server/heroin.lua @@ -164,7 +164,7 @@ RegisterServerEvent('md-drugs:server:fillneedle', function(num) if vh then if not GetRecipe(src, 'heroin', 'fillneedle', v.tier) then return end AddRep(src, 'heroin') - Log(ps.getPlayerName(src) .. v.log, 'heroin') + --Log(ps.getPlayerName(src) .. v.log, 'heroin') return end end @@ -176,7 +176,7 @@ end) RegisterServerEvent('md-drugs:server:failheroin', function() local src = source - Log(ps.getPlayerName(src) ..' Sucks And Burned Their Heroin', 'heroin') + --Log(ps.getPlayerName(src) ..' Sucks And Burned Their Heroin', 'heroin') if Config.TierSystem then local itemList = { heroinvial = 1, diff --git a/server/lean.lua b/server/lean.lua index ff39052..4e90041 100644 --- a/server/lean.lua +++ b/server/lean.lua @@ -1,27 +1,68 @@ -local QBCore = exports['qb-core']:GetCoreObject() +local onRun = {} + +local function setTimeout(identifier) + if onRun[identifier] then + CreateThread(function() + Wait(10 * 60 * 1000) + onRun[identifier] = nil + end) + end +end RegisterServerEvent('md-drugs:server:givelean', function() - local chance = math.random(1,100) + local src = source local amount = math.random(1,5) - if chance <= 50 then - if AddItem(source, 'mdlean', amount) then - Notifys(Lang.Lean.lean, "success") - Log(GetName(source) .. ' Got ' .. amount .. ' Of Lean' , 'lean') - end + if not onRun[ps.getIdentifier(src)] then return ps.notify(src, Lang.lean.err, "error") end + onRun[ps.getIdentifier(src)] = onRun[ps.getIdentifier(src)] + 1 + if math.random(1,100) <= 50 then + ps.addItem(src, "mdlean", amount) else - if AddItem(source, 'mdreddextro', amount) then - Notifys(Lang.Lean.dextro, "success") - Log(GetName(source) .. ' Got ' .. amount .. ' Of Red Dextro' , 'lean') - end - end -end) - -CUI('leancup', function(source, item) - if Itemcheck(source, 'leancup', 1) then - TriggerClientEvent('md-drugs:client:leancraft', source) + ps.addItem(src, "mdreddextro", amount) + end + if onRun[ps.getIdentifier(src)] >= 4 then + onRun[ps.getIdentifier(src)] = nil end end) -RegisterServerEvent('md-drugs:server:finishcup', function(data) - if not GetRecipe(source, 'lean','cups', data.item) then return end +exports.ps_lib:registerCrafter({ + loc = GlobalState.MDDrugsLocs.MakeLean, + recipes = { + cupoflean = { + amount = 1, + time = 5000, + anim = 'uncuff', + recipe = { + leancup = 1, + mdlean = 1, + sprunk = 1 + } + }, + cupofdextro = { + amount = 1, + time = 5000, + anim = 'uncuff', + recipe = { + leancup = 1, + mdreddextro = 1, + sprunk = 1 + } + } + }, + targetData = { + size = {height = 1.0, width = 1.0, length = 1.0, rotation = 180.0}, + label = 'Make Lean', + icon = 'fa-solid fa-mug-saucer', + }, +}) + +ps.registerCallback('md-drugs:server:RegisterLean', function(source) + local identifier = ps.getIdentifier(source) + if not identifier then return false end + if onRun[identifier] then + return false + else + onRun[identifier] = 0 + setTimeout(identifier) + return true + end end) \ No newline at end of file diff --git a/server/locations.lua b/server/locations.lua index c1a6141..3083dae 100644 --- a/server/locations.lua +++ b/server/locations.lua @@ -30,6 +30,9 @@ local Target = { {loc = vector3(-1370.77, -314.51, 39.58), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {loc = vector3(2409.59, 5012.45, 46.09), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, }, + buyLSDkit = { + {ped = 'g_f_y_families_01', loc = vector4(2598.47, 5033.06, 105.86, 283.51), l = 1.0, w = 1.0, rot = 283.51, gang = ""}, + }, dryplant = { -- turn resin into powder {loc = vector3(-1353.77, -335.58, 43.92), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, }, @@ -54,15 +57,47 @@ local Target = { FillPrescription = { -- where to fill out your prescription {loc = vector3(2855.62, 4446.73, 48.53), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, }, + DryOutMescaline = { -- where to dry out mescaline + {loc = vector3(2638.22, 4237.93, 44.78), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, + }, + MakeLean = { + { + loc = vector3(2635.81, 4240.57, 45.32), + checks = { -- these can be arrays like {'police', 'ambulance'} or just a single string like 'police' + --gang = {}, + --item = {}, + --job = {}, + --citizenid = {} + } + }, + }, + CookMeth = { + {loc = vector3(1006.09, -3200.59, -38.52), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(4.79, 2.13, -0.41), rotation = vector3(0,0,0.0), gang = ""}, + }, + MethDials = { + {loc = vector3(1007.89, -3201.17, -38.99),l = 1.0, w = 1.0, rot = 45.0, gang = ""}, + }, + MethSmash = { + {loc = vector3(1012.04, -3194.96, -38.99), bucket = vector4(1012.86, -3194.13, -39.20, 90.00), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(-3.143311, -1.666748, -1.010128), rotation = vector3(0,0,0.0), gang = ""}, + }, + BagMeth = { + {loc = vector3(1014.25, -3194.93, -38.99), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(-4.9, -1.70, -1.01), rotation = vector3(0,0,0.0), gang = ""}, + }, + MethEph = { -- get ephedrine + {loc = vector3(3559.86, 3673.9, 28.13), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, + }, + Methace = { -- get acetone + {loc = vector3(3535.41, 3661.05, 28.12), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, + }, + SyrupVendor = { + {ped = 'a_m_m_farmer_01', loc = vector4(365.21, -578.77, 39.30, 347.23), l = 1.0, w = 1.0, rot = 347.23, gang = ""}, + }, singleSpot = { - CokeTeleIn = vector3(198.16, -1276.92, 29.33), -- where you target to go inside coke CokeTeleOut = vector3(1088.81, -3187.57, -38.99), -- where you target to leave coke buylsdlabkit = vector4(2598.47, 5033.06, 105.86, 283.51), -- buy lab kit for lsd buyheroinlabkit = vector4(-1358.77, -339.12, 43.92, 302.13), -- buy lab kit for heroin buypress = vector3(845.82, -884.79, 25.18), -- buy lab kit for xtc - DryOut = vector3(2638.22, 4237.93, 44.78), -- Place to dry out mescaline into usuable drug - SyrupVendor = vector4(365.21, -578.77, 39.30, 347.23), -- where the mission ped starts weedTelein = vector3(244.74, 374.54, 105.74), -- where you target to tele in weedTeleout = vector3(1066.31, -3183.36, -39.16), -- where you target to tele out MakeButter = vector3(1045.48, -3198.49, -38.22), -- where you make cannabutter and baked edibles @@ -74,12 +109,7 @@ local Target = { truckspawn = vector4(1450.87, -1482.13, 63.22, 69.95), --- where the truck will spawn when you pay for it Payfortruck = vector3(1437.64, -1491.91, 63.62), --- where you pay for the truck }, - MethEph = { -- get ephedrine - {loc = vector3(3559.86, 3673.9, 28.13), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, - }, - Methace = { -- get acetone - {loc = vector3(3535.41, 3661.05, 28.12), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, - }, + StartLoc = { -- where truck spawns for lean and meth missions vector3(-2307.22, 434.77, 174.47), vector3(614.75, 1786.26, 199.39), @@ -112,31 +142,8 @@ local Target = { } } GlobalState.MDDrugsLocs = Target -function checkLoc(source, event, num) - local ped = source - local pos = GetPlayerPed(ped) - local coord = GetEntityCoords(pos) - local loc - if type(num) == 'string' then - loc = vector3(Target[event][num].x, Target[event][num].y, Target[event][num].z) - else - loc = Target[event][num].loc - end - local dist = #(coord - loc) - if dist < 2.5 then - Log(GetName(source) .. ' Triggered the table ' .. event .. ' Within The Correct Distance', 'locations') - return true - else - Log(GetName(source) .. ' Triggered the table ' .. event .. ' Not Within The Correct Distance', 'locations') - Notifys(source, 'You are not in the correct location', 'error') - return false - end -end local loc = Target.Travellingmerchant[math.random(1, #Target.Travellingmerchant)] -ps.registerCallback('md-drugs:server:getLocs', function() - return Target -end) ps.registerCallback('md-drugs:server:GetMerchant', function(source) return loc diff --git a/server/lsd.lua b/server/lsd.lua index c8db10a..67f1526 100644 --- a/server/lsd.lua +++ b/server/lsd.lua @@ -30,7 +30,7 @@ RegisterServerEvent('md-drugs:server:getdiethylamide', function(num) local src = source if timedOut[src] then return end if not ps.checkDistance(src, GlobalState.MDDrugsLocs.diethylamide[num].loc, 2.0) then - Notifys(src, Lang.lsd.notinloc, "error") + ps.notify(src, Lang.lsd.notinloc, "error") return end timeout(src, 3000) @@ -41,7 +41,7 @@ end) ps.createUseable('lsdlabkit', function(source, item) local src = source local placed, loc = ps.callback('md-drugs:client:setlsdlabkit', src) - if placed then + if placed then if ps.removeItem(src, 'lsdlabkit', 1) then table.insert(lsdTables, { owner = ps.getPlayerName(src), @@ -64,7 +64,7 @@ end ps.registerCallback('md-drugs:server:removecleaningkit', function(source) local src = source - return ps.removeItem(src,"cleaningkit", 1) + return ps.removeItem(src, "cleaningkit", 1) end) RegisterServerEvent('md-drugs:server:getlabkitback', function() @@ -89,18 +89,18 @@ RegisterServerEvent('md-drugs:server:failheating', function() ps.removeItem(src, 'lysergic_acid', 1) ps.removeItem(src, 'diethylamide', 1) ps.notify(src, ps.lang('prices.lsd.failed'), "error") - Log(ps.getPlayerName(src) ..' Failed Basic LSD Like An Idiot!', 'lsd') + --Log(ps.getPlayerName(src) ..' Failed Basic LSD Like An Idiot!', 'lsd') end) RegisterServerEvent('md-drugs:server:refinequalityacid', function() local src = source if not hasLabKit(src) then return end -if not ps.itemCheck(src, 'lsd_one_vial', 1) then return end +if not ps.hasItem(src, 'lsd_one_vial', 1) then return end if Config.TierSystem then local lsd = getRep(src, 'lsd') if ps.removeItem(src, 'lsd_one_vial', 1) then - if lsd <= 30 then + if lsd <= 30 then ps.addItem(src,'lsd_vial_two', 1) elseif lsd >= 31 and lsd <= 60 then ps.addItem(src,'lsd_vial_three', 1) @@ -112,7 +112,7 @@ if not ps.itemCheck(src, 'lsd_one_vial', 1) then return end ps.addItem(src,'lsd_vial_six', 1) end AddRep(src,'lsd') - ps.log(ps.getPlayerName(src) ..' Refined Acid and Now Has A Rep Of ' .. lsd + 1 .. '!', 'lsd') + --ps.log(ps.getPlayerName(src) ..' Refined Acid and Now Has A Rep Of ' .. lsd + 1 .. '!', 'lsd') end else local randomchance = math.random(1,100) @@ -128,7 +128,7 @@ if not ps.itemCheck(src, 'lsd_one_vial', 1) then return end else ps.addItem(src,'lsd_vial_six', 1) end - ps.log(ps.getPlayerName(src) ..' Refined Acid!', 'lsd') + --ps.log(ps.getPlayerName(src) ..' Refined Acid!', 'lsd') end end end) @@ -136,25 +136,28 @@ end) RegisterServerEvent('md-drugs:server:failrefinequality', function() local src = source if not hasLabKit(src) then return end - if not ps.hasItem(src, 'lsd_one_vial', 1) then return end - ps.removeItem(src,'lsd_one_vial', 1) + ps.removeItem(src,'lsd_one_vial', 1) end) RegisterServerEvent('md-drugs:server:gettabpaper', function(num) local src = source if not ps.checkDistance(src, GlobalState.MDDrugsLocs.gettabs[num].loc, 3.0) then return end - if ps.removeMoney('cash', prices.tabcost * 10) then + if ps.removeMoney(src, 'cash', prices.tabcost * 10) then ps.addItem(src,'tab_paper', 10) else ps.notify(src, Lang.lsd.broke, "error") end end) -RegisterServerEvent('md-drugs:server:getlabkit', function() +RegisterServerEvent('md-drugs:server:getlabkit', function(num) local src = source - if not ps.checkDistance(src,'singleSpot', 'buylsdlabkit') then return end - if ps.removeMoney('cash', prices.lsdlabkitcost) then + if ps.hasItem(src,'lsdlabkit', 1) then + ps.notify(src, ps.lang('lsd.havlabkit'), 'error') + return + end + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.buyLSDkit[num].loc, 3.0) then return end + if ps.removeMoney(src, 'cash', prices.lsdlabkitcost) then ps.addItem(src,'lsdlabkit', 1) else ps.notify(src, Lang.lsd.broke, "error") @@ -174,8 +177,8 @@ RegisterServerEvent('md-drugs:server:maketabpaper', function() {vial = 'lsd_vial_six', sheet = 'gratefuldeadsheet', log = 'Made A Maze Sheet'} } for k, v in ipairs (vialdata) do - local check = ps.hasItem(src, v.vial) - if check then + local check = ps.hasItem(src, v.vial) and ps.hasItem(src, 'tab_paper') + if check then if ps.removeItem(src, v.vial, 1) and ps.removeItem(src, 'tab_paper', 1) then ps.addItem(src, v.sheet, 1) end @@ -193,12 +196,12 @@ local sheets = { } for k, v in pairs (sheets) do - CUI(v.item, function(source) + ps.createUseable(v.item, function(source) local src = source local math = math.random(1,10) if ps.removeItem(src, v.item, 1) then ps.addItem(src, v.recieve, math) - ps.log(ps.getPlayerName(src) ..' Made ' .. math .. 'Tabs of ' .. v.recieve .. '!', 'lsd') + --ps.log(ps.getPlayerName(src) ..' Made ' .. math .. 'Tabs of ' .. v.recieve .. '!', 'lsd') end end) end diff --git a/server/mescaline.lua b/server/mescaline.lua index fc85a5a..b859868 100644 --- a/server/mescaline.lua +++ b/server/mescaline.lua @@ -1,15 +1,18 @@ -RegisterNetEvent("md-drugs:server:drymescaline", function() +RegisterNetEvent("md-drugs:server:drymescaline", function(num) local src = source - if not checkLoc(src, 'singleSpot', 'DryOut') then return end + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.DryOutMescaline[num].loc, 3.0) then + ps.notify(src, "You are not in the right location", "error") + return + end if not GetRecipe(src, 'mescaline', 'dry', 'dried') then return end end) -CUI("driedmescaline", function(source, item) +ps.createUseable("driedmescaline", function(source, item) local src = source - if RemoveItem(src, "driedmescaline", 1) then + if ps.removeItem(src, "driedmescaline", 1) then TriggerClientEvent("md-drugs:client:takemescaline", src) - Log(GetName(source) .. ' Consumed Mescaline', 'consume') + --Log(GetName(source) .. ' Consumed Mescaline', 'consume') end -end) +end) \ No newline at end of file diff --git a/server/meth.lua b/server/meth.lua index b432da9..a1875b2 100644 --- a/server/meth.lua +++ b/server/meth.lua @@ -1,28 +1,38 @@ -local QBCore = exports['qb-core']:GetCoreObject() -RegisterServerEvent('md-drugs:server:startcook', function() - local src = source - if not GetRecipe(source, 'meth', 'cook', 'heat') then return end - Notifys(src, "Adding Things To The Mix", "success") -end) +local onRun = {} + +local function setTimeout(identifier) + if onRun[identifier] then + CreateThread(function() + Wait(10 * 60 * 1000) + onRun[identifier] = nil + end) + end +end RegisterServerEvent('md-drugs:server:givemethingridients', function() - local src = source - local chance = math.random(1,100) + local src = source local amount = math.random(1,5) - if chance <= 50 then - if AddItem(src,'ephedrine', amount) then - Log(GetName(src) .. ' Got ' .. amount .. ' Of Ephedrine', 'Meth') - end + if not onRun[ps.getIdentifier(src)] then return ps.notify(src, Lang.lean.err, "error") end + onRun[ps.getIdentifier(src)] = onRun[ps.getIdentifier(src)] + 1 + if math.random(1,100) <= 50 then + ps.addItem(src, "ephedrine", amount) else - if AddItem(src, 'acetone', amount) then - Log(GetName(src) .. ' Got ' .. amount .. ' Of Acetone', 'Meth') - end - end + ps.addItem(src, "acetone", amount) + end + if onRun[ps.getIdentifier(src)] >= 4 then + onRun[ps.getIdentifier(src)] = nil + end +end) +RegisterServerEvent('md-drugs:server:startcook', function(num) + local src = source + if not GetRecipe(source, 'meth', 'cook', 'heat') then return end + ps.notify(src, "Adding Things To The Mix", "success") end) -RegisterServerEvent('md-drugs:server:getmeth', function() +RegisterServerEvent('md-drugs:server:getmeth', function(num) local src = source + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.BagMeth[num].loc, 2.5) then return end if not GetRecipe(src, 'meth', 'bag', 'bags') then return end end) @@ -30,7 +40,7 @@ RegisterServerEvent('md-drugs:server:geteph', function(num) local src = source if not checkLoc(src, 'MethEph', num) then return end if AddItem(src, 'ephedrine', 1) then - Notifys(src, 'Got Ephedrine!', "success") + ps.notify(src, 'Got Ephedrine!', "success") end end) @@ -38,6 +48,14 @@ RegisterServerEvent('md-drugs:server:getace', function(num) local src = source if not checkLoc(src, 'Methace', num) then return end if AddItem(src, 'acetone', 1) then - Log(GetName(src) .. ' Got ' .. 1 .. 'Of Acetone', 'Meth') + --Log(GetName(src) .. ' Got ' .. 1 .. 'Of Acetone', 'Meth') end +end) + +ps.registerCallback('md-drugs:server:startcook', function(source, num) + local src = source + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.CookMeth[num].loc, 2.5) then return false end + local recipe = GetRecipe(src, 'meth', 'cook', 'heat') + ps.debug(recipe) + return recipe end) \ No newline at end of file diff --git a/server/oxyruns.lua b/server/oxyruns.lua index a3539f6..82a77d3 100644 --- a/server/oxyruns.lua +++ b/server/oxyruns.lua @@ -8,10 +8,10 @@ ps.registerCallback('md-drugs:server:payfortruck', function() local src = source local Player = getPlayer(src) if Player.Functions.RemoveMoney('cash', prices.payfortruck) or Player.Functions.RemoveMoney('bank', prices.payfortruck) then - Log(GetName(src) .. ' Rented A Van For OxyRuns', 'oxy') + --Log(GetName(src) .. ' Rented A Van For OxyRuns', 'oxy') return true else - Notifys(src, Lang.oxy.broke, "error") + ps.notify(src, Lang.oxy.broke, "error") return false end end) @@ -29,13 +29,13 @@ RegisterServerEvent('md-drugs:server:giveoxybox', function() } local item = itemList[math.random(1, #itemList)] if chance <= prices.hotchance then - Notifys(src, Lang.oxy.hot, "error") + ps.notify(src, Lang.oxy.hot, "error") Player.Functions.AddMoney("cash", cash * 0.5) if itemchance <= prices.itemChance then AddItem(src, item.item, item.amount) end else - Notifys(Lang.oxy.next, "success") + ps.notify(Lang.oxy.next, "success") TriggerClientEvent("md-drugs:client:getoxylocationroute", src) Player.Functions.AddMoney("cash", cash) if itemchance <= prices.itemChance then diff --git a/server/pharma.lua b/server/pharma.lua index 69aad4f..f0f3454 100644 --- a/server/pharma.lua +++ b/server/pharma.lua @@ -6,7 +6,7 @@ local function GetJob(source) if Player.PlayerData.job.type == 'ems' then return true else - Notifys(src, 'You Must Be EMS To Do This', 'error') + ps.notify(src, 'You Must Be EMS To Do This', 'error') return false end end @@ -54,8 +54,8 @@ CUI(d, function(source, item) if d == k then RemoveItem(src, d, 1) AddItem(src, v, math.random(10,30)) - Notifys(src,Lang.Pharma.unbottle, "success") - Log(GetName(src) .. ' Unbottled 30 Of ' .. v .. '!', 'pharma') + ps.notify(src,Lang.Pharma.unbottle, "success") + --Log(GetName(src) .. ' Unbottled 30 Of ' .. v .. '!', 'pharma') end end end @@ -73,5 +73,5 @@ RegisterServerEvent('md-drugs:server:fillprescription', function() break end end - Log(GetName(src) .. ' Filled A Prescription!', 'pharma') + --Log(GetName(src) .. ' Filled A Prescription!', 'pharma') end) diff --git a/server/plantSpawns.lua b/server/plantSpawns.lua index a25408b..eacd835 100644 --- a/server/plantSpawns.lua +++ b/server/plantSpawns.lua @@ -102,7 +102,7 @@ local plantData = { plants.cocaine[loc].taken = false GlobalState.CocaPlant = plants.cocaine TriggerClientEvent('coke:respawnCane', -1, loc) - Log('Coca Plant Respawned At ' .. plants.cocaine[loc].location, 'coke') + --Log('Coca Plant Respawned At ' .. plants.cocaine[loc].location, 'coke') end) end, allow = Config.Drugs.cocaine @@ -122,7 +122,7 @@ local plantData = { plants.heroin[loc].taken = false GlobalState.PoppyPlants = plants.heroin TriggerClientEvent('heroin:respawnCane', -1, loc) - Log('Heroin Plant Respawned At ' .. plants.heroin[loc].location, 'heroin') + --Log('Heroin Plant Respawned At ' .. plants.heroin[loc].location, 'heroin') end) end, allow = Config.Drugs.heroin @@ -142,7 +142,7 @@ local plantData = { plants.mescaline[loc].taken = false GlobalState.Mescaline = plants.mescaline TriggerClientEvent('Mescaline:respawnCane', -1, loc) - Log('Mescaline Plant Respawned At ' .. plants.mescaline[loc].location, 'mescaline') + --Log('Mescaline Plant Respawned At ' .. plants.mescaline[loc].location, 'mescaline') end) end, allow = Config.Drugs.mescaline @@ -162,7 +162,7 @@ local plantData = { plants.shrooms[loc].taken = false GlobalState.shrooms = plants.shrooms TriggerClientEvent('shrooms:respawnCane', -1, loc) - Log('Shroom Respawned At ' .. plants.shrooms[loc].location, 'shrooms') + --Log('Shroom Respawned At ' .. plants.shrooms[loc].location, 'shrooms') end) end, allow = Config.Drugs.shrooms @@ -182,7 +182,7 @@ local plantData = { plants.weed[loc].taken = false GlobalState.WeedPlant = plants.weed TriggerClientEvent('weed:respawnCane', -1, loc) - Log('Weed Plant Respawned At ' .. plants.weed[loc].location, 'weed') + --Log('Weed Plant Respawned At ' .. plants.weed[loc].location, 'weed') end) end, allow = Config.Drugs.weed diff --git a/server/recipes.lua b/server/recipes.lua index 63e4f28..d46e3b7 100644 --- a/server/recipes.lua +++ b/server/recipes.lua @@ -136,7 +136,8 @@ local recipe = { } function GetRecipe(source, type, method, tier) - ps.craftItem(source,recipe[type][method][tier]) + print(ps.craftItem(source,recipe[type][method][tier])) + return ps.craftItem(source,recipe[type][method][tier]) end ps.registerCallback('md-drugs:server:GetRecipe', function(source, type, cat) diff --git a/server/shops.lua b/server/shops.lua index acbe2f0..39b5f4f 100644 --- a/server/shops.lua +++ b/server/shops.lua @@ -73,7 +73,7 @@ RegisterServerEvent("md-drugs:server:purchaseGoods", function(amount, money, ite if not table[i].price == price then return end if Player.Functions.RemoveMoney(tostring(money), tonumber(table[i].price) * tonumber(amount)) then AddItem(src, item, amount) - Log(GetName(src) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant') + --Log(GetName(src) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant') end end end diff --git a/server/shrooms.lua b/server/shrooms.lua index 621bd70..72a76f6 100644 --- a/server/shrooms.lua +++ b/server/shrooms.lua @@ -3,8 +3,8 @@ CUI('shrooms', function(source, item) local src = source if TriggerClientEvent('md-drugs:client:takeshrooms', src, item.name) then RemoveItem(src, 'shrooms', 1) - Log(GetName(source) .. ' Took Some Mushrooms', 'shrooms') - Notifys(src, 'You Took Some Shrooms!', 'success') + --Log(GetName(source) .. ' Took Some Mushrooms', 'shrooms') + ps.notify(src, 'You Took Some Shrooms!', 'success') end end) diff --git a/server/weed.lua b/server/weed.lua index 9ecdf3d..e980c41 100644 --- a/server/weed.lua +++ b/server/weed.lua @@ -7,9 +7,9 @@ RegisterServerEvent('md-drugs:server:dryoutweed', function() local Player = getPlayer(src) if RemoveItem(src,"wetcannabis", 1) then AddItem(src,"drycannabis", 1) - Log(GetName(source) .. ' Dried Weed', 'weed') + --Log(GetName(source) .. ' Dried Weed', 'weed') else - Notifys(src, Lang.Weed.nodry, "error") + ps.notify(src, Lang.Weed.nodry, "error") end end) @@ -49,7 +49,7 @@ CUI("dabrig", function(source, item) TriggerClientEvent("md-drugs:client:dodabs", src) end else - Notifys(src, 'You Need A Butane Torch', 'error') + ps.notify(src, 'You Need A Butane Torch', 'error') end end) @@ -57,7 +57,7 @@ CUI("weedgrinder", function(source, item) local src = source local Player = getPlayer(src) local has = Player.Functions.GetItemByName("drycannabis") - if not has then Notifys(src, 'You Need Dried Cannabis', 'error') return end + if not has then ps.notify(src, 'You Need Dried Cannabis', 'error') return end local check = ps.callback('md-drugs:client:uncuff', src, 'Grinding Weed') if not check then return end if RemoveItem(src, "drycannabis",1 ) then diff --git a/server/wholesale.lua b/server/wholesale.lua index 12e6e0d..9f3f8eb 100644 --- a/server/wholesale.lua +++ b/server/wholesale.lua @@ -19,10 +19,10 @@ for k, v in pairs (burners) do CUI(k, function(source, item) local src = source local Player = getPlayer(src) - if getCops() < Config.PoliceCount then return Notifys(src, Lang.Wholesale.na, 'error') end + if getCops() < Config.PoliceCount then return ps.notify(src, Lang.Wholesale.na, 'error') end for m, d in pairs (active) do if d.cid == Player.PlayerData.citizenid then - return Notifys(src, Lang.Wholesale.al, 'error' ) + return ps.notify(src, Lang.Wholesale.al, 'error' ) end end local tab = '' diff --git a/server/xtc.lua b/server/xtc.lua index 86c3d03..326a6cd 100644 --- a/server/xtc.lua +++ b/server/xtc.lua @@ -125,9 +125,9 @@ RegisterServerEvent('md-drugs:server:buypress', function() if Player.Functions.RemoveMoney("cash", 20000) then AddItem(src, "singlepress", 1) - Log(GetName(source) .. ' Bought A Pill Press', 'xtc') + --Log(GetName(source) .. ' Bought A Pill Press', 'xtc') else - Notifys(Lang.xtc.cash, "error") + ps.notify(Lang.xtc.cash, "error") end end) @@ -140,7 +140,7 @@ RegisterServerEvent('md-drugs:server:upgradepress', function(data) elseif data == 'quad' then if not GetRecipe(src, 'xtc', 'press', 'quad') then return end else - Notifys(src, 'huh', 'error') + ps.notify(src, 'huh', 'error') end end) @@ -170,7 +170,7 @@ RegisterServerEvent('md-drugs:server:stampwhite', function(num) elseif RemoveItem(src, "white_xtc4", 1) then AddItem(src, four[chance], 1) else - Notifys('You Dont Have Unstamped White Pills', 'error') + ps.notify('You Dont Have Unstamped White Pills', 'error') end end) @@ -192,7 +192,7 @@ RegisterServerEvent('md-drugs:server:stampred', function(num) elseif RemoveItem(src, "red_xtc4", 1) then AddItem(src, four[chance], 1) else - Notifys('You Dont Have Unstamped red Pills', 'error') + ps.notify('You Dont Have Unstamped red Pills', 'error') end end) @@ -214,7 +214,7 @@ RegisterServerEvent('md-drugs:server:stamporange', function(num) elseif RemoveItem(src, "orange_xtc4", 1) then AddItem(src, four[chance], 1) else - Notifys('You Dont Have Unstamped orange Pills', 'error') + ps.notify('You Dont Have Unstamped orange Pills', 'error') end end) @@ -235,7 +235,7 @@ RegisterServerEvent('md-drugs:server:stampblue', function(num) elseif RemoveItem(src, "blue_xtc4", 1) then AddItem(src, four[chance], 1) else - Notifys('You Dont Have Unstamped blue Pills', 'error') + ps.notify('You Dont Have Unstamped blue Pills', 'error') end end) diff --git a/shared/config.lua b/shared/config.lua index b763867..a1b66cb 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -57,10 +57,10 @@ Config.Drugs = { cornerselling = true, heroin = true, deliveries = false, - lean = false, - lsd = false, + lean = true, + lsd = true, mescaline = true, - meth = false, + meth = true, oxyruns = false, pharma = false, shrooms = true,