diff --git a/client/TravellingMerchant.lua b/client/TravellingMerchant.lua new file mode 100644 index 0000000..c877c28 --- /dev/null +++ b/client/TravellingMerchant.lua @@ -0,0 +1,27 @@ + +local function spawn() + local location, menus = ps.callback('md-drugs:server:GetMerchant') + local model = 's_m_m_trucker_01' + ps.requestModel(model) + local ped = CreatePed(4, model, location.x, location.y, location.z, location.w, false, true) + Freeze(ped, true, location.w) + ps.entityTarget(ped, { + { + label = ps.lang('merchant.targetOpen'), + action = function() + local options = {} + for k, v in pairs (menus) do + options[#options+1] = { + title = ps.getLabel(k), + description = '$'..v, + action = function() + ps.triggerServerEvent('md-drugs:server:purchaseGoods', k) + end + } + end + ps.menu('Travelling Merchant', 'Travelling Merchant', options) + end + } + }) +end +spawn() diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index e8fef1a..a0b4c15 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -86,26 +86,4 @@ function AlienEffect() StopScreenEffect("DrugsMichaelAliensFightIn") StopScreenEffect("DrugsMichaelAliensFight") StopScreenEffect("DrugsMichaelAliensFightOut") -end - -function SetUpPeds() - AddRelationshipGroup('setups') - local ped = GetEntityCoords(PlayerPedId()) - 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] - 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 end \ No newline at end of file diff --git a/client/cocaine.lua b/client/cocaine.lua index 50a79a3..0c904be 100644 --- a/client/cocaine.lua +++ b/client/cocaine.lua @@ -114,14 +114,14 @@ end for k, v in pairs (locations.MakePowder) do ps.boxTarget('cocaplant'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { { - label = ps.lang('.targets.coke.pick'), + label = ps.lang('coke.makePow'), icon = 'fa-solid fa-seedling', action = function() if not ps.hasItem('coca_leaf') then - ps.notify('You Need A Coke Leaf') + ps.notify(ps.lang('coke.noleaf'), 'error') return end - if not ps.progressbar(ps.lang('Coke.makepow'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('coke.makePow'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:makepowder", k) end, canInteract = function() @@ -134,7 +134,7 @@ end for k, v in pairs (locations.CuttingCoke) do ps.boxTarget('cutcoke'..k, v.loc, {length = 1.0, width = 1.0, height = 1.0, rotation = 180.0}, { { - label = ps.lang('targets.coke.cut'), + label = ps.lang('coke.targetCutCoke'), icon = 'fa-solid fa-mortar-pestle', action = function() CutCoke(v.loc, v.offset, v.rotation) @@ -151,7 +151,7 @@ end for k, v in pairs (locations.BaggingCoke) do ps.boxTarget('bagcoke'..k, v.loc, {length = 1.0, width = 1.0, height = 1.0, rotation = 180.0}, { { - label = ps.lang('targets.coke.bag'), + label = ps.lang('coke.targetBagCoke'), icon = 'fa-solid fa-sack-xmark', action = function() BagCoke(v.loc, v.offset, v.rotation) @@ -169,19 +169,25 @@ for k, v in pairs (locations.cokeTele) do ps.boxTarget('coke_tele'..k, v.inside, {length = v.l, width = v.w, heading = v.rot}, { { icon = 'fa-solid fa-door-open', - label = ps.lang('targets.coke.telein'), + label = ps.lang('coke.teleOut'), action = function() SetEntityCoords(PlayerPedId(), v.outside) - end + end, + canInteract = function() + return handleGang(v.gang) + end } }) ps.boxTarget('coke_teleout'..k, v.outside, {length = v.l, width = v.w, heading = v.rot}, { { icon = 'fa-solid fa-door-closed', - label = ps.lang('targets.coke.teleout'), + label = ps.lang('coke.teleIn'), action = function() SetEntityCoords(PlayerPedId(), v.inside) - end + end, + canInteract = function() + return handleGang(v.gang) + end } }) end diff --git a/client/consumables.lua b/client/consumables.lua index ae93b3c..a4340b9 100644 --- a/client/consumables.lua +++ b/client/consumables.lua @@ -1,8 +1,8 @@ ps.registerCallback('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item) - if not progressbar(progresstext .. GetLabel(item).. "!", time, anim ) then return end - for k, v in pairs (status) do + if not progressbar(progresstext .. ps.getLabel(item).. "!", time, anim ) then return end + for k, v in pairs (status) do if k == 'health' then local cur = GetEntityHealth(PlayerPedId()) SetEntityHealth(PlayerPedId(), cur + v) @@ -56,7 +56,5 @@ RegisterNetEvent('md-drugs:client:applyFeeling', function(effect) CokeBaggyEffect() elseif effect == "trevor" then TrevorEffect() - else - end end) \ No newline at end of file diff --git a/client/cornerselling.lua b/client/cornerselling.lua index e97ff43..a0f7154 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -10,7 +10,7 @@ end local function sellDrug(item, amount, price, targ) -- PoliceCall(20) if ps.vehicleData() then - ps.notify(ps.lang('Cornerselling.inveh', 'error')) + ps.notify(ps.lang('Cornerselling.inVeh'), 'error') walkAway(targ) return end @@ -47,7 +47,7 @@ local function findPed() buyers[targ] = true - ps.drawText('Waiting For Customer') + ps.drawText(ps.lang('Cornerselling.wait')) repeat Wait(1000) @@ -89,7 +89,7 @@ local function Cornersell() return end - ps.drawText('Searching For Nearby Customers') + ps.drawText(ps.lang('Cornerselling.searching')) local targ = findPed() local data = ps.callback('md-drugs:server:cornerselling:getAvailableDrugs', targ) @@ -105,7 +105,7 @@ local function Cornersell() local got = false ps.entityTarget(targ, { { - label = "Take Back Drugs", + label = ps.lang('Cornerselling.targetTakeBack'), icon ="fa-solid fa-money-bill", action = function() got = true @@ -124,7 +124,7 @@ local function Cornersell() FreezeEntityPosition(targ, true) ps.entityTarget(data.ped, { { - label = string.format(ps.lang('targets.CornerSell.sell', data.amount, ps.getLabel(data.item), data.price)), + label = string.format(ps.lang('Cornerselling.targetSell'), data.amount, ps.getLabel(data.item), data.price), icon ="fa-solid fa-money-bill", action = function() sellDrug(data.item, data.amount, data.price, targ) @@ -137,7 +137,7 @@ local function Cornersell() end, }, { - label = ps.lang('targets.CornerSell.deny'), + label = ps.lang('Cornerselling.targetDeny'), icon = "fa-solid fa-person-harassing", action = function() deny(targ) @@ -161,14 +161,14 @@ RegisterNetEvent('md-drugs:client:cornerselling', function() ps.notify(ps.lang('Cornerselling.stopped', 'error')) else sell = true - ps.notify(ps.lang('Cornerselling.started', 'success')) + ps.notify(ps.lang('Cornerselling.start', 'success')) Cornersell() end end) CreateThread(function() for k, v in pairs (QBConfig.NoSellZones) do - local box = lib.zones.box({ coords = v.loc, size = vec3(v.width, v.length, v.height), rotation = 180.0, debug = false, + local box = ps.zones.box({ coords = v.loc, size = vec3(v.width, v.length, v.height), rotation = 180.0, debug = false, onEnter = function() inZone = true end, onExit = function() inZone = false end}) end end) \ No newline at end of file diff --git a/client/crack.lua b/client/crack.lua index 825dfee..85d0259 100644 --- a/client/crack.lua +++ b/client/crack.lua @@ -2,12 +2,12 @@ local locations = ps.callback('md-drugs:server:GetCrackLocations') for k, v in pairs (locations.makecrack) do ps.boxTarget('makeCrack'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { { - label = ps.lang('targets.crack.makecrack'), + label = ps.lang('crack.targetMake'), icon = 'fa-solid fa-temperature-high', action = function() if not ps.hasItem('bakingsoda') then return end if not minigame() then TriggerServerEvent("md-drugs:server:failcrackone", k) return end - if not ps.progressbar(ps.lang('Crack.makecrack'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('crack.cook'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:makecrack", k) end, canInteract = function() @@ -21,11 +21,11 @@ end for k, v in pairs (locations.bagcrack) do ps.boxTarget('bagCrack'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { { - label = ps.lang('targets.crack.bagcrack'), + label = ps.lang('crack.targetBag'), icon = 'fa-solid fa-weight-scale', action = function() if not ps.hasItem('empty_weed_bag') then return end - if not ps.progressbar(ps.lang('Crack.bagcrack'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('crack.bag'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:bagcrack", k) end, canInteract = function() diff --git a/client/deliveries.lua b/client/deliveries.lua index 817c66c..c1c46c6 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -1,33 +1,48 @@ local isActive = false local dealer = {} -RegisterNetEvent('md-drugs:client:opendealermenu', function() - local rep = GetRep() - makeMenu('dealermenu', rep) - lib.showContext('dealermenu') -end) - local function SpawnDealer() local getDealers = ps.callback('md-drugs:server:getDealers') for k,v in pairs(getDealers) do local Ped = "g_m_y_famdnf_01" - lib.requestModel(Ped, Config.RequestModelTime) + ps.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) - AddMultiModel(dealer[k], { - { icon = 'fas fa-user-secret', label = string.format(Lang.targets.Delivery.Deliver, v.name), - action = function() - local bool, item, amount, coords = ps.callback('md-drugs:server:GetDeliveryItem', false, k) - if bool then - Email(Lang.Delivery.emailn, Lang.Delivery.emailsub, string.format(Lang.Delivery.emailcon, amount, GetLabel(item))) - TriggerEvent('md-drugs:client:setLocation', {bool = bool, item = item, amount = amount, coords = coords}) - end - end, - }, - { icon = "fa-solid fa-store", label = string.format(Lang.targets.Delivery.open, v.name), - action = function() TriggerEvent('md-drugs:client:opendealermenu') end, - }}, dealer[k]) + ps.entityTarget(dealer[k], { + { + icon = 'fas fa-user-secret', + label = ps.lang('Deliveries.targetGetDel'), + action = function() + local bool, item, amount, coords = ps.callback('md-drugs:server:GetDeliveryItem', false, k) + if bool then + TriggerEvent('md-drugs:client:setLocation', {bool = bool, item = item, amount = amount, coords = coords}) + end + end, + }, + { + icon = "fa-solid fa-store", + label = ps.lang('Deliveries.targetOpenShop'), + action = function() + local rep = GetRep() + local items = ps.callback('md-drugs:server:dealerList') + local options = {} + for m, d in pairs (items) do + if rep.dealerrep >= d.minrep then + options[#options+1] = { + title = ps.getLabel(d.name), + description = '$' .. d.price, + icon = ps.getImage(d.name), + action = function() + TriggerServerEvent('md-drugs:server:buyItemDealer', m) + end, + } + end + end + ps.menu(ps.lang('Deliveries.shopHeader'), ps.lang('Deliveries.shopHeader'), options) + end, + } + }) end end @@ -46,11 +61,11 @@ RegisterNetEvent('md-drugs:client:setLocation', function(data) isActive = true local Buyer = CreatePed(0, "g_m_y_famdnf_01",coord.x, coord.y, coord.z-1, coord.w, false, false) Freeze(Buyer, true, coord.w) - AddSingleModel(Buyer, { + ps.entityTarget(Buyer, { icon = 'fas fa-user-secret', - label = Lang.targets.Delivery.hand, + label = ps.lang('Deliveries.targetHandOff'), action = function() - if not progressbar(Lang.Delivery.pack, 4000, 'uncuff') then return end + if not progressbar(ps.lang('Deliveries.delivering'), 4000, 'uncuff') then return end isActive = false DeletePed(Buyer) TriggerServerEvent('md-drugs:server:giveDeliveryItems', data.item, data.amount) diff --git a/client/functions.lua b/client/functions.lua index 25e58c3..f8d0f22 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -13,50 +13,24 @@ function loadParticle(dict) SetPtfxAssetNextCall(dict) end -function LoadModel(hash) - RequestModel(hash) - while not HasModelLoaded(hash) do - Wait(0) - end -end - function minigame() local time = 0 local game = Config.Minigames if minigametype == 'ps_circle' then - local check - exports['ps-ui']:Circle(function(success) - check = success - end, game['ps_circle'].amount, game['ps_circle'].speed) + local check = exports['ps-ui']:Circle(false, game['ps_circle'].amount, game['ps_circle'].speed) return check elseif minigametype == 'ps_maze' then - local check - exports['ps-ui']:Maze(function(success) - check = success - end, game['ps_maze'].timelimit) - repeat Wait(10) until check ~= nil + local check = exports['ps-ui']:Maze(false, game['ps_maze'].timelimit) return check elseif minigametype == 'ps_scrambler' then - local check - exports['ps-ui']:Scrambler(function(success) - check = success - end, game['ps_scrambler'].type, game['ps_scrambler'].time, game['ps_scrambler'].mirrored) - repeat Wait(10) until check ~= nil + local check = exports['ps-ui']:Scrambler(false, game['ps_scrambler'].type, game['ps_scrambler'].time, game['ps_scrambler'].mirrored) return check elseif minigametype == 'ps_var' then - local check - exports['ps-ui']:VarHack(function(success) - check = success - end, game['ps_var'].numBlocks, game['ps_var'].time) - repeat Wait(10) until check ~= nil + local check = exports['ps-ui']:VarHack(false, game['ps_var'].numBlocks, game['ps_var'].time) return check elseif minigametype == 'ps_thermite' then - local check - exports['ps-ui']:Thermite(function(success) - check = success - end, game['ps_thermite'].time, game['ps_thermite'].gridsize, game['ps_thermite'].incorrect) - repeat Wait(10) until check ~= nil - return check + local check = exports['ps-ui']:Thermite(false, game['ps_thermite'].time, game['ps_thermite'].gridsize, game['ps_thermite'].incorrect) + return check elseif minigametype == 'ox' then local success = lib.skillCheck(game['ox'], {'1', '2', '3', '4'}) return success @@ -129,63 +103,6 @@ function sorter(sorting, value) table.sort(sorting, function(a, b) return a[value] < b[value] end) end -function makeMenu(name, rep) - local menu = {} - local data = ps.callback('md-drugs:server:menu', name) - for k, v in pairs (data.table) do - local allow = false - if rep == nil then - allow = true - else - if rep.dealerrep >= v.minrep then allow = true end - end - if allow then - menu[#menu + 1] = { - icon = GetImage(v.name), - description = '$'.. v.price, - title = GetLabel(v.name), - onSelect = function() - local settext = "Cost: $"..v.price - local dialog = exports.ox_lib:inputDialog(v.name .."!", { - { type = 'select', label = "Payment Type", default = "cash", options = { { value = "cash"}, { value = "bank"},}}, - { type = 'number', label = "Amount to buy", description = settext, min = 0, max = v.amount, default = 1 }, - }) - if not dialog[1] then return end - TriggerServerEvent("md-drugs:server:purchaseGoods", dialog[2], dialog[1], v.name, v.price, data.table, k) - end, - } - end - end - sorter(menu, 'title') - lib.registerContext({id = data.id, title = data.title, options = menu}) -end - - -function Email(sender, subject, message) - if Config.Phone == 'yflip' then - local receiver = GetPlayerServerId(PlayerId()) - local insertId, received = exports["yflip-phone"]:SendMail({ - title = subject, - sender = sender, - senderDisplayName = sender, - content = message, - }, 'phoneNumber', receiver) - elseif Config.Phone == 'qs' then - TriggerServerEvent('qs-smartphone:server:sendNewMail', { - sender = sender, - subject = subject, - message = message, - button = {} - }) - else - TriggerServerEvent('qb-phone:server:sendNewMail', { - sender = sender, - subject = subject, - message = message, - }) - end -end - function PoliceCall(chance) local math = math.random(1,100) if math <= chance then @@ -242,28 +159,18 @@ function Freeze(entity, toggle, head) SetBlockingOfNonTemporaryEvents(entity, toggle) end -function tele(coords) - DoScreenFadeOut(500) - Wait(1000) - SetEntityCoords(PlayerPedId(),coords.x, coords.y, coords.z) - Wait(1000) - DoScreenFadeIn(500) -end - - - local created = false local heading = 180.0 function StartRay() local run = true local pedcoord = GetEntityCoords(PlayerPedId()) - lib.requestModel('v_ret_ml_tablea', 30000) + ps.requestModel('v_ret_ml_tablea', 30000) 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) + local hit, endCoords, surfaceNormal, entityHit = ps.raycast() if not created then created = true - lib.showTextUI([[[E] To Place + ps.drawText([[[E] To Place [DEL] To Cancel [<-] To Move Left [->] To Move Right]]) @@ -280,7 +187,7 @@ function StartRay() heading = heading + 2 end if IsControlPressed(0, 38) then - lib.hideTextUI() + ps.hideText() run = false DeleteObject(table) created = false @@ -288,7 +195,7 @@ function StartRay() end if IsControlPressed(0, 178) then - lib.hideTextUI() + ps.hideText() run = false created = false DeleteObject(table) @@ -301,13 +208,13 @@ end function StartRay2() local run = true local pedcoord = GetEntityCoords(PlayerPedId()) - lib.requestModel('bkr_prop_coke_press_01aa', 30000) + ps.requestModel('bkr_prop_coke_press_01aa', 30000) 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) + local hit, endCoords, surfaceNormal, entityHit = ps.raycast() if not created then created = true - lib.showTextUI([[[E] To Place + ps.drawText([[[E] To Place [DEL] To Cancel [<-] To Move Left [->] To Move Right]]) @@ -324,7 +231,7 @@ function StartRay2() heading = heading + 2 end if IsControlPressed(0, 38) then - lib.hideTextUI() + ps.hideText() run = false DeleteObject(table) created = false @@ -332,7 +239,7 @@ function StartRay2() end if IsControlPressed(0, 178) then - lib.hideTextUI() + ps.hideText() run = false created = false DeleteObject(table) @@ -343,10 +250,10 @@ function StartRay2() end CreateThread(function() - LoadModel('prop_plant_01b') - LoadModel('prop_plant_01a') - LoadModel('prop_cactus_03') - LoadModel('prop_weed_01') + ps.requestModel('prop_plant_01b') + ps.requestModel('prop_plant_01a') + ps.requestModel('prop_cactus_03') + ps.requestModel('prop_weed_01') TriggerEvent('weed:init') TriggerEvent('heroin:init') TriggerEvent('coke:init') @@ -363,18 +270,13 @@ end) RegisterCommand('DrugRep', function() if not Config.TierSystem then return end local rep = ps.callback('md-drugs:server:GetRep', false) - lib.registerContext({ - id = 'DrugRep', - title = 'Drug Reputation', - options = { - {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}, - {icon = "fa-solid fa-money-bill", title = 'Corner Selling: ' .. rep.cornerselling.rep, description = 'Rank: ' .. rep.cornerselling.label } - } - }) - lib.showContext('DrugRep') + ps.menu('Drug Rep', 'Drug Rep', { + {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}, + {icon = "fa-solid fa-money-bill", title = 'Corner Selling: ' .. rep.cornerselling.rep, description = 'Rank: ' .. rep.cornerselling.label } + }) end, false) function handleGang(gang) diff --git a/client/heroin.lua b/client/heroin.lua index 7e98113..5142730 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -9,19 +9,18 @@ local function createLabKit(coord, head) ps.entityTarget(heroinlabkit, { { icon = "fa-solid fa-temperature-high", - label = ps.lang('Heroin.cook'), + label = ps.lang('heroin.targetCook'), action = function() if not ps.hasItem('emptyvial') then return end if not minigame() then dirty = true TriggerServerEvent("md-drugs:server:failheatingheroin") ps.requestPTFX("core") - lib.requestNamedPtfxAsset("core") local heroinkit = StartParticleFxLoopedOnEntity("exp_air_molotov", heroinlabkit, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) SetParticleFxLoopedAlpha(heroinkit, 3.0) SetPedToRagdoll(PlayerPedId(), 1300, 1300, 0, 0, 0, 0) return end - if not ps.progressbar(ps.lang('Heroin.success'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('heroin.pbCook'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:heatliquidheroin") end, canInteract = function() @@ -30,9 +29,9 @@ local function createLabKit(coord, head) }, { icon = "fas fa-box-circle-check", - label = ps.lang('Heroin.up'), + label = ps.lang('heroin.targetPickup'), action = function() - if not ps.progressbar(ps.lang('Heroin.pickup'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('heroin.pbPickup'), 4000, 'uncuff') then return end herointable = false DeleteObject(heroinlabkit) TriggerServerEvent("md-drugs:server:getheroinlabkitback") @@ -43,12 +42,11 @@ local function createLabKit(coord, head) end }, { - event = "md-drugs:client:cleanheroinlabkit", icon = "fa-solid fa-hand-sparkles", - label = ps.lang('Heroin.clean'), + label = ps.lang('heroin.targetClean'), action = function() if not ps.hasItem('cleaningkit') then return end - if not ps.progressbar(ps.lang('Heroin.clean'), 4000, 'clean') then return end + if not ps.progressbar(ps.lang('heroin.pbClean'), 4000, 'clean') then return end local done = ps.callback('removeCleaningkit', false) if done then dirty = false end end, @@ -62,10 +60,10 @@ end for k, v in pairs (locations.dryplant) do ps.boxTarget('dryHeroin'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { { - label = ps.lang('targets.heroin.dry'), + label = ps.lang('heroin.targetDry'), icon = 'fa-solid fa-temperature-high', action = function() - if not ps.progressbar(ps.lang('Heroin.dryout'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('heroin.pbDry'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:dryplant", k) end, canInteract = function() @@ -78,11 +76,11 @@ end for k, v in pairs (locations.cutheroinone) do ps.boxTarget('cutHeroin'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { { - label = ps.lang('targets.heroin.cut'), + label = ps.lang('heroin.targetCutHeroin'), icon = 'fa-solid fa-seedling', action = function() if not ps.hasItem('bakingsoda') then return end - if not ps.progressbar(ps.lang('Heroin.cutting'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('heroin.pbCutHeroin'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:cutheroin", k) end, canInteract = function() @@ -100,15 +98,16 @@ for k, v in pairs (locations.buyKit) do SetEntityInvincible(peds[k], true) ps.entityTarget(peds[k], { { - label = ps.lang('targets.heroin.buykit'), + label = ps.lang('heroin.targetBuyKit'), icon = 'fa-solid fa-box-open', action = function() - if not ps.progressbar(ps.lang('Heroin.secret'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('heroin.pbBuyKit'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:getheroinlabkit", k) end, canInteract = function() - return true - end + if not handleGang(v.gang) then return false end + return true + end } }) end @@ -116,13 +115,13 @@ end ps.registerCallback("md-drugs:client:setheroinlabkit", function() if herointable then - ps.notify(ps.lang('Heroin.tableout'), 'error') + ps.notify(ps.lang('heroin.tableout'), 'error') return false else herointable = true local location, head = StartRay() if not location then herointable = false return end - if not ps.progressbar(ps.lang('Heroin.table'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('heroin.placing'), 4000, 'uncuff') then return end createLabKit(location, head) return true, location end @@ -131,11 +130,11 @@ end) for k, v in pairs (locations.fillneedle) do ps.boxTarget('fillNeedle'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { { - label = ps.lang('targets.heroin.fill'), + label = ps.lang('heroin.targetFill'), icon = 'fa-solid fa-syringe', action = function() if not minigame() then TriggerServerEvent("md-drugs:server:failheroin", k) return end - if not ps.progressbar(ps.lang('Heroin.needles'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('heroin.pbFill'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:fillneedle", k) end, canInteract = function() diff --git a/client/lean.lua b/client/lean.lua index d268f5d..c7ba289 100644 --- a/client/lean.lua +++ b/client/lean.lua @@ -38,7 +38,7 @@ local function SpawnCarPedChase() { name = 'leancar', icon = 'fa-solid fa-car', - label = Lang.targets.lean.st, + label = ps.lang('lean.stealFromTruck'), action = function() hit = hit + 1 if not minigame() then return end @@ -68,10 +68,14 @@ for k, v in pairs (location.SyrupVendor) do ps.entityTarget(leanPeds[k], { { icon = "fa-solid fa-hand-holding-medical", - label = ps.lang('Lean.buylean'), + label = ps.lang('lean.startMission'), action = function() SpawnCarPedChase() end, + canInteract = function() + if not handleGang(v.gang) then return false end + return true + end }, }) end \ No newline at end of file diff --git a/client/lsd.lua b/client/lsd.lua index 2b9d048..a51dd8d 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -11,16 +11,9 @@ local function createLabKit(coord, head) local options = { { icon = "fa-solid fa-temperature-high", - label = ps.lang('targets.lsd.heat'), + label = ps.lang('lsd.targetHeat'), action = function() local dict = "scr_ie_svm_technical2" - if not ps.hasItems({ - lysergic_acid = 1, - diethylamide = 1 - }) then - ps.notify(ps.lang('lsd.need'), 'error') - return - end if not minigame() then dirtylsd = true loadParticle(dict) @@ -28,7 +21,7 @@ local function createLabKit(coord, head) SetParticleFxLoopedAlpha(exitPtfx, 3.0) return end - if not ps.progressbar(ps.lang('lsd.heat'), 7000, 'uncuff') then return end + if not ps.progressbar(ps.lang('lsd.heating'), 7000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:heatliquid") end, canInteract = function() @@ -37,11 +30,11 @@ local function createLabKit(coord, head) }, { icon = "fa-solid fa-temperature-high", - label = ps.lang('targets.lsd.refine'), + label = ps.lang('lsd.targetRefine'), action = function() if not ps.hasItem('lsd_one_vial') then return end if not minigame() then TriggerServerEvent("md-drugs:server:failrefinequality") return end - if not ps.progressbar(ps.lang('lsd.refine'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('lsd.refining'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:refinequalityacid") end, canInteract = function() @@ -50,11 +43,11 @@ local function createLabKit(coord, head) }, { icon = "fa-regular fa-note-sticky", - label = ps.lang('targets.lsd.dab'), + label = ps.lang('lsd.targetDipping'), action = function() - if not ps.hasItem('tab_paper') then return end + if not ps.hasItem('tab_paper') then return end if not minigame() then TriggerServerEvent("md-drugs:server:failtabs") return end - if not ps.progressbar(ps.lang('lsd.dip'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('lsd.dipping'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:maketabpaper") end, canInteract = function() @@ -64,9 +57,9 @@ local function createLabKit(coord, head) { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", - label = ps.lang('targets.lsd.back'), + label = ps.lang('lsd.targetPickup'), action = function() - if not ps.progressbar(ps.lang('lsd.tablepack'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('lsd.packup'), 4000, 'uncuff') then return end DeleteObject(labkit) TriggerServerEvent('md-drugs:server:getlabkitback') tableout = false @@ -77,13 +70,13 @@ local function createLabKit(coord, head) }, { icon = "fa-solid fa-hand-sparkles", - label = ps.lang('targets.lsd.clean'), + label = ps.lang('lsd.targetClean'), action = function() if not ps.hasItem('cleaningkit') then - ps.notify(ps.lang('lsd.needclean'), 'error') + ps.notify(ps.lang('lsd.needCleaning'), 'error') return end - if not ps.progressbar(ps.lang('lsd.clean'), 4000, 'clean') then return end + if not ps.progressbar(ps.lang('lsd.cleaning'), 4000, 'clean') then return end local check = ps.callback('md-drugs:server:removecleaningkit') if check then dirtylsd = false @@ -98,12 +91,11 @@ end for k, v in pairs (locations.lysergicacid) do ps.boxTarget('lysergicacid'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { { - label = ps.lang('targets.lsd.lys'), + label = ps.lang('lsd.targetLys'), icon = 'fa-solid fa-temperature-high', action = function() - if not ps.hasItem('empty_weed_bag') then return end if not minigame() then TriggerServerEvent("md-drugs:server:faillysergic") return end - if not ps.progressbar(ps.lang('lsd.steallys'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('lsd.stealLys'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:getlysergic", k) end, canInteract = function() @@ -117,12 +109,12 @@ end for k, v in pairs (locations.diethylamide) do ps.boxTarget('diethylamide'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { { - label = ps.lang('targets.lsd.die'), + label = ps.lang('lsd.targetDie'), icon = 'fa-solid fa-temperature-high', action = function() if not ps.hasItem('empty_weed_bag') then return end if not minigame() then TriggerServerEvent("md-drugs:server:faildiethylamide") return end - if not ps.progressbar(ps.lang('lsd.stealdie'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('lsd.stealDie'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:getdiethylamide", k) end, canInteract = function() @@ -136,10 +128,9 @@ end for k, v in pairs (locations.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'), + label = ps.lang('lsd.targetBuyTab'), icon = 'fa-solid fa-hand-holding-dollar', action = function() - if not ps.hasItem('lsdlabkit') then ps.notify(ps.lang('lsd.havlabkit'), 'error') return end TriggerEvent("md-drugs:client:buytabs", k) end, canInteract = function() @@ -156,11 +147,11 @@ for k, v in pairs (locations.buyLSDkit) do Freeze(seller[k], true, v.loc.w) ps.entityTarget(seller[k], { { - label = ps.lang('targets.lsd.buy'), + label = ps.lang('lsd.targetBuyKit'), 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 + if ps.hasItem('lsdlabkit') then ps.notify(ps.lang('lsd.alreadyOwn'), 'error') return end + if not ps.progressbar(ps.lang('lsd.buyingKit'), 4000, 'uncuff') then return end TriggerServerEvent('md-drugs:server:getlabkit', k) end, canInteract = function() @@ -179,7 +170,7 @@ ps.registerCallback("md-drugs:client:setlsdlabkit", function() tableout = true local loc, head = StartRay() if not loc then tableout = false return end - if not ps.progressbar(ps.lang('lsd.place'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('lsd.placing'), 4000, 'uncuff') then return end createLabKit(loc, head) return true, loc end diff --git a/client/mescaline.lua b/client/mescaline.lua index 963a23f..64a35e6 100644 --- a/client/mescaline.lua +++ b/client/mescaline.lua @@ -2,11 +2,11 @@ local locations = ps.callback('md-drugs:server:GetMescalineLocs') for k, v in pairs (locations.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'), + label = ps.lang('mesc.targetDry'), 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 + if not ps.hasItem('cactusbulb') then ps.notify(ps.lang('Catches.itemNeeded', ps.getLabel('cactusbulb')), 'error') return end + if not ps.progressbar(ps.lang('mescaline.dry'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:drymescaline", k) end, canInteract = function() diff --git a/client/meth.lua b/client/meth.lua index 584900a..dacc97a 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -11,7 +11,7 @@ local function SpawnMethCarPedChase() local stoploc = vector3(-1157.63, -3056.71, 13.94) local start = locations.StartLoc[math.random(1,#locations.StartLoc)] if startedmeth then - ps.notify(ps.lang('meth.act'),'error') + ps.notify(ps.lang('meth.alreadyChasing'),'error') else startedmeth = true ps.callback('md-drugs:server:RegisterMeth') @@ -42,7 +42,7 @@ local function SpawnMethCarPedChase() { name = 'methcar', icon = 'fa-solid fa-car', - label = Lang.targets.meth.stealfromcar, + label = ps.lang('meth.targetStealFromCar'), action = function() if not minigame() then return end TriggerServerEvent('md-drugs:server:givemethingridients') @@ -71,9 +71,9 @@ for k, v in pairs (locations.MethHeist) do { name = 'methheist'..k, icon = 'fa-solid fa-user-secret', - label = ps.lang('targets.meth.heist'), + label = ps.lang('meth.targetHeist'), action = function() - if startedmeth then ps.notify(ps.lang('meth.act'),'error') return end + if startedmeth then ps.notify(ps.lang('meth.alreadyChasing'),'error') return end SpawnMethCarPedChase() end, canInteract = function() @@ -239,7 +239,7 @@ local function startcook(num, coords, offset, rotation) MethCooking(coords, offset, rotation) amonia = true else - ps.notify(ps.lang('meth.inside'), "error") + ps.notify(ps.lang('meth.started'), "error") end end @@ -251,7 +251,7 @@ local function dials(coords) amonia = false active = false return end - ps.notify(ps.lang('meth.increaseheat'), "success") + ps.notify(ps.lang('meth.increaseHeat'), "success") heated = true end end @@ -266,7 +266,7 @@ local function smash(coords, offset, rotation, buckets, k) { name = 'bucket', icon = "fa-solid fa-sack-xmark", - label = ps.lang('targets.meth.bag'), + label = ps.lang('meth.targetBag'), canInteract = function() if active == false then return false end end, @@ -309,22 +309,25 @@ end) for k, v in pairs (locations.CookMeth) do ps.boxTarget('cookMeth'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ { - label = 'Cook Meth', + label = ps.lang('meth.targetCook'), 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 handleGang(v.gang) then return false end if not amonia and not active then return true end + end, }, { icon = "fas fa-sign-in-alt", - label = ps.lang('targets.meth.tray'), + label = ps.lang('meth.targetGrabTray'), action = function() trayscarry() end, canInteract = function() + if not handleGang(v.gang) then return false end if heated and amonia and not tray then return true end @@ -338,11 +341,12 @@ for k, v in pairs (locations.MethDials) do { name = 'adjustdials', icon = "fa-solid fa-temperature-three-quarters", - label = ps.lang('targets.meth.adjust'), + label = ps.lang('meth.targetHeat'), action = function() dials(locations.CookMeth[k].loc) end, canInteract = function() + if not handleGang(v.gang) then return false end if amonia and heated == false then return true end end } @@ -354,11 +358,12 @@ for k, v in pairs (locations.MethSmash) do { name = 'smash', icon = "fa-solid fa-weight-scale", - label = ps.lang('targets.meth.smash'), + label = ps.lang('meth.targetSmash'), action = function() smash(v.loc, v.offset, v.rotation, v.bucket,k) end, canInteract = function() + if not handleGang(v.gang) then return false end if heated and amonia and tray then return true end end } @@ -372,30 +377,33 @@ RegisterCommand('offset', function() print("Offset: ", offset) end) -if not Config.MethHeist then - for k, v in pairs (locations.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 - - for k, v in pairs (locations.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 +for k, v in pairs (locations.MethEph) do + ps.boxTarget('stealMethEph'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ + { + label = ps.lang('meth.targetStealEPH'), + icon = 'fa-solid fa-bucket', + action = function() + if not ps.progressbar(ps.lang('meth.stealingEPH'), 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:geteph", k) + end, + canInteract = function() + return handleGang(v.gang) + end + } + }) +end +for k, v in pairs (locations.Methace) do + ps.boxTarget('stealMethAce'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ + { + label = ps.lang('meth.targetStealACE'), + icon = 'fa-solid fa-bucket', + action = function() + if not ps.progressbar(ps.lang('meth.stealingACE'), 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:getace", k) + end, + canInteract = function() + return handleGang(v.gang) + end + } + }) end \ No newline at end of file diff --git a/client/oxyruns.lua b/client/oxyruns.lua index b33cfd6..47e6b02 100644 --- a/client/oxyruns.lua +++ b/client/oxyruns.lua @@ -1,10 +1,11 @@ local carryPackage = nil local onMission = false local locations = ps.callback('md-drugs:server:GetOxyLocs') + local function getRoute() local Route = ps.callback('md-drugs:server:getRoute') if not Route then - ps.notify(ps.lang('oxy.done'), "success") + ps.notify(ps.lang('oxy.ditchCar'), "error") onMission = false return false end @@ -23,11 +24,11 @@ local function getRoute() PoliceCall(Config.PoliceAlertOxy) ps.entityTarget(oxybuyer,{ { - label = ps.lang('targets.oxy.talk'), + label = ps.lang('oxy.targetHandoff'), icon = "fa-solid fa-dollar-sign", action = function() if carryPackage then - if not ps.progressbar(ps.lang('oxy.hand'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('oxy.handingoff'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:giveoxybox") DeleteEntity(oxybuyer) DetachEntity(carryPackage, true, true) @@ -35,7 +36,7 @@ local function getRoute() carryPackage = nil getRoute() else - ps.notify(ps.lang('oxy.empty'), "error") + ps.notify(ps.lang('oxy.emptyHands'), "error") end end } @@ -46,7 +47,7 @@ for k, v in pairs(locations.OxyPayForTruck) do ps.boxTarget('oxyTruckPur' ..k , v.loc, {length = v.l, width = v.w, heading = v.rot}, { { icon = 'fa-solid fa-truck-fast', - label = ps.lang('targets.oxy.buytruck'), + label = ps.lang('oxy.targetPay'), action = function() ps.requestModel("burrito3", Config.RequestModelTime) @@ -56,17 +57,17 @@ for k, v in pairs(locations.OxyPayForTruck) do exports[Config.Fuel]:SetFuel(oxycar, 100.0) TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(oxycar)) - ps.notify(ps.lang('oxy.truck'), 'success') + ps.notify(ps.lang('oxy.keys'), 'success') onMission = true getRoute() ps.entityTarget(oxycar, { { icon = "fa-solid fa-box", - label = ps.lang('targets.oxy.pack'), + label = ps.lang('oxy.targetGetPackage'), action = function() if carryPackage then - ps.notify(ps.lang('oxy.cantcarry'), "error") + ps.notify(ps.lang('oxy.alreadyCarrying'), "error") else local pos = GetEntityCoords(PlayerPedId(), true) ps.requestAnim('anim@heists@box_carry@') @@ -76,6 +77,9 @@ for k, v in pairs(locations.OxyPayForTruck) do AttachEntityToEntity(carryPackage, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 57005), 0.05, 0.1, -0.3, 300.0, 250.0, 20.0, true, true, false, true, 1, true) end end, + canInteract = function() + return handleGang(v.gang) + end } }) end, diff --git a/client/pharma.lua b/client/pharma.lua index 52a81c1..aee3fad 100644 --- a/client/pharma.lua +++ b/client/pharma.lua @@ -1,17 +1,18 @@ local locations = ps.callback('md-drugs:server:GetPharmaLocs') + ps.registerCallback("md-drugs:client:prescriptionpad", function(data, op) if ps.getJobType() ~= 'ems' then return end - local input = exports.ps_lib:input('Who To Give A Prescription To?',{ - {type = 'select', title = 'Player Name', options = data}, - {type = 'select', title = 'Prescription', options = op} + local input = ps.input(ps.lang('pharma.input.header'), { + {type = 'select', title = ps.lang('pharma.input.title1'), options = data}, + {type = 'select', title = ps.lang('pharma.input.title2'), options = op} }) if not input[1] then return end - if not ps.progressbar(ps.lang('Pharma.write'), 4000, 'notepad') then return end + if not ps.progressbar(ps.lang('pharma.write'), 4000, 'notepad') then return end return {who = input[1], what = input[2]} end) ps.registerCallback("md-drugs:client:unbottle", function() - if not ps.progressbar(ps.lang('Pharma.open'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('pharma.opening'), 4000, 'uncuff') then return end return true end) @@ -20,11 +21,11 @@ for k, v in pairs (locations.FillPrescription) do ps.boxTarget('pharma' ..k , v.loc, {length = v.l, width = v.w, heading = v.rot}, { { icon = 'fa-solid fa-capsules', - label = ps.lang('Pharma.fillprescription'), + label = ps.lang('pharma.targetFill'), action = function() - if not ps.progressbar(ps.lang('Pharma.fill'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('pharma.fill'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:fillprescription", k) - end + end, } }) end \ No newline at end of file diff --git a/client/plantSpawns.lua b/client/plantSpawns.lua index bcfdfaa..756d0d7 100644 --- a/client/plantSpawns.lua +++ b/client/plantSpawns.lua @@ -1,64 +1,44 @@ local DrugPlants = { - {model = 'prop_plant_01a', label = 'coke', langs = ps.lang('targets.coke.pick'), tbl = GlobalState.CocaPlant, plantTbl = {}, + {model = 'prop_plant_01a', label = 'coke', langs = ps.lang('coke.targetPick'), tbl = GlobalState.CocaPlant, plantTbl = {}, pick = function(loc) - if not ps.progressbar(ps.lang('Coke.picking'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('coke.picking'), 4000, 'uncuff') then return end TriggerServerEvent("coke:pickupCane", loc) return true end, - target = { - icon = "fa-solid fa-seedling", - label = ps.lang('targets.coke.pick'), - }, allow = Config.Drugs.cocaine, }, - {model = 'prop_plant_01b', label = 'heroin',langs = ps.lang('targets.heroin.pick'), tbl = GlobalState.PoppyPlants, plantTbl = {}, + {model = 'prop_plant_01b', label = 'heroin',langs = ps.lang('heroin.targetPick'), tbl = GlobalState.PoppyPlants, plantTbl = {}, pick = function(loc) - if not ps.progressbar(ps.lang('Heroin.pick'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('heroin.picking'), 4000, 'uncuff') then return end TriggerServerEvent("heroin:pickupCane", loc) return true end, - target = { - icon = "fa-solid fa-seedling", - label = ps.lang('targets.heroin.pick'), - }, allow = Config.Drugs.heroin, }, - {model = 'prop_cactus_03', label = 'Mescaline', langs = ps.lang('targets.mescaline.pick'), tbl = GlobalState.Mescaline, plantTbl = {}, + {model = 'prop_cactus_03', label = 'Mescaline', langs = ps.lang('mesc.targetPick'), tbl = GlobalState.Mescaline, plantTbl = {}, pick = function(loc) - if not ps.progressbar(ps.lang('mescaline.pick'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('mesc.picking'), 4000, 'uncuff') then return end TriggerServerEvent("Mescaline:pickupCane", loc) return true end, - target = { - icon = "fa-solid fa-seedling", - label = ps.lang('targets.mescaline.pick'), - }, allow = Config.Drugs.mescaline, }, - {model = 'prop_weed_01', label = 'weed', langs = ps.lang('targets.weed.pick'), tbl = GlobalState.WeedPlant, plantTbl = {}, + {model = 'prop_weed_01', label = 'weed', langs = ps.lang('weed.targetPick'), tbl = GlobalState.WeedPlant, plantTbl = {}, pick = function(loc) - if not ps.progressbar(ps.lang('Weed.picking'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('weed.picking'), 4000, 'uncuff') then return end TriggerServerEvent("weed:pickupCane", loc) return true end, - target = { - icon = "fa-solid fa-seedling", - label = ps.lang('targets.weed.pick'), - }, allow = Config.Drugs.weed, }, - {model = 'mushroom', label = 'shrooms', langs = ps.lang('targets.shrooms.pick'), tbl = GlobalState.shrooms, plantTbl = {}, + {model = 'mushroom', label = 'shrooms', langs = ps.lang('shrooms.targetPick'), tbl = GlobalState.shrooms, plantTbl = {}, pick = function(loc) - if not ps.progressbar(ps.lang('Shrooms.pick'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('shrooms.picking'), 4000, 'uncuff') then return end TriggerServerEvent("shrooms:pickupCane", loc) return true end, - target = { - icon = "fa-solid fa-hand", - label = ps.lang('targets.shrooms.pick'), - }, allow = Config.Drugs.shrooms, }, } diff --git a/client/shrooms.lua b/client/shrooms.lua index f226b17..e8c0622 100644 --- a/client/shrooms.lua +++ b/client/shrooms.lua @@ -1,6 +1,6 @@ ps.registerCallback("md-drugs:client:shrooms", function() - if not ps.progressbar(ps.lang('Shrooms.eat'), 5000, 'eat') then return end + if not ps.progressbar(ps.lang('shrooms.eat'), 5000, 'eat') then return end CreateThread(function() EcstasyEffect() end) diff --git a/client/weed.lua b/client/weed.lua index 0d82716..c33ef4d 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -4,10 +4,10 @@ for k, v in pairs (locations.WeedDry) do ps.boxTarget('weed_dry'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { { icon = 'fa-solid fa-cannabis', - label = ps.lang('targets.weed.dry'), + label = ps.lang('weed.targetDry'), action = function() if not ps.hasItem('wetcannabis', 1) then - ps.notify(ps.lang('Weed.nodry'), "error") + ps.notify(ps.lang('weed.nodry'), "error") return end if drying then return end @@ -15,12 +15,12 @@ for k, v in pairs (locations.WeedDry) do local weedplant = CreateObject("bkr_prop_weed_drying_01a", loc.x, loc.y+.2, loc.z, true, false) drying = true FreezeEntityPosition(weedplant, true) - ps.notify(ps.lang('Weed.wait'), "success") + ps.notify(ps.lang('weed.wait'), "success") Wait(math.random(1000,5000)) - ps.notify(ps.lang('Weed.take'), "success") + ps.notify(ps.lang('weed.take'), "success") ps.entityTarget(weedplant, { icon = "fa-solid fa-cannabis", - label = ps.lang('targets.weed.dpick'), + label = ps.lang('weed.targetDryed'), action = function() DeleteEntity(weedplant) drying = false @@ -36,7 +36,7 @@ for k, v in pairs (locations.WeedTele) do ps.boxTarget('weed_tele'..k, v.inside, {length = v.l, width = v.w, heading = v.rot}, { { icon = 'fa-solid fa-door-open', - label = ps.lang('targets.weed.telein'), + label = ps.lang('weed.teleportOut'), action = function() SetEntityCoords(PlayerPedId(), v.outside) end @@ -45,7 +45,7 @@ for k, v in pairs (locations.WeedTele) do ps.boxTarget('weed_teleout'..k, v.outside, {length = v.l, width = v.w, heading = v.rot}, { { icon = 'fa-solid fa-door-closed', - label = ps.lang('targets.weed.teleout'), + label = ps.lang('weed.teleportIn'), action = function() SetEntityCoords(PlayerPedId(), v.inside) end @@ -66,13 +66,13 @@ CreateThread(function() end) RegisterNetEvent("md-drugs:client:dodabs", function() - if not ps.progressbar('Doing Dabs', 4000, 'bong2') then AlienEffect() return end + if not ps.progressbar(ps.lang('weed.dabs'), 4000, 'bong2') then AlienEffect() return end AlienEffect() end) local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName) local options = {} - local items = ps.callback('md-drugs:server:GetRecipe', 'weed',tableName) + local items = ps.callback('md-drugs:server:GetWeedRecipe', 'weed', tableName) for k, v in pairs(items) do local label = {} local item = '' @@ -94,11 +94,11 @@ local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tab end RegisterNetEvent('md-drugs:client:makeBluntWrap', function(data) - createBluntOptions('mddrugsbluntwraps', "Dipping Syrup", 'Dipping Syrup To Make ', 'bluntwrap') + createBluntOptions('mddrugsbluntwraps', "Dipping Syrup", ps.lang('weed.bluntWrap'), 'bluntwrap') end) RegisterNetEvent('md-drugs:client:rollBlunt', function(data) - createBluntOptions('mddrugsblunts', "Roll Blunts", 'Rolling A ', 'blunts') + createBluntOptions('mddrugsblunts', "Roll Blunts", ps.lang('weed.blunts'), 'blunts') end) for k, v in pairs (locations.WeedSalesman) do @@ -110,7 +110,7 @@ for k, v in pairs (locations.WeedSalesman) do ps.entityTarget(ped, { { icon = "fa-solid fa-cannabis", - label = ps.lang('targets.weed.salesman'), + label = ps.lang('weed.targetSales'), action = function() local itemList = ps.callback('md-drugs:server:getWeedItems') local options = {} @@ -124,7 +124,7 @@ for k, v in pairs (locations.WeedSalesman) do {type = 'number', title = 'How Many To Buy', min = 1, max = 1000} }) if not input and input[1] then return end - if not ps.progressbar('Buying ' .. ps.getLabel(m), 2000, 'uncuff') then return end + if not ps.progressbar(ps.lang('weed.buying', ps.getLabel(m)), 2000, 'uncuff') then return end TriggerServerEvent('md-drugs:server:buyWeedItem', k, m, input[1]) end } diff --git a/client/wholesale.lua b/client/wholesale.lua index f97d129..c76bb0e 100644 --- a/client/wholesale.lua +++ b/client/wholesale.lua @@ -1,30 +1,49 @@ local miss = false - +local function SetUpPeds() + AddRelationshipGroup('setups') + local ped = GetEntityCoords(PlayerPedId()) + 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] + 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 +end RegisterNetEvent("md-drugs:client:GetLocation", function(drug) if not GetCops(Config.PoliceCount) then return end if miss then - ps.notify(Lang.Wholesale.al, 'error') - else + ps.notify(ps.lang('wholesale.alreadyWholesale'), 'error') + else local loc = drug.location local timer = 0 miss = true SetNewWaypoint(loc.x, loc.y) - lib.requestModel("g_m_y_famdnf_01", Config.RequestModelTime) - local current = "g_m_y_famdnf_01" - local drugdealer = CreatePed(0, current,loc.x,loc.y,loc.z-1, 90.0, false, false) + ps.requestModel("g_m_y_famdnf_01", Config.RequestModelTime) + local drugdealer = CreatePed(0, "g_m_y_famdnf_01",loc.x,loc.y,loc.z-1, 90.0, false, false) FreezeEntityPosition(drugdealer, true) SetEntityInvincible(drugdealer, true) - AddMultiModel(drugdealer, {{ - label = Lang.targets.Wholesale.talk, + ps.entityTarget(drugdealer, {{ + label = ps.lang('wholesale.targetBuyer'), icon = "fas fa-eye", action = function() local luck = math.random(1,100) if luck <= Config.SuccessfulChance then - if not ps.progressbar("Wholesaling Drugs", 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('wholesale.wholesaling'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:SuccessSale", drug) else - ps.progressbar("YOU FUCKED NOW", 4000, 'uncuff') - SetUpPeds() + ps.notify(ps.lang('wholesale.uhoh'), 'error') + SetUpPeds() end Wait(3000) DeleteEntity(drugdealer) @@ -39,7 +58,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 - ps.notify('The Buyer Waited To Long', 'error') + ps.notify(ps.lang('wholesale.tooLong'), 'error') DeleteEntity(drugdealer) end end diff --git a/client/xtc.lua b/client/xtc.lua index 182fd83..e180d82 100644 --- a/client/xtc.lua +++ b/client/xtc.lua @@ -9,19 +9,19 @@ end ps.registerCallback('md-drugs:client:setpress', function(xtcData) if xtcpress then - ps.notify(Lang.xtc.out, 'error') + ps.notify(ps.lang('xtc.alreadyOut'), 'error') return end local coords, head = StartRay2() xtcpress = true - if not ps.progressbar('Setting Press On The Ground', 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('xtc.settingDown'), 4000, 'uncuff') then return end local press = CreateObject("bkr_prop_coke_press_01aa", coords.x, coords.y, coords.z, true, false, false) PlaceObjectOnGroundProperly(press) Freeze(press, true, head) local options = { { icon = "fas fa-eye", - label = ps.lang('targets.xtc.make'), + label = ps.lang('xtc.targetMake'), distance = 2.0, action = function() local options = {} @@ -33,7 +33,7 @@ ps.registerCallback('md-drugs:client:setpress', function(xtcData) description = descript, action = function() if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end - if not ps.progressbar(string.format(ps.lang('xtc.make'), ps.getLabel(k)), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('xtc.making', ps.getLabel(k)), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:makextc", k) end, distance = 2.0 @@ -47,9 +47,9 @@ ps.registerCallback('md-drugs:client:setpress', function(xtcData) }, { icon = "fas fa-eye", - label = ps.lang('targets.xtc.pick'), + label = ps.lang('xtc.targetPickup'), action = function() - if not ps.progressbar(ps.lang('xtc.pickup'), 5000, 'uncuff') then return end + if not ps.progressbar(ps.lang('xtc.picking'), 5000, 'uncuff') then return end DeleteObject(press) xtcpress = false TriggerServerEvent("md-drugs:server:getpressback") @@ -67,11 +67,14 @@ for k, v in pairs(locations.mdp2p) do ps.boxTarget('mdp2p'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { { icon = 'fa-solid fa-flask', - label = ps.lang('targets.xtc.mdp2p'), + label = ps.lang('xtc.targetStealMDP2P'), action = function() if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end - if not ps.progressbar(ps.lang('xtc.mdp2p'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('xtc.stealingMDP2P'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stealmdp2p", k) + end, + canInteract = function() + return handleGang(v.gang) end } }) @@ -80,11 +83,14 @@ for k, v in pairs(locations.isosafrole) do ps.boxTarget('isosafrole'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { { icon = 'fa-solid fa-flask', - label = ps.lang('targets.xtc.isosafrole'), + label = ps.lang('xtc.targetStealIsosafrole'), action = function() if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end - if not ps.progressbar(ps.lang('xtc.isosafrole'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('xtc.stealingIsosafrole'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stealisosafrole", k) + end, + canInteract = function() + return handleGang(v.gang) end } }) @@ -94,11 +100,14 @@ for k, v in pairs(locations.rawxtcloc) do ps.boxTarget('xtc'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { { icon = 'fa-solid fa-flask', - label = ps.lang('targets.xtc.raw'), + label = ps.lang('xtc.targetRaw'), action = function() if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end - if not ps.progressbar(ps.lang('xtc.raw'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('xtc.makingRaw'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:makingrawxtc", k) + end, + canInteract = function() + return handleGang(v.gang) end } }) @@ -111,7 +120,7 @@ for k, v in pairs(locations.xtcpress) do ps.entityTarget(ped, { { icon = 'fa-solid fa-flask', - label = ps.lang('targets.xtc.press'), + label = ps.lang('xtc.getPress'), action = function() local options = {} local recipeList = ps.callback('md-drugs:server:getpressrecipes') @@ -120,14 +129,13 @@ for k, v in pairs(locations.xtcpress) do options[#options + 1] = { icon = ps.getImage(m), title = ps.getLabel(m), - description = ps.lang('xtc.press.buysingle', d.cash), + description = ps.lang('xtc.buySingle', d.cash), action = function() if not ps.progressbar(ps.lang('xtc.buyp'), 4000, 'uncuff') then return end TriggerServerEvent('md-drugs:server:buypress', m) end, } else - ps.debug(d.take) local descript = getRecipeList(d.take) options[#options + 1] = { icon = ps.getImage(m), @@ -142,7 +150,8 @@ for k, v in pairs(locations.xtcpress) do end end ps.menu('XTC Presses', 'XTC Presses', options) - end + end, + canInteract = function() return handleGang(v.gang) end } }) end @@ -151,7 +160,7 @@ for k, v in pairs (locations.stamp) do ps.boxTarget('xtc'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { { icon = 'fa-solid fa-flask', - label = ps.lang('targets.xtc.' .. k), + label = ps.lang('xtc.targetStamp'), action = function() local item = { {item = 'white_xtc', label = ps.getLabel('white_xtc'), color = 'white'}, @@ -167,14 +176,15 @@ for k, v in pairs (locations.stamp) do description = ps.lang('xtc.stamp_desc', d.color), action = function() if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end - if not ps.progressbar(string.format(ps.lang('xtc.stamp'), d.label), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('xtc.stamping'), d.label, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stamp", k, d.color) end, distance = 2.0 } end ps.menu('Stamp Pills', 'Stamp Pills', options) - end + end, + canInteract = function() return handleGang(v.gang) end } }) end diff --git a/clientRun.lua b/clientRun.lua index 5e816ee..31c4e46 100644 --- a/clientRun.lua +++ b/clientRun.lua @@ -16,7 +16,7 @@ function loadFile(filePath) ps.error("Error executing Lua chunk from '" .. filePath .. "': " .. tostring(execErr)) return false end - ps.success("Successfully loaded module '" .. filePath .. "' from resource '" .. resourceName .. "'.") + return true end diff --git a/fxmanifest.lua b/fxmanifest.lua index 8c85ffe..b169a11 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -13,8 +13,6 @@ client_scripts { server_scripts { 'server/functions.lua', - 'server/locations.lua', - 'server/recipes.lua', 'server/plantSpawns.lua', 'serverRun.lua', '@oxmysql/lib/MySQL.lua', @@ -22,7 +20,6 @@ server_scripts { shared_scripts { 'shared/**.lua', - '@ox_lib/init.lua', } lua54 'yes' diff --git a/locales/en.lua b/locales/en.lua index febdf07..1bce1ed 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,298 +1,247 @@ Lang = {} -Lang.targets = { - coke = { - pick = 'Pick Cocaine', - cut = 'Cut Cocaine', - bag = 'Bag Cocaine', - enter = 'Enter Building', - exit = 'Exit Building', - chop = 'Chop Coca Leaves', - - }, - CornerSell = { - sell = 'Sell %s Of %s For $%s', - deny = 'Deny Price' - }, - crack = { - cook = 'Cook Crack', - bag = 'Bag Crack' - }, - Delivery = { - Deliver = 'Deliver For %s', - open = 'Open %s Shop', - hand = 'Hand Over' - }, - heroin = { - pick = 'Pick Poppies', - up = 'Pick Up Table', - dry = 'Dry Poppies', - cut = 'Cut Heroin', - cook = 'Cook Heroin', - kit = 'Buy Heroin Lab Kit', - clean = 'Clean Table', - fill = 'Fill Syringe', - vial = 'Make Vial', - }, - lean = { - git = 'Get Task', - st = 'Steal From Car' - }, - lsd = { - buy = 'Buy LSD Lab Kit', - heat = 'Heat Liquid', - refine = 'Refine Quality', - paper = 'Make Tab Paper', - back = 'Pick Up Lab Kit', - dab = 'Dab LSD on sheets', - clean = 'Clean Table', - lys = 'Steal Lysergic Acid', - die = 'Steal Diethylamide', - buyt = 'Buy Tabs', - }, - mescaline = { - pick = 'Pick Cactus', - dry = 'Dry Out Cactus', - }, - meth = { - bag = 'Bag Up Meth', - enter = 'Enter Buidling', - exit = 'Exit Building', - cook = 'Cook Meth', - tray = 'Grab Tray', - box = 'Box Up Meth', - adjust = 'Adjust Temperature', - eph = 'Steal Ephedrine', - ace = 'Steal Acetone', - mission = 'Get Mission', - stealfromcar = 'Steal From Car', - }, - oxy = { - pack = 'Get Oxy Package', - talk = 'Talk To Buyer', - pay = 'Pay For Truck', - }, - pha = { - fill = 'Fill Prescription', - }, - shrooms = { - pick = 'Pick Shrooms', - }, - travel = { - travel = 'Open Travelling Merchant', - }, - xtc = { - iso = 'Steal Isosafrole', - mdp = 'Steal MDP2P', - raw = 'Make Raw XTC', - press = 'Buy XTC Press', - stamp = 'Stamp Pills', - make = 'Make XTC', - pick = 'Pick Up Press', - }, - weed = { - pick = 'Pick Weed', - dry = 'Dry Weed', - dpick = 'Pick Dried Weed', - butt = 'Open Edible Menu', - oil = 'Make Oil' - }, - Wholesale = { - talk = 'Talk To Buyer' - }, - +Lang.Catches = { + notIn = 'You Are Not In The Correct Location', + needItems = 'You Do Not Have The Required Items', + notEnoughMoney = 'Youre To Broke', + buySuccess = 'You Bought %s %s For $%s', + itemMissings = 'You Need \n', + itemNeeded = 'You Need %s', + cooldown = 'Slow Down Speed Racer', + invalidItem = 'This Item Is Not Sold Here', } -Lang.Coke = { - -- client side progressbars - picking = "Picking Leaves", - makepow = 'Chopping Leaves Into A Powder', - cutting = 'Cutting Coke With Baking Soda', - bagging = "Bilbo Baggins This Bitch", - -- end progressbars - cut = "You Cut Some Coke", - nocutcoke = "You Cant Cut Coke With No Coke Idiot", - bagcoke = "You Bagged Up Coke", - nobagcoke = "You Cant Bag Up Coke Without Coke Idiot", -} -Lang.Crack = { - --client side - cookcrack = "Cooking Some Crack", - bagcrack = 'Bilbo Baggin This Bitch', - -- server - makecrack = 'Nice Crack', - nocoke = 'You Cant Make This Without Coke' +Lang.coke = { + targetPick = 'Pick Coca Leaf', + picking = 'Picking Coca Leaf', + targetMakePow = 'Make Cocaine Powder', + noleaf = 'You Need A Coke Leaf', + makePow = 'Chopping Leaves into Powder', + targetCutCoke = 'Cut Cocaine', + targetBagCoke = 'Bag Cocaine', + teleIn = 'Enter the Lab', + teleOut = 'Exit the Lab', + needBakingSoda = 'You Need Baking Soda For This', } + Lang.Cornerselling = { - -- client side notifys - inveh = 'STRANGER DANGER, I WONT GET IN THE CAR WITH YOU', - toofar = "To Far From Your Corner Homie", - selling = 'Selling %s For $%s', - deny = "Fuck That Offer", - start = "Get That Paper", - stop = "Lazy Ass Cant Even Sell Drugs", - nodrugs = "What You Gonna sell? Air?", - notcops = "Not Enough Cops", - no = 'You Cant Sell Drugs Here!', - -- end client side notifys - -- progressbars - sell = "Selling Drugs", -} -Lang.Delivery = { - -- client side - emailn = 'Not A Drug Dealer', - emailsub = 'Hurry Up And Get The Package To The Buyer', - emailcon = 'I Swear To God If It Doesnt Get There I Will Tell Your Mom You Said Fuck Just Bring %s Of %s', - search = "Searching For A Delivery ...", - none = "Nothing Close By", - busy = "You Havent Even Finished The One I Told You Too", - found = "Marked On Your Map", - already = "Already Deliverying", - checkrep = "Current Dealer Rep: ", - -- progressbars - pack = 'Handing Off Package', - -- end client side + inVeh = 'Stranger Danger!', + selling = 'Selling %s for $%s', + deny = 'Fuck That Offer', + wait = 'Waiting For Customer', + nodrugs = 'You Do Not Have Any Drugs To Sell', + searching = 'Searching For Nearby Customers', + targetTakeBack = 'Take Back Drugs', + targetSell = 'Sell %s Of %s For $%s', + targetDeny = 'Deny Offer', + stopped = 'Your Lazy Ass Cant Even Sell Drugs!', + start = 'Go Make Your Mom Proud', + gotRobbed = 'You Got Robbed Nerd!', + gotBack = 'You Got Your Stuff Back!', + notEnough = 'You Dont Have Enough Of This Item', + comDes = 'Sell Things On The Corner' } -Lang.Heroin = { - --client - pick = " Picking Poppies Up", - tableout = 'You Already Have A Table Out', - dryout = "Drying Out Poppies", - cutting = "Cutting Heroin With Baking Soda", - secret = "SHHHHHHHHH", - table = "Placing Table Down", - success = "Heated Heroin Properly", - clean = 'Cleaning Heroin Table', - needles = 'Filling Syringe', - pickup = 'Picking Up The Heroin Table', - -- - cutheroin = 'You Made Some Cut Heroin', - noheroin = "How Can You Cut Heroin Without Heroin Idiot", - vial = 'You Made A Vial Of Heroin', - novial = "How Can You Make Heroin Vials Without Heroin Idiot", - fail = 'You Over Heated Them Idiot', - fill = 'Filled The Syringe', - nofill = 'How Are You Going To Fill Needles Of Heroin Without Heroin', - haskit = 'You Already Have A Heroin Lab Kit' +Lang.crack = { + targetMake = 'Cook Some Crack', + cook = 'Cooking Crack', + targetBag = 'Bag Crack', + bag = 'Bagging Crack', } -Lang.Lean = { - marked = ' Car Has Been Marked On Your Map', - lean = 'You Got Purple Lean', - dextro = ' You Got Red Dextro', - act = 'You Already Have A Lean Task', + +Lang.Deliveries = { + targetGetDel = 'Get Delivery Mission', + targetOpenShop = 'Open Dealer Shop', + shopHeader = 'Dealer Shop', + targetHandOff = 'Hand Off Delivery', + delivering = 'Handing The Package To Drug Dealer', + alreadyDelivering = 'You Are Already Delivering A Package', + slowAf = 'You Took To Long!', + newDealerHelp = { + help = 'Place A Dealer', + name = 'Dealer Name', + timeMin = 'Minimum Time', + timeMax = 'Maximum Time' + }, + DealerExists = 'Dealer Already Exists', + deleteDealer = { + help = 'Delete A Dealer', + name = 'Dealer Name', + }, + deleteDealerSuccess = 'Deleted Dealer', + deleteDealerFail = 'Failed To Delete Dealer', +} + +Lang.heroin = { + targetPick = 'Pick Heroin', + picking = 'Picking Heroin', + targetCook = 'Cook Heroin', + pbCook = 'Cooking Up Heroin', + targetPickup = 'Pick Up Lab', + pbPickup = 'Picking Up Lab', + targetClean = 'Clean Lab', + pbClean = 'Cleaning Lab', + targetDry = 'Dry Out Plant', + pbDry = 'Drying Out Plant', + targetCutHeroin = 'Cut Heroin', + pbCutHeroin = 'Cutting Heroin', + targetBuyKit = 'Buy Heroin Lab Kit', + pbBuyKit = 'Buying Heroin Lab Kit', + tableout = 'You Already Have A Table Out', + placing = 'Placing Down Table', + targetFill = 'Fill Syringe', + pbFill = 'Filling Syringe', + hasKitAlready = 'You Already Have A Heroin Lab Kit', + notEnoughMoney = 'You Need $%s In Cash For This', + placedKit = 'You Placed Down Your Heroin Lab Kit', + failed = 'You Failed To Make Heroin And Lost Your Ingredients', +} + +Lang.lean = { + stealFromTruck = 'Steal From Truck', + startMission = 'Start Lean Mission', + notOnRun = 'You Are Not On A Lean Run' } Lang.lsd = { - steallys = 'Stealing Lysergic Acid', - stealdie = 'Stealing Lysergic Acid', + targetHeat = 'Heating LSD', + heating = 'Heating Up LSD', + targetRefine = 'Refine The Acid', + refining = 'Refining The Acid', + targetDipping = 'Dip Tabs', + dipping = 'Dipping Tabs', + targetPickup = 'Pick Up Lab Kit', + packup = 'Packing Up Lab Kit', + targetClean = 'Clean Lab Kit', + needCleaning = 'You Need A Cleaning Kit To Clean The Lab', + cleaning = 'Cleaning Lab Kit', + targetLys = 'Steal Lysergic Acid', + stealLys = 'Stealing Lysergic Acid', + targetDie = 'Steal Diethylamide', + stealDie = 'Stealing Diethylamide', + targetBuyTab = 'Buy Tab Paper', + targetBuyKit = 'Buy LSD Lab Kit', + alreadyOwn = 'You Already Own This Item', + buyingKit = 'Buying LSD Lab Kit', tableout = 'You Already Have A Table Out', - tablepack = 'Packing Table Up', - heat = 'Heating Up Liquids', - clean = 'Cleaning The Table', - refine = 'Refining The Quality', - dip = 'Dipping LSD On The Paper', - buypaper = 'Buying Tab Paper', - buykit = 'Buying Lab Kit', - place = 'Placing Table Down', - hav = 'You Already Have A Table', - -- server - lys = 'You Got Lysergic Acid', - die = 'You Got Diethylamide', - cleaned = 'You Cleaned It Perfectly', - madelsd = 'You Made LSD!', - failed = 'You Over Heated Them Idiot', - refined = 'You Refined Them!', - broke = 'Your Broke Ass Cant Afford these!', - novial = 'No LSD Vials Idiot', + placing = 'Placing Lab Kit Down!', + failed = 'You Suck At Making Drugs', } -Lang.mescaline = { - pick = "Picking Cactus", - dry = 'Drying Out Cactus', - nocactus = 'No Cactus Bulbs', - eat = 'eating mescaline' + +Lang.mesc = { + targetPick = 'Pick Cactus', + picking = 'Picking Cactus', + targetDry = 'Dry Cactus', + dry = 'Drying Cactus', } Lang.meth = { - inside = 'Stuff Inside Already', - increaseheat = 'Increasing Heat', - mission = 'Car Has Been Marked On Your Map', - ace = 'You Got Some Acetone', - eph = 'You Got Some Ephedrine', - mix = 'Adding Things To The Mix', - nobag = 'No Bags', - act = 'You Already Have A Meth Task', + alreadyChasing = 'You Already Are Chasing A Truck', + targetStealFromCar = 'Steal From Meth Car', + targetHeist = 'Start Meth Mission', + started = 'You Already Have Meth Cooking', + increaseHeat = 'You Increased The Heat', + targetBag = 'Bag Meth', + targetCook = 'Cook Meth', + targetGrabTray = 'Grab Meth Tray', + targetHeat = 'Adjust The Dials', + targetSmash = 'Smash The Tray', + targetStealEPH = 'Steal Ephedrine', + stealingEPH = 'Stealing Ephedrine', + targetStealACE = 'Steal Acetone', + stealingACE = 'Stealing Acetone', + notOnRun = 'You Are Not On A Meth Run', + onCooldown = 'You Are On A Cooldown' } Lang.oxy = { - truck = 'Your Truck Is Here', - cantcarry = 'You Aint That Strong, You Can Only Carry One', - hand = 'Handing Over oxy', - empty = 'You Cant Be Empty Handed Idiot', - broke = 'Your Broke Ass Cant Afford This', - hot = 'Car Is Hot Dump It Now', - next = 'Get To the Next Location' + ditchCar = 'The Van Is Hot, Leave It Somewhere', + targetHandoff = 'Hand Off The Package', + handingoff = 'Handing Off The Package', + emptyHands = 'You Are Not Carrying Anything', + targetPay = 'Rent Oxy Van', + keys = 'The Keys Are In The Van', + targetGetPackage = 'Grab Package', + alreadyCarrying = 'You Are Already Carrying A Package', + paid = 'You Paid $%s To Rent The Van', + notOn = 'You Are Not On A Route', } -Lang.Pharma = { - notems = 'You Are Not A Medical Person', +Lang.pharma = { + input = { + header = 'Who To Give A Prescription To?', + title1 = 'Player Name', + title2 = 'Prescription', + }, write = 'Writing Prescription', - fill = 'Filling Prescription', - open = 'Opening Bottle', - pills = 'You Got Some Pills!', - no = 'You Dont Have A Prescription' + opening = 'Opening Prescription Bottle', + targetFill = 'Fill Prescription', + fill = 'Getting Prescription Filled', + canceled = 'You Canceled The Prescription', + unbottle = 'You Opened The Bottle', } -Lang.Shrooms = { - pick = 'Picking Shrooms', +Lang.shrooms = { + targetPick = 'Pick Shrooms', + picking = 'Picking Shrooms', eat = 'Eating Shrooms', - trip = 'Have A Good Trip!' + cancel = 'Decided To Not Do Shrooms', + took = 'You Took Some Shrooms!' } -Lang.Weed = { - pick = 'Harvesting Weed', - busy = 'Already Drying One Out', - canna = 'Making Canna-butter', - brown = 'Making Special Brownies', - cook = 'Making Special Cookies', - Choc = 'Making Special Chocolate', - muff = 'Making Special Muffin', - stovehot = 'Stove Is Too Hot Wait 30 Seconds To Cool Down', - shat = 'Making Shatter', - roll = 'Rolling Blunts', - wait = 'Wait A Little Bit For To Drive', - take = 'Taking Down The Weed', - -- - nodry = 'You Need Wet Cannabis To Dry', - noweed = 'Cant Roll A Blunt With Air', - noshat = 'You Need Shatter To Do A Dab', - notorch = 'You Need A butane Torch' +Lang.weed = { + targetPick = 'Pick Weed', + picking = 'Picking Weed', + targetDry = 'Dry Weed', + noDry = 'You Need Wet Weed For This', + wait = 'Waiting For Weed To Dry...', + take = 'Ready To Take Weed', + targetDryed = 'Pickup Weed', + teleportIn = 'Enter The Grow House', + teleportOut = 'Leave The Grow House', + dabs = 'Doing Some Dabs', + bluntWrap = 'Dipping Syrup To Make %s', + rollBlunt = 'Rolling A %s', + targetSales = 'Buy From Dealer', + buying = 'Buying %s From Dealer', + itemDoesntExist = 'This Item Does Not Exist Here', + needItem = 'You Need A %s For This', + crackBlunt = 'Cracking Open A Blunt' +} + +Lang.wholesale = { + alreadyWholesale = 'Already Wholesaling', + targetBuyer = 'Talk To The Buyer', + wholesaling = 'Wholesaling Drugs', + uhoh = 'The Buyer Is Getting Sketchy', + tooLong = 'The Buyer Waited Too Long', + notEnoughCops = 'Not Enough Cops On Duty' } Lang.xtc = { - out = 'You Have A Press Out Already', - pressing = 'Pressing Pills', - raw = 'Making Raw XTC', - mdp2p = 'Stealing MDP2P', - iso = 'Stealing Isosafrole', - fail = 'Dude Its A Circle Not Rocket Science', - pickup = 'Picking Up The Press', - stamp = 'Stamping %s Pills', - buyp = "Buying Press", - -- - cash = 'I need 20k In Cash', - press = { - title = {single = 'Single Press', dual = 'Dual Press', triple = 'Triple Press', quad = 'Quad Press'}, - des = {single ='Buy a single press for 20k', dual = '20 of each unstamped single stack pill and your single press ', - triple = '50 of each unstamped dual stack pill and your dual press ', quad = '150 of each unstamped Triple stack pill and your triple press' - } - } + alreadyOut = 'You Have A Press Out Already', + settingDown = 'Setting Down The Press', + noPressOut = 'You Do Not Have A Press Out', + targetMake = 'Press Pills', + making = 'Pressing A %s', + targetPickup = 'Pick Up Press', + picking = 'Picking Up Press', + targetStealMDP2P = 'Steal MDP2P', + stealingMDP2P = 'Stealing MDP2P', + fail = 'Damn Dude You Suck', + targetStealIsosafrole = 'Steal Isosafrole', + stealingIsosafrole = 'Stealing Isosafrole', + targetRaw = 'Make Raw XTC', + makingRaw = 'Making Raw XTC', + getPress = 'Get Press', + buySingle = 'Buy Single Press For $%s', + buyp = 'Buying Press', + targetStamp = 'Stamp XTC', + stamp_desc = 'Stamp %s Pills', + stamping = 'Stamping %s Pills', + noPills = 'You Dont Have Any Unstamped Pills' } -Lang.Wholesale = { - al = 'You Already Have A Delivery To Make', - na = 'No One Answered, Try Again Later', -} return Lang \ No newline at end of file diff --git a/server/TravellingMerchant.lua b/server/TravellingMerchant.lua new file mode 100644 index 0000000..e9a1d80 --- /dev/null +++ b/server/TravellingMerchant.lua @@ -0,0 +1,64 @@ + +local Target = { + Travellingmerchant = { + vector4(-119.66, -977.43, 304.25, 88.21), + vector4(-1522.93, 1476.01, 111.45, 41.25), + vector4(-3278.98, 973.38, 5.35, 101.53), + }, +} + +local loc = Target.Travellingmerchant[math.random(1, #Target.Travellingmerchant)] + + + +local stores = { + travel = { + tab_paper = 50, + bakingsoda = 25, + isosafrole = 25, + mdp2p = 25, + lysergic_acid = 25, + diethylamide = 25, + lockpick = 2, + emptyvial = 2, + needle = 2, + cokeburner = 25, + crackburner = 2, + lsdburner = 2, + heroinburner = 2, + mdlean = 50, + weedgrinder = 25, + mdbutter = 25, + flour = 25, + chocolate = 25, + butane = 25, + butanetorch = 2, + dabrig = 2, + mdwoods = 2, + leancup = 25, + xtcburner = 25, + }, +} + +ps.registerCallback('md-drugs:server:GetMerchant', function(source) + return loc, stores.travel +end) + + + +RegisterServerEvent("md-drugs:server:purchaseGoods", function(item) + local src = source + if not ps.checkDistance(src, loc, 10) then + ps.notify(src, ps.lang('Catches.notIn'), "error") + return + end + if not stores.travel[item] then + ps.notify(src, ps.lang('Catches.invalidItem'), "error") + return + end + if ps.removeMoney(src, 'cash', stores.travel[item]) then + ps.addItem(src, item, 1) + else + ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") + end +end) diff --git a/server/cocaine.lua b/server/cocaine.lua index 80e2737..f1d5e93 100644 --- a/server/cocaine.lua +++ b/server/cocaine.lua @@ -42,7 +42,7 @@ end) RegisterServerEvent('md-drugs:server:makepowder', function(num) local src = source if not ps.checkDistance(src, cocaineLocations.MakePowder[num].loc, 3.5) then - ps.notify(src, 'You are not in the correct location', 'error') + ps.notify(src, ps.lang('Catches.notIn'), 'error') return end local tier = 'tier1' @@ -55,7 +55,7 @@ RegisterServerEvent('md-drugs:server:makepowder', function(num) end end if not ps.craftItem(src, cocaineRecipes['cocaine']['cokepowder'][tier]) then - ps.notify(src, 'You do not have the required items', 'error') + verifyHas(src, cocaineRecipes['cocaine']['cokepowder'][tier].take) return end end) @@ -64,7 +64,7 @@ RegisterServerEvent('md-drugs:server:cutcokeone', function(num) local src = source local tier = 'tier1' if not ps.checkDistance(src, cocaineLocations.CuttingCoke[num].loc, 2.5) then - ps.notify(src, 'You are not in the correct location', 'error') + ps.notify(src, ps.lang('Catches.notIn'), 'error') return end if Config.TierSystem then @@ -81,7 +81,7 @@ RegisterServerEvent('md-drugs:server:cutcokeone', function(num) end end if not ps.craftItem(src, cocaineRecipes['cocaine']['cutcoke'][tier]) then - ps.notify(src, 'You do not have the required items', 'error') + verifyHas(src, cocaineRecipes['cocaine']['cutcoke'][tier].take) return end end) @@ -90,7 +90,7 @@ RegisterServerEvent('md-drugs:server:bagcoke', function(num) local src = source local tier = 'tier1' if not ps.checkDistance(src, cocaineLocations.BaggingCoke[num].loc, 2.5) then - ps.notify(src, 'You are not in the correct location', 'error') + ps.notify(src, ps.lang('Catches.notIn'), 'error') return end if Config.TierSystem then @@ -106,13 +106,13 @@ RegisterServerEvent('md-drugs:server:bagcoke', function(num) end end if not ps.craftItem(src, cocaineRecipes['cocaine']['bagcoke'][tier]) then - ps.notify(src, 'You do not have the required items', 'error') + verifyHas(src, cocaineRecipes['cocaine']['bagcoke'][tier].take) return end AddRep(src, 'coke') else if not ps.craftItem(src, cocaineRecipes['cocaine']['bagcoke'][tier]) then - ps.notify(src, 'You do not have the required items', 'error') + verifyHas(src, cocaineRecipes['cocaine']['bagcoke'][tier].take) return end end @@ -122,7 +122,7 @@ local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3} for k, v in pairs (cokecut) do ps.createUseable(k, function(source, item) local src = source - if not ps.hasItem(src, 'bakingsoda') then ps.notify(src, 'You Need Baking Soda For this', 'error') return end + if not ps.hasItem(src, 'bakingsoda') then ps.notify(src, ps.lang('coke.needBakingSoda'), 'error') return end if ps.hasItem(src,item.name) then local check = ps.callback('md-drugs:client:uncuff', src, 'Cutting It Further') if not check then return end diff --git a/server/consumables.lua b/server/consumables.lua index 5436544..e18b0c0 100644 --- a/server/consumables.lua +++ b/server/consumables.lua @@ -21,8 +21,8 @@ strength = number -- how long you are strong boi ]] local Consume = { -- meth -methbags = { time = 4000, effect = 'meth', anim = "smoke", ps.progressbartext = "Injesting", - add = {health = -20, stress = -10, speed = 40, strength = 10, thirst = -30}}, +methbags = { time = 4000, effect = 'meth', anim = "smoke", 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 }}, cokebaggystagethree = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, @@ -143,22 +143,22 @@ xanax = { anim = 'pill', effect = 'none', add = { stress = -40 } for k, v in pairs(Consume) do - CUI(k, function(source, item) - if not Itemcheck(source, k, 1) then return end + ps.createUseable(k, function(source, item) + if not ps.hasItem(source, k, 1) then return end local time = v.time or Consumables.defaulttime local effect = v.effect or 0 local anim = v.anim or Consumables.defaultanim - local ps.progressbartext = v.ps.progressbartext or Consumables.defaultprogresstext + local progressbartext = v.progressbartext or Consumables.defaultprogresstext local add = v.add or {hunger = 0} - local done = ps.callback('md-drugs:client:consumedrugs', source, time, effect, anim, ps.progressbartext, add, k) + local done = ps.callback('md-drugs:client:consumedrugs', source, time, effect, anim, progressbartext, add, k) if done then - RemoveItem(source, k, 1) + ps.removeItem(source, k, 1) end end) end RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval) - local Player = getPlayer(source) + local Player = ps.getPlayer(source) local hunger, thirst = Player.PlayerData.metadata.hunger, Player.PlayerData.metadata.thirst if stat == "thirst" then local value = thirst + statval @@ -176,6 +176,5 @@ RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval) local value = Player.PlayerData.metadata.armor + statval TriggerEvent('hospital:server:SetArmor', value) TriggerClientEvent('hud:client:UpdateStress', source, Player.PlayerData.metadata.armor, value) - else end end) diff --git a/server/cornerselling.lua b/server/cornerselling.lua index f5beb47..751ebaf 100644 --- a/server/cornerselling.lua +++ b/server/cornerselling.lua @@ -135,7 +135,7 @@ local function beingRobbed(source, item, amount, ped) local math = math.random(1,100) if math <= robChance then ps.removeItem(src, item, amount) - ps.notify(src, 'You Got Robbed Nerd', 'error') + ps.notify(src, ps.lang('Cornerselling.gotRobbed'), 'error') RobbedDrugs[ps.getIdentifier(source)] = {item = item, amount = amount, ped = ped} return true else @@ -148,7 +148,7 @@ local function getDrugBack(source, item, amount) if RobbedDrugs[ps.getIdentifier(source)] then if RobbedDrugs[ps.getIdentifier(source)].item == item and RobbedDrugs[ps.getIdentifier(source)].amount == amount then ps.addItem(src, item, amount) - ps.notify(src, 'You Got Your Drugs Back', 'success') + ps.notify(src, ps.lang('Cornerselling.gotBack'), 'success') RobbedDrugs[ps.getIdentifier(source)] = nil return true end @@ -170,7 +170,7 @@ ps.registerCallback('md-drugs:server:cornerselling:getAvailableDrugs', function( if item > 15 then item = 15 end local amount = math.random(1, item) local price = (math.random(Drugs[k]['min'], Drugs[k]['max']) * amount) * rep.price - DrugDeals[ps.getIdentifier(source)] = {item = k, amount = amount, price = math.floor(price), ped = ped} + DrugDeals[ps.getIdentifier(source)] = {item = k, amount = amount, price = math.floor(price), ped = ped} return DrugDeals[ps.getIdentifier(source)] end end @@ -180,7 +180,7 @@ end) ps.registerCallback('md-drugs:server:hasDrugs', function(source) for k, v in pairs(Drugs) do - if hasItem(source, k, 1) then + if ps.hasItem(source, k, 1) then return true end end @@ -204,16 +204,15 @@ local function csCheck(src, item, amount, price) return false end -RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price) +RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price) local src = source if not csCheck(src, item, amount, price) then return end if not ps.removeItem(src, item, amount) then - ps.notify(src, 'You Do Not Have Enough Of This Item', 'error') + ps.notify(src, ps.lang('Cornerselling.notEnough'), 'error') DrugDeals[ps.getIdentifier(src)] = nil 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') DrugDeals[ps.getIdentifier(src)] = nil ps.addMoney(src, 'cash', price) end) @@ -225,8 +224,8 @@ RegisterNetEvent('md-drugs:server:getBackRobbed', function() RobbedDrugs[ps.getIdentifier(source)] = nil end) -lib.addCommand('cornersell', { - help = 'Sell Things On The Corner', +ps.registerCommand('cornersell', { + help = ps.lang('Cornerselling.comDes'), params = { }, }, function(source, args, raw) diff --git a/server/crack.lua b/server/crack.lua index 3cda068..800676d 100644 --- a/server/crack.lua +++ b/server/crack.lua @@ -27,7 +27,7 @@ RegisterServerEvent('md-drugs:server:makecrackone', function(num) local src = source local tier = 'tier1' if not ps.checkDistance(src, CrackLocations.makecrack[num].loc, 2.0) then - ps.notify(src, 'You are not in the correct location', 'error') + ps.notify(src, ps.lang('Catches.notIn'), 'error') return end if Config.TierSystem then @@ -44,7 +44,7 @@ RegisterServerEvent('md-drugs:server:makecrackone', function(num) end end if not ps.craftItem(src, crackRecipe['crack']['cookcrack'][tier]) then - ps.notify(src, 'You do not have the required items', 'error') + verifyHas(src, crackRecipe['crack']['cookcrack'][tier].take) return end end) @@ -54,7 +54,7 @@ RegisterServerEvent('md-drugs:server:bagcrack', function(num) local src = source local tier = 'tier1' if not ps.checkDistance(src, CrackLocations.bagcrack[num].loc, 2.0) then - ps.notify(src, 'You are not in the correct location', 'error') + ps.notify(src, ps.lang('Catches.notIn'), 'error') return end if Config.TierSystem then @@ -71,7 +71,7 @@ RegisterServerEvent('md-drugs:server:bagcrack', function(num) end end if not ps.craftItem(src, crackRecipe['crack']['bagcrack'][tier]) then - ps.notify(src, 'You do not have the required items', 'error') + verifyHas(src, crackRecipe['crack']['bagcrack'][tier].take) return end end) @@ -93,8 +93,8 @@ end RegisterNetEvent("md-drugs:server:failcrackone", function(num) local src = source - if not ps.checkDistance(src, GlobalState.MDDrugsLocs.makecrack[num].loc, 2.0) then - ps.notify(src, 'You are not in the correct location', 'error') + if not ps.checkDistance(src, CrackLocations.makecrack[num].loc, 2.0) then + ps.notify(src, ps.lang('Catches.notIn'), 'error') return end local items = { diff --git a/server/deliveries.lua b/server/deliveries.lua index 82b52af..e8edeeb 100644 --- a/server/deliveries.lua +++ b/server/deliveries.lua @@ -80,13 +80,25 @@ local dloc = { {coords = vector4(223.98, 121.53, 102.76, 259.68)}, {coords = vector4(102.19, -255.02, 50.05, 83.59)}, } -ps.registerCallback('md-drugs:server:getDealers', function(data) +local Products = { + {name = "weed_whitewidow_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_purplehaze_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_ogkush_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0}, +} + +ps.registerCallback('md-drugs:server:dealerList', function() + return Products +end) + +ps.registerCallback('md-drugs:server:getDealers', function(source) 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 + if not check[1] then MySQL.insert('INSERT INTO dealers SET name = ?, coords = ?, time = ?, createdby = ?', {'MD', loc, 'any', 'code Newb'}) - Wait(2000) - local check2 = MySQL.query.await('SELECT * FROM dealers', {}) + Wait(2000) + local check2 = MySQL.query.await('SELECT * FROM dealers', {}) return check2 else return check @@ -99,9 +111,9 @@ local DeliveryItems = { { item = "coke_brick", minrep = 0, payout = {min = 10, max = 50}}, } -ps.registerCallback('md-drugs:server:GetDeliveryItem', function(data) +ps.registerCallback('md-drugs:server:GetDeliveryItem', function(source, data) local src = source - local Player = getPlayer(src) + local Player = ps.getPlayer(src) local itemnum = math.random(1, #DeliveryItems) local item = DeliveryItems[itemnum].item local amount = math.random(1,4) @@ -115,61 +127,70 @@ ps.registerCallback('md-drugs:server:GetDeliveryItem', function(data) }) if not check[1] then MySQL.insert('INSERT INTO deliveriesdealer SET cid = ?, itemdata = ?, timestart = ?, maxtime = ?, location = ?', - {Player.PlayerData.citizenid, json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord }) - AddItem(Player.PlayerData.source, item, amount) + {ps.getIdentifier(src), json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord }) + ps.addItem(src, item, amount) return true, 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}) 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 + + if timeout > 15 then + MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)}) + ps.notify(src, ps.lang('Deliveries.slowAf'), 'error' ) + return false + end + ps.notify(src,ps.lang('Deliveries.alreadyDelivering'), 'error' ) + return false, item, amount, coord end end) RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount) local src = source - local Player = getPlayer(src) - local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) + local Player = ps.getPlayer(src) + local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)}) 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}) ps.notify(source, 'You Failed To Make It In Time!', 'error' ) return end + if timeout >= 15 then + MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)}) + ps.notify(src, ps.lang('Deliveries.slowAf'), 'error' ) + return + end if item ~= itemData.item then return end if amount ~= itemData.amount then return end - if RemoveItem(src, item, amount) then + if ps.removeItem(src, item, amount) then for k, v in pairs (DeliveryItems) do if v.item == item then local income = math.random(v.payout.min, v.payout.max) - Player.Functions.AddMoney('cash', income) + ps.addMoney(src, 'cash', income) AddRep(src, 'dealerrep') end end - MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) + MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)}) end end) -lib.addCommand("newdealer", { - help = "Place a dealer (Admin Only)", - params = { - { name = "name", help = "Dealer Name", type = "string" }, - { name = "min", help = "Minimum Time", type = "number" }, - { name = "max", help = "Maximum Time", type = "number" } +ps.registerCommand("newdealer", { + help = ps.lang('Deliveries.newDealerHelp.help'), + description = { + { name = "name", help = ps.lang('Deliveries.newDealerHelp.name'), type = "string" }, + { name = "min", help = ps.lang('Deliveries.newDealerHelp.timeMin'), type = "number" }, + { name = "max", help = ps.lang('Deliveries.newDealerHelp.timeMax'), type = "number" } }, - restricted = "admin" + admin = true, }, function(source, args) local ped = GetPlayerPed(source) local coords = GetEntityCoords(ped) - local Player = getPlayer(source) + local Player = ps.getPlayer(source) if not Player then return end local dealerName = args.name local pos = json.encode({x = coords.x, y = coords.y, z = coords.z}) - + local result = MySQL.scalar.await('SELECT name FROM dealers WHERE name = ?', { dealerName }) if result then - return ps.notify(source,"Already Exists", "error") + return ps.notify(source,ps.lang('Deliveries.DealerExists'), "error") end MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', { @@ -188,12 +209,12 @@ lib.addCommand("newdealer", { end) end) -lib.addCommand("deletedealer", { - help = "Delete a dealer (Admin Only)", - params = { - { name = "name", help = "Dealer Name", type = "string" } +ps.registerCommand("deletedealer", { + help = ps.lang('Deliveries.deleteDealerHelp.help'), + description = { + { name = "name", help = ps.lang('Deliveries.deleteDealerHelp.name'), type = "string" } }, - restricted = 'group.admin' + admin = true }, function(source, args) local dealerName = args.name local result = MySQL.scalar.await('SELECT * FROM dealers WHERE name = ?', { dealerName }) @@ -202,8 +223,22 @@ 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:ps.notify', source, "Dealer Deleted", "success") + ps.notify(source, ps.lang('Deliveries.deleteDealerSuccess'), "success") else - TriggerClientEvent('QBCore:ps.notify', source, "Who You Tryna Delete", "error") + ps.notify(source, ps.lang('Deliveries.deleteDealerFail'), "error") end +end) + +RegisterNetEvent('md-drugs:server:buyItemDealer', function(num) + local src = source + local itemData = Products[num] + if not itemData then return end + local Player = ps.getPlayer(src) + if not Player then return end + if not ps.removeMoney(src, 'cash', itemData.price) or not ps.removeMoney(src,'bank', itemData.price) then + ps.notify(src, ps.lang('Catches.notEnoughMoney'), 'error') + return + end + ps.addItem(src, itemData.name, 1) + ps.notify(src, string.format(ps.lang('Deliveries.buyItemSuccess'), 1, ps.getLabel(itemData.name), itemData.price), 'success') end) \ No newline at end of file diff --git a/server/functions.lua b/server/functions.lua index f46a821..a736781 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -1,13 +1,36 @@ +function verifyHas(source, items) + local need = 0 + local have = 0 + local missingList = {} ------------------------------------------- logging stuff -local logs = false -local logapi = GetConvar("fivemerrLogs", "") -local endpoint = 'https://api.fivemerr.com/v1/logs' -local headers = { - ['Authorization'] = logapi, - ['Content-Type'] = 'application/json', -} + for k, v in pairs(items) do + need = need + 1 + if ps.hasItem(source, k, v) then + have = have + 1 + else + local label = ps.getItemLabel(k) or k + table.insert(missingList, v .. " " .. label) + end + end + if need == have then + return true + end + + local message = ps.lang('Catches.itemMissings') .. table.concat(missingList, "\n") + ps.notify(source, message, 'error') + return false +end + +RegisterCommand('TestMissing', function(source) + local items = { + coke = 5, + heroin = 2, + lsd = 1 + } + local src = source + verifyHas(src, items) +end) local function handleFresh(source) local table = json.encode({ @@ -68,66 +91,12 @@ function AddRep(source, type, amount) end end -lib.addCommand('addCornerSellingTOREP', { - help = 'RUN THIS ONCE AND DELETE', - restricted = 'group.admin' -}, function(source, args, raw) - local sql = MySQL.query.await('SELECT * FROM drugrep', {}) - for k, v in pairs (sql) do - local new = {} - local old = json.decode(v.drugrep) - local get = old[1] or old - table.insert(new, { - coke = get.coke, - lsd = get.lsd, - heroin = get.heroin, - dealerrep = get.dealerrep, - cornerselling = { - price = QBConfig.SellLevel[1].price, - rep = 0, - label = QBConfig.SellLevel[1].label, - level = 1 - } - }) - local news = json.encode(new) - MySQL.query.await('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {news, v.cid}) - end -end) - -function sortTab(tbl, type) - table.sort(tbl, function(a, b) - return a[type] < b[type] - end) -end - -function handleCornersell(source, item, amount, price) - if RemoveItem(source, item, amount) then - if inventory == 'qb' then - local Player = getPlayer(source) - if QBConfig.MarkedBills == true then - Player.Functions.AddItem('markedbills',1,false, {worth = price}) - return true - end - if QBConfig.CustomDirtyMoney == true then - AddItem(source, QBConfig.CustomDirtyMoneyitem,price) - return true - end - Player.Functions.AddMoney('cash', price) - elseif inventory == 'ox' then - AddItem(source, 'black_money', price) - return true - end - else - return false - end -end - -lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args) - return getCops() +ps.registerCallback('md-drugs:server:GetCoppers', function(source, cb, args) + return ps.getJobTypeCount('leo') end) ps.registerCallback('md-drugs:server:GetRep', function(source, cb, args) - local rep = GetAllRep(source) + local rep = GetAllRep(source) return rep end) diff --git a/server/heroin.lua b/server/heroin.lua index a465ed3..21c74c3 100644 --- a/server/heroin.lua +++ b/server/heroin.lua @@ -59,8 +59,11 @@ end) RegisterServerEvent('md-drugs:server:dryplant', function(num) local src = source - if not ps.checkDistance(src, heroinLocations.dryplant[num].loc, 3.0) then return end - if not ps.hasItem(src, 'poppyresin', 1) then return end + if not ps.checkDistance(src, heroinLocations.dryplant[num].loc, 3.0) then + ps.notify(src, ps.lang('Catches.notIn'), 'error') + return + end + local tier = 'tier1' if Config.TierSystem then local heroin = getRep(src, 'heroin') @@ -73,15 +76,17 @@ RegisterServerEvent('md-drugs:server:dryplant', function(num) end end if not ps.craftItem(src, heroinRecipes['dryheroin'][tier]) then - ps.notify(src, 'You do not have the required items', 'error') + verifyHas(src, heroinRecipes['dryheroin'][tier].take) return end end) RegisterServerEvent('md-drugs:server:cutheroin', function(num) local src = source - if not ps.checkDistance(src, heroinLocations.cutheroinone[num].loc, 3.0) then return end - if not ps.hasItem(src, 'bakingsoda', 1) then return end + if not ps.checkDistance(src, heroinLocations.cutheroinone[num].loc, 3.0) then + ps.notify(src, ps.lang('Catches.notIn'), 'error') + return + end if Config.TierSystem then local itemList = { heroin = 'tier1', @@ -92,7 +97,7 @@ RegisterServerEvent('md-drugs:server:cutheroin', function(num) local cuth = ps.hasItem(src, k) if cuth then if not ps.craftItem(src, heroinRecipes['cutheroin'][v]) then - ps.notify(src, 'You do not have the required items', 'error') + verifyHas(src, heroinRecipes['cutheroin'][v].take) return end AddRep(src, 'heroin') @@ -101,7 +106,7 @@ RegisterServerEvent('md-drugs:server:cutheroin', function(num) end else if not ps.craftItem(src, heroinRecipes['cutheroin']['tier1']) then - ps.notify(src, 'You do not have the required items', 'error') + verifyHas(src, heroinRecipes['cutheroin']['tier1'].take) return end end @@ -109,13 +114,16 @@ end) RegisterServerEvent('md-drugs:server:getheroinlabkit', function(num) local src = source - if not ps.checkDistance(src, heroinLocations.buyKit[num].loc, 3.0) then return end + if not ps.checkDistance(src, heroinLocations.buyKit[num].loc, 3.0) then + ps.notify(src, ps.lang('Catches.notIn'), 'error') + return + end local has = ps.hasItem(src, 'heroinlabkit') - if has then ps.notify(src, Lang.Heroin.haskit, 'error') return end + if has then ps.notify(src, ps.lang('heroin.hasKitAlready'), 'error') return end if ps.removeMoney(src, 'cash', prices.heroinlabkitprice) then ps.addItem(src, 'heroinlabkit', 1) else - ps.notify(src, 'You Need '.. prices.heroinlabkitprice .. ' In Cash For This', 'error') + ps.notify(src, ps.lang('heroin.notEnoughMoney', prices.heroinlabkitprice), 'error') end end) @@ -152,7 +160,7 @@ ps.createUseable('heroinlabkit', function(source, item) coords = loc, name = ps.getPlayerName(src) }) - ps.notify(src, ps.lang('Heroin.placed'), "success") + ps.notify(src, ps.lang('heroin.placedKit'), "success") end end) @@ -170,7 +178,7 @@ RegisterServerEvent('md-drugs:server:heatliquidheroin', function() local cuth = ps.hasItem(src, k) if cuth then if not ps.craftItem(src, heroinRecipes['fillvial'][v]) then - ps.notify(src, 'You do not have the required items', 'error') + verifyHas(src, heroinRecipes['fillvial'][v].take) return end AddRep(src, 'heroin') @@ -178,7 +186,10 @@ RegisterServerEvent('md-drugs:server:heatliquidheroin', function() end end else - if not ps.craftItem(src, heroinRecipes['fillvial']['tier1']) then return end + if not ps.craftItem(src, heroinRecipes['fillvial']['tier1']) then + verifyHas(src, heroinRecipes['fillvial']['tier1'].take) + return + end end end) @@ -194,7 +205,7 @@ RegisterServerEvent('md-drugs:server:failheatingheroin', function() local cuth = ps.hasItem(src, k) if cuth then ps.removeItem(src, k, v) - ps.notify(src, ps.lang('Heroin.fail'), "error") + ps.notify(src, ps.lang('heroin.failed'), "error") return end end @@ -202,8 +213,8 @@ end) RegisterServerEvent('md-drugs:server:fillneedle', function(num) local src = source - if not ps.checkDistance(src, GlobalState.MDDrugsLocs.fillneedle[num].loc, 3.0) then - ps.notify(src, ps.lang('Heroin.noloc'), 'error') + if not ps.checkDistance(src, heroinLocations.fillNeedle[num].loc, 3.0) then + ps.notify(src, ps.lang('Catches.notIn'), 'error') return end if not ps.hasItem(src, 'needle', 1) then return end @@ -216,14 +227,19 @@ RegisterServerEvent('md-drugs:server:fillneedle', function(num) for k, v in pairs(itemList) do local vh = ps.hasItem(src, v.item) if vh then - if not ps.craftItem(src, heroinRecipes['fillneedle'][v.tier]) then return end + if not ps.craftItem(src, heroinRecipes['fillneedle'][v.tier]) then + verifyHas(src, heroinRecipes['fillneedle'][v.tier].take) + return + end AddRep(src, 'heroin') return end end - ps.notify(src,Lang.Heroin.nofill, "error") else - if not ps.craftItem(src, heroinRecipes['fillneedle']['tier1']) then return end + if not ps.craftItem(src, heroinRecipes['fillneedle']['tier1']) then + verifyHas(src, heroinRecipes['fillneedle']['tier1'].take) + return + end end end) diff --git a/server/lean.lua b/server/lean.lua index 6c7d1a9..6c3aada 100644 --- a/server/lean.lua +++ b/server/lean.lua @@ -37,7 +37,7 @@ end RegisterServerEvent('md-drugs:server:givelean', function() local src = source local amount = math.random(1,5) - if not onRun[ps.getIdentifier(src)] then return ps.notify(src, Lang.lean.err, "error") end + if not onRun[ps.getIdentifier(src)] then return ps.notify(src, ps.lang('lean.notOnRun'), "error") end onRun[ps.getIdentifier(src)] = onRun[ps.getIdentifier(src)] + 1 if math.random(1,100) <= 50 then ps.addItem(src, "mdlean", amount) diff --git a/server/lsd.lua b/server/lsd.lua index 205f4de..7aa3881 100644 --- a/server/lsd.lua +++ b/server/lsd.lua @@ -47,7 +47,7 @@ RegisterServerEvent('md-drugs:server:getlysergic', function(num) local src = source if timedOut[src] then return end if not ps.checkDistance(src, lsdLocations.lysergicacid[num].loc, 2.0) then - ps.notify(src, ps.lang('lsd.notinloc'), "error") + ps.notify(src, ps.lang('Catches.notIn'), "error") return end timeout(src, 3000) @@ -58,7 +58,7 @@ RegisterServerEvent('md-drugs:server:getdiethylamide', function(num) local src = source if timedOut[src] then return end if not ps.checkDistance(src, lsdLocations.diethylamide[num].loc, 2.0) then - ps.notify(src, Lang.lsd.notinloc, "error") + ps.notify(src, ps.lang('Catches.notIn'), "error") return end timeout(src, 3000) @@ -109,7 +109,7 @@ RegisterServerEvent('md-drugs:server:heatliquid', function() local src = source if not hasLabKit(src) then return end if not ps.craftItem(src, lsdRecipes['vial']['heat']) then - ps.notify(src, ps.lang('lsd.noliquid'), "error") + verifyHas(src, lsdRecipes['vial']['heat'].take) return end end) @@ -119,14 +119,14 @@ RegisterServerEvent('md-drugs:server:failheating', function() if not hasLabKit(src) then return end ps.removeItem(src, 'lysergic_acid', 1) ps.removeItem(src, 'diethylamide', 1) - ps.notify(src, ps.lang('prices.lsd.failed'), "error") + ps.notify(src, ps.lang('lsd.failed'), "error") end) RegisterServerEvent('md-drugs:server:refinequalityacid', function() -local src = source -if not hasLabKit(src) then return end -if not ps.hasItem(src, 'lsd_one_vial', 1) then return end + local src = source + if not hasLabKit(src) 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 @@ -170,25 +170,30 @@ end) RegisterServerEvent('md-drugs:server:gettabpaper', function(num) local src = source - if not ps.checkDistance(src, lsdLocations.gettabs[num].loc, 3.0) then return end + if not ps.checkDistance(src, lsdLocations.gettabs[num].loc, 3.0) then + ps.notify(src, ps.lang('Catches.notIn'), "error") + return + end if ps.removeMoney(src, 'cash', prices.tabcost * 10) then ps.addItem(src,'tab_paper', 10) else - ps.notify(src, Lang.lsd.broke, "error") + ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") end end) RegisterServerEvent('md-drugs:server:getlabkit', function(num) local src = source if ps.hasItem(src,'lsdlabkit', 1) then - ps.notify(src, ps.lang('lsd.havlabkit'), 'error') return end - if not ps.checkDistance(src, lsdLocations.buyLSDkit[num].loc, 3.0) then return end + if not ps.checkDistance(src, lsdLocations.buyLSDkit[num].loc, 3.0) then + ps.notify(src, ps.lang('Catches.notIn'), "error") + return + end if ps.removeMoney(src, 'cash', prices.lsdlabkitcost) then ps.addItem(src,'lsdlabkit', 1) else - ps.notify(src, Lang.lsd.broke, "error") + ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") end end) diff --git a/server/mescaline.lua b/server/mescaline.lua index 9fb6b2f..c9a3ddf 100644 --- a/server/mescaline.lua +++ b/server/mescaline.lua @@ -3,23 +3,33 @@ local mescalineLocation = { {loc = vector3(1850.12, 2595.23, 45.67), l = 1.0, w = 1.0, rot = 0.0, gang = ""}, }, } +local mescalineRecipes = { + mescaline = { + dry = { + dried = {take = {cactusbulb = 1}, give = {driedmescaline = 1} } + } + }, +} ps.registerCallback('md-drugs:server:GetMescalineLocs', function(source) return mescalineLocation end) + RegisterNetEvent("md-drugs:server:drymescaline", function(num) local src = source if not ps.checkDistance(src, mescalineLocation.DryOutMescaline[num].loc, 3.0) then - ps.notify(src, "You are not in the right location", "error") + ps.notify(src, ps.lang('Catches.notIn'), "error") + return + end + if not ps.craftItem(src, mescalineRecipes.mescaline.dry.dried) then + verifyHas(src, mescalineRecipes.mescaline.dry.dried.take) return end - if not GetRecipe(src, 'mescaline', 'dry', 'dried') then return end end) ps.createUseable("driedmescaline", function(source, item) local src = source - if ps.removeItem(src, "driedmescaline", 1) then + if ps.removeItem(src, "driedmescaline", 1) then TriggerClientEvent("md-drugs:client:takemescaline", src) - end end) \ No newline at end of file diff --git a/server/meth.lua b/server/meth.lua index 45b47dc..acbc724 100644 --- a/server/meth.lua +++ b/server/meth.lua @@ -34,9 +34,19 @@ local methLocs = { } } +local methRecipes = { + cook = { + heat = {take = {ephedrine = 1, acetone = 1}, give = {}} + }, + bag = { + bags = {take = {empty_weed_bag = 5}, give = {methbags = 5} } + } +} + ps.registerCallback('md-drugs:server:GetMethLocs', function(source) return methLocs end) + local function setTimeout(identifier) if onRun[identifier] then CreateThread(function() @@ -62,7 +72,7 @@ end RegisterServerEvent('md-drugs:server:givemethingridients', function() local src = source local amount = math.random(1,5) - if not onRun[ps.getIdentifier(src)] then return ps.notify(src, Lang.lean.err, "error") end + if not onRun[ps.getIdentifier(src)] then return ps.notify(src, ps.lang('meth.notOnRun'), "error") end onRun[ps.getIdentifier(src)] = onRun[ps.getIdentifier(src)] + 1 if math.random(1,100) <= 50 then ps.addItem(src, "ephedrine", amount) @@ -74,41 +84,51 @@ RegisterServerEvent('md-drugs:server:givemethingridients', function() 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(num) local src = source - if not ps.checkDistance(src, methLocs.BagMeth[num].loc, 2.5) then return end - if not GetRecipe(src, 'meth', 'bag', 'bags') then return end + if not ps.checkDistance(src, methLocs.BagMeth[num].loc, 2.5) then + ps.notify(src, ps.lang('Catches.notIn'), "error") + return + end + if not ps.craftItem(src, methRecipes.meth.bag.bags) then + verifyHas(src, methRecipes.meth.bag.bags.take) + return + end end) RegisterServerEvent('md-drugs:server:geteph', function(num) local src = source - if not ps.checkDistance(src, methLocs.MethEph[num].loc, 2.5) then return end - if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.wait'), "error") end - if ps.addItem(src, 'ephedrine', 1) then - ps.notify(src, 'Got Ephedrine!', "success") + if not ps.checkDistance(src, methLocs.MethEph[num].loc, 2.5) then + ps.notify(src, ps.lang('Catches.notIn'), "error") + return end + if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.onCooldown'), "error") end + ps.addItem(src, 'ephedrine', 1) end) RegisterServerEvent('md-drugs:server:getace', function(num) local src = source - if not ps.checkDistance(src, methLocs.MethAce[num].loc, 2.5) then return end - if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.wait'), "error") end - if ps.addItem(src, 'acetone', 1) then - ps.notify(src, 'Got Acetone!', "success") + if not ps.checkDistance(src, methLocs.MethAce[num].loc, 2.5) then + ps.notify(src, ps.lang('Catches.notIn'), "error") + return end + if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.onCooldown'), "error") end + ps.addItem(src, 'acetone', 1) end) ps.registerCallback('md-drugs:server:startcook', function(source, num) local src = source - if not ps.checkDistance(src, methLocs.CookMeth[num].loc, 2.5) then return false end - local recipe = GetRecipe(src, 'meth', 'cook', 'heat') - return recipe + if not ps.checkDistance(src, methLocs.CookMeth[num].loc, 2.5) then + ps.notify(src, ps.lang('Catches.notIn'), "error") + return false + end + local recipe = ps.craftItem(src, methRecipes.meth.cook.heat) + if not recipe then + verifyHas(src, methRecipes.meth.cook.heat.take) + return false + end + return true end) ps.registerCallback('md-drugs:server:registerMeth', function(source) diff --git a/server/oxyruns.lua b/server/oxyruns.lua index 2dd8b02..da3ce1a 100644 --- a/server/oxyruns.lua +++ b/server/oxyruns.lua @@ -32,10 +32,10 @@ ps.registerCallback('md-drugs:server:payfortruck', function(source) local src = source if ps.removeMoney(src, 'cash', prices.payfortruck) or ps.removeMoney(src, 'bank', prices.payfortruck) then onRoute[src] = true - ps.notify(src, ps.lang('oxy.paid') .. prices.payfortruck, "success") + ps.notify(src, ps.lang('oxy.paid', prices.payfortruck), "success") return true else - ps.notify(src, ps.lang('oxy.broke'), "error") + ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") return false end end) @@ -44,12 +44,12 @@ end) RegisterServerEvent('md-drugs:server:giveoxybox', function() local src = source if not onRoute[src] then - ps.notify(src, ps.lang('oxy.notonroute'), "error") + ps.notify(src, ps.lang('oxy.notOn'), "error") return end if not ps.checkDistance(src, oxyLocs.oxylocations[onRoute[src]], 3.5) then - ps.notify(src, ps.lang('oxy.toofar'), "error") + ps.notify(src, ps.lang('Catches.notIn'), "error") return end diff --git a/server/pharma.lua b/server/pharma.lua index 75ccdc6..340ebf6 100644 --- a/server/pharma.lua +++ b/server/pharma.lua @@ -7,6 +7,7 @@ local pharmaLocations = { ps.registerCallback('md-drugs:server:GetPharmaLocs', function() return pharmaLocations end) + local function GetJob(source) local src = source return ps.getJobType(src) == 'ems' @@ -17,15 +18,14 @@ ps.createUseable('prescription_pad', function(source, item) local near = {} if GetJob(src) then near = ps.getNearbyPlayers(src, 5.0) - local options = { - {label = 'Vicodin', value = 'vicodin_prescription'}, - {label = 'Adderal', value = 'adderal_prescription'}, - {label = 'Morphine', value = 'morphine_prescription'}, - {label = 'Xanax', value = 'xanax_prescription'} + {label = ps.getItemLabel('vicodin_prescription'), value = 'vicodin_prescription'}, + {label = ps.getItemLabel('adderal_prescription'), value = 'adderal_prescription'}, + {label = ps.getItemLabel('morphine_prescription'), value = 'morphine_prescription'}, + {label = ps.getItemLabel('xanax_prescription'), value = 'xanax_prescription'} } local data = ps.callback('md-drugs:client:prescriptionpad', src, near, options) - if not data then return ps.notify(src, ps.lang('Pharma.cancel'), "error") end + if not data then return ps.notify(src, ps.lang('pharma.canceled'), "error") end ps.addItem(ps.getSource(data.who), data.what, 1) end end) @@ -46,7 +46,7 @@ for m, d in pairs (pharmabottle) do if d == k then if ps.removeItem(src, d, 1) then ps.addItem(src, v, math.random(10,30)) - ps.notify(src,ps.lang('Pharma.unbottle'), "success") + ps.notify(src,ps.lang('pharma.unbottle'), "success") end end end @@ -57,7 +57,7 @@ end RegisterServerEvent('md-drugs:server:fillprescription', function(num) local src = source if not ps.checkDistance(src, pharmaLocations.FillPrescription[num].loc, 3.5) then - return ps.notify(src, ps.lang('Pharma.toofar'), "error") + return ps.notify(src, ps.lang('Catches.notIn'), "error") end local pres = { vicodin_prescription = 'vicodinbottle', diff --git a/server/plantSpawns.lua b/server/plantSpawns.lua index f830430..c59f470 100644 --- a/server/plantSpawns.lua +++ b/server/plantSpawns.lua @@ -12,7 +12,7 @@ local drugModelsBuzz = { weed = "bzzz_plant_weed_pot_green_d" } local function propsLabels(drugType) - if Config.Buzz[drugType] then + if Config.Bzz[drugType] then return drugModelsBuzz[drugType] else return drugModels[drugType] diff --git a/server/recipes.lua b/server/recipes.lua deleted file mode 100644 index 9c436d6..0000000 --- a/server/recipes.lua +++ /dev/null @@ -1,66 +0,0 @@ - - -recipe = { - mescaline = { - dry = { - dried = {take = {cactusbulb = 1}, give = {driedmescaline = 1} } - } - }, - lean = { - cups = { - cupoflean = {take = {leancup = 1, sprunk = 1, mdlean = 1}, give = {cupoflean = 1}}, - cupofdextro = {take = {leancup = 1, sprunk = 1, mdreddextro = 1}, give = {cupofdextro = 1}}, - } - }, - meth = { - cook = { - heat = {take = {ephedrine = 1, acetone = 1}, give = {}} - }, - bag = { - bags = {take = {empty_weed_bag = 5}, give = {methbags = 5} } - } - }, - weed = { - oil = { - shatter = {take = {butane = 1, grindedweed = 1}, give = {shatter = 1}} - }, - blunts = { - blunt = {take = {bluntwrap = 1, grindedweed = 1}, give = {blunt = 1}}, - chewyblunt = {take = {bluntwrap = 1, grindedweed = 1, loosecoke = 1}, give = {chewyblunt = 1}}, - leanblunts = {take = {leanbluntwrap = 1, grindedweed = 1}, give = {leanblunts = 1}}, - dextroblunts = {take = {dextrobluntwrap = 1, grindedweed = 1}, give = {dextroblunts = 1}} - }, - bluntwrap = { - leanbluntwrap = {take = {bluntwrap = 5, mdlean = 1}, give = {leanbluntwrap = 5}}, - dextrobluntwrap = {take = {bluntwrap = 5, mdreddextro = 1}, give = {dextrobluntwrap = 5}}, - } - }, -} - -function GetRecipe(source, type, method, tier) - return ps.craftItem(source, recipe[type][method][tier]) -end - -ps.registerCallback('md-drugs:server:GetRecipe', function(source, type, cat) - if not source then return false end - return recipe[type][cat] -end) - -function craft(source, tbl, item) - local src = source - local need, have = 0,0 - for k, v in pairs(tbl.take) do - if ps.hasItem(src, k, v) then - have = have + v - end - need = need + v - end - if need == have then - for k, v in pairs (tbl.take) do - ps.removeItem(src, k, v) - end - ps.addItem(src, item , tbl.amount) - return true - end - return false -end \ No newline at end of file diff --git a/server/shops.lua b/server/shops.lua deleted file mode 100644 index 2646b2f..0000000 --- a/server/shops.lua +++ /dev/null @@ -1,89 +0,0 @@ - -local Target = { - Travellingmerchant = { -- where the travelling merchant can spawn - vector4(-119.66, -977.43, 304.25, 88.21), - vector4(-1522.93, 1476.01, 111.45, 41.25), - vector4(-3278.98, 973.38, 5.35, 101.53), - }, -} - -local loc = Target.Travellingmerchant[math.random(1, #Target.Travellingmerchant)] - -ps.registerCallback('md-drugs:server:GetMerchant', function(source) - return loc -end) - -function getRandW(src) - local rand = math.random(1, #Target.oxylocations) - return Target.oxylocations[rand] -end - -local stores = { - travel = { - {name = "tab_paper", price = 50, amount = 50, }, - {name = "bakingsoda", price = 25, amount = 50, }, - {name = "isosafrole", price = 25, amount = 50, }, - {name = "mdp2p", price = 25, amount = 50, }, - {name = "lysergic_acid", price = 25, amount = 50, }, - {name = "diethylamide", price = 25, amount = 50, }, - {name = "lockpick", price = 2, amount = 1000, }, - {name = "emptyvial", price = 2, amount = 1000, }, - {name = "needle", price = 2, amount = 1000, }, - {name = "cokeburner", price = 25, amount = 50, }, - {name = "crackburner", price = 2, amount = 50, }, - {name = "lsdburner", price = 2, amount = 50, }, - {name = "heroinburner", price = 2, amount = 50, }, - {name = "mdlean", price = 50, amount = 50, }, - {name = "weedgrinder", price = 25, amount = 50, }, - {name = "mdbutter", price = 25, amount = 50, }, - {name = "flour", price = 25, amount = 50, }, - {name = "chocolate", price = 25, amount = 50, }, - {name = "butane", price = 25, amount = 50, }, - {name = "butanetorch", price = 2, amount = 1000, }, - {name = "dabrig", price = 2, amount = 1000, }, - {name = "mdwoods", price = 2, amount = 1000, }, - {name = "leancup", price = 25, amount = 50, }, - {name = "xtcburner", price = 25, amount = 50, }, - }, - - Products = { - {name = "weed_white-widow_seed", price = 15, amount = 150, minrep = 0}, - {name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0}, - {name = "weed_purple-haze_seed", price = 15, amount = 150, minrep = 0}, - {name = "weed_og-kush_seed", price = 15, amount = 150, minrep = 0}, - {name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0}, - }, - ProductsStupidNameRewrite = { - {name = "weed_whitewidow_seed", price = 15, amount = 150, minrep = 0}, - {name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0}, - {name = "weed_purplehaze_seed", price = 15, amount = 150, minrep = 0}, - {name = "weed_ogkush_seed", price = 15, amount = 150, minrep = 0}, - {name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0}, - } -} - -ps.registerCallback('md-drugs:server:menu', function(source, data) - local src = source - if data == 'travellingMerchant' then - return {table = stores.travel, des = '$', id = 'travellingMerchant', title = 'travelling Merchant'} - elseif data == 'dealermenu' then - local table - if Config.StupidassNewQbItemName then table = stores.ProductsStupidNameRewrite else table = stores.Products end - return {table = table, id = 'dealermenu', title = "Dealer Menu"} - elseif data == 'WeedShop' then - return {table = stores.Weed, id = 'WeedShop', title = "Weed Shop"} - end -end) - -RegisterServerEvent("md-drugs:server:purchaseGoods", function(amount, money, item, price,table,num) - local src = source local Player = getPlayer(src) - for i = 1, #table do - if table[i].name == item then - 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') - end - end - end -end) diff --git a/server/shrooms.lua b/server/shrooms.lua index 1184ad4..4720c32 100644 --- a/server/shrooms.lua +++ b/server/shrooms.lua @@ -2,10 +2,10 @@ ps.createUseable('shrooms', function(source, item) local src = source if not ps.callback("md-drugs:client:shrooms", src) then - ps.notify(src, ps.lang('Shrooms.cancel'), "error") + ps.notify(src, ps.lang('shrooms.cancel'), "error") return end ps.removeItem(src, 'shrooms', 1) - ps.notify(src, 'You Took Some Shrooms!', 'success') + ps.notify(src, ps.lang('shrooms.took'), 'success') end) diff --git a/server/weed.lua b/server/weed.lua index 0bdcf5e..ada2aab 100644 --- a/server/weed.lua +++ b/server/weed.lua @@ -30,6 +30,24 @@ local weedStore = { mdwoods =2, } +local weed = { + blunts = { + blunt = {take = {bluntwrap = 1, grindedweed = 1}, give = {blunt = 1}}, + chewyblunt = {take = {bluntwrap = 1, grindedweed = 1, loosecoke = 1}, give = {chewyblunt = 1}}, + leanblunts = {take = {leanbluntwrap = 1, grindedweed = 1}, give = {leanblunts = 1}}, + dextroblunts = {take = {dextrobluntwrap = 1, grindedweed = 1}, give = {dextroblunts = 1}} + }, + bluntwrap = { + leanbluntwrap = {take = {bluntwrap = 5, mdlean = 1}, give = {leanbluntwrap = 5}}, + dextrobluntwrap = {take = {bluntwrap = 5, mdreddextro = 1}, give = {dextrobluntwrap = 5}}, + } +} + +ps.registerCallback('md-drugs:server:GetWeedRecipe', function(source, tableName) + if not source then return false end + return weed[tableName] +end) + ps.registerCallback('md-drugs:server:GetWeedLocs', function(source) return weedLocs end) @@ -37,20 +55,21 @@ end) ps.registerCallback('md-drugs:server:getWeedItems', function(source) return weedStore end) + RegisterNetEvent('md-drugs:server:buyWeedItem', function(loc, name, amount) local src = source if not ps.checkDistance(src, weedLocs.WeedSalesman[loc].loc, 3.5) then - ps.notify(src, ps.lang('Weed.notHere'), "error") + ps.notify(src, ps.lang('Checks.notIn'), "error") return end if not weedStore[name] then - ps.notify(src, ps.lang('Weed.notHere'), "error") + ps.notify(src, ps.lang('weed.itemDoesntExist'), "error") return end if ps.removeMoney(src, 'cash', weedStore[name] * amount) or ps.removeMoney(src, 'bank', weedStore[name] * amount) then ps.addItem(src, name, amount) else - ps.notify(src, ps.lang('Weed.noMoney'), "error") + ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") end end) @@ -59,12 +78,12 @@ RegisterServerEvent('md-drugs:server:dryoutweed', function() if ps.removeItem(src,"wetcannabis", 1) then ps.addItem(src,"drycannabis", 1) else - ps.notify(src, ps.lang('Weed.nodry'), "error") + ps.notify(src, ps.lang('weed.noDry'), "error") end end) local bluntwrap = {'mdreddextro','mdlean'} -for k, v in pairs (bluntwrap) do +for k, v in pairs (bluntwrap) do ps.createUseable(v, function(source, item) TriggerClientEvent('md-drugs:client:makeBluntWrap', source) end) end @@ -77,7 +96,10 @@ end RegisterServerEvent('md-drugs:server:MakeWeedItems', function(data) local src = source - if not GetRecipe(src, data.recipe, data.table, data.item) then return end + if not ps.craftItem(src, weed[data.table][data.item]) then + verifyHas(src, weed[data.table][data.item].take) + return + end end) @@ -88,13 +110,13 @@ ps.createUseable("dabrig", function(source, item) TriggerClientEvent("md-drugs:client:dodabs", src) end else - ps.notify(src, 'You Need A Butane Torch', 'error') + ps.notify(src, ps.lang('weed.needItem', ps.getItemLabel("butanetorch")), 'error') end end) ps.createUseable("weedgrinder", function(source, item) local src = source - if not ps.hasItem(src, "drycannabis") then ps.notify(src, 'You Need Dried Cannabis', 'error') return end + if not ps.hasItem(src, "drycannabis") then ps.notify(src, ps.lang('weed.needItem', ps.getItemLabel("drycannabis")), 'error') return end local check = ps.callback('md-drugs:client:uncuff', src, 'Grinding Weed') if not check then return end if ps.removeItem(src, "drycannabis",1 ) then @@ -104,7 +126,7 @@ end) ps.createUseable("mdwoods", function(source, item) local src = source - local check = ps.callback('md-drugs:client:uncuff', src, 'Breaking Blunt Open') + local check = ps.callback('md-drugs:client:uncuff', src, ps.lang('weed.crackBlunt')) if not check then return end if ps.removeItem(src, "mdwoods",1 ) then ps.addItem(src, "bluntwrap", 5) diff --git a/server/wholesale.lua b/server/wholesale.lua index 9f3f8eb..5e35334 100644 --- a/server/wholesale.lua +++ b/server/wholesale.lua @@ -14,15 +14,33 @@ local Price = { heroin = {min = 20, max = 60}, xtc = {min = 20, max = 60}, } +local locs = { + vector4(-2352.32, 266.78, 165.3, 23.46), + vector4(-1467.49, 874.01, 183.59, 298.45), + vector4(-856.71, 874.26, 202.85, 205.3), + vector4(950.58, -128.49, 74.42, 205.3), + vector4(1152.71, -328.43, 69.21, 205.3), + vector4(112.66, -1955.67, 20.75, 37.94), + vector4(-544.4, -1684.8, 19.89, 252.07), + vector4(-1185.02, -1805.4, 3.91, 184.83), + vector4(-1641.4, -981.99, 7.58, 35.38), + vector4(-1827.93, 782.36, 138.29, 219.99), + vector4(-320.84, 2818.73, 59.45, 337.22), + vector4(474.88, 2609.56, 44.48, 357.0), +} +function getRandW(src) + local rand = math.random(1, #locs) + return locs[rand] +end for k, v in pairs (burners) do - CUI(k, function(source, item) + ps.createUseable(k, function(source, item) local src = source local Player = getPlayer(src) - if getCops() < Config.PoliceCount then return ps.notify(src, Lang.Wholesale.na, 'error') end + if getCops() < Config.PoliceCount then return ps.notify(src, ps.lang('wholesale.notEnoughCops'), 'error') end for m, d in pairs (active) do if d.cid == Player.PlayerData.citizenid then - return ps.notify(src, Lang.Wholesale.al, 'error' ) + return ps.notify(src, ps.lang('wholesale.alreadyWholesale'), 'error' ) end end local tab = '' @@ -31,17 +49,17 @@ for k, v in pairs (burners) do if k == 'lsdburner' then tab = 'lsd' end if k == 'heroinburner' then tab = 'heroin' end if k == 'xtcburner' then tab = 'xtc' end - if RemoveItem(src, k, 1) then + if ps.removeItem(src, k, 1) then table.insert(active, { src = src, item = k, location = getRandW(src), - cid = Player.PlayerData.citizenid, + cid = ps.getIdentifier(src), type = v, price = Price[tab] }) for m, d in pairs (active) do - if d.cid == Player.PlayerData.citizenid then + if d.cid == ps.getIdentifier(src) then TriggerClientEvent("md-drugs:client:GetLocation", src, active[m]) end end @@ -51,15 +69,18 @@ end RegisterNetEvent('md-drugs:server:SuccessSale', function(data) local src = source - local Player = getPlayer(src) - for k, v in pairs (active) do - if v.cid == Player.PlayerData.citizenid then + for k, v in pairs (active) do + if v.cid == ps.getIdentifier(src) then + if not ps.checkDistance(src, v.location, 4.0) then + return ps.notify(src, ps.lang('Catches.notIn'), "error") + end local payout = math.random(v.price.min, v.price.max) - for m, d in pairs (v.type) do - local git = Player.Functions.GetItemByName(d) - if git and git.amount >= 1 then - RemoveItem(src, d, git.amount) - Player.Functions.AddMoney('cash', git.amount * payout) + for m, d in pairs (v.type) do + local git = ps.getItemCount(src, d) + if git >= 1 then + if ps.removeItem(src, d, git) then + ps.addMoney('cash', git * payout) + end end table.remove(active, k) end diff --git a/server/xtc.lua b/server/xtc.lua index 848844f..77a57aa 100644 --- a/server/xtc.lua +++ b/server/xtc.lua @@ -53,9 +53,30 @@ local xtcLocations = { {loc = vector3(844.71, -900.56, 25.43), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, }, } + ps.registerCallback('md-drugs:server:GetXtcLocs', function(source) return xtcLocations end) + +local function craft(source, tbl, item) + local src = source + local need, have = 0,0 + for k, v in pairs(tbl.take) do + if ps.hasItem(src, k, v) then + have = have + v + end + need = need + v + end + if need == have then + for k, v in pairs (tbl.take) do + ps.removeItem(src, k, v) + end + ps.addItem(src, item , tbl.amount) + return true + end + return false +end + local activePresses = {} local timeout = {} @@ -69,20 +90,26 @@ end RegisterServerEvent('md-drugs:server:stealisosafrole', function(num) local src = source - if not ps.checkDistance(src, xtcLocations.isosafrole[num].loc, 3.0) then return end + if not ps.checkDistance(src, xtcLocations.isosafrole[num].loc, 3.0) then + ps.notify(src, ps.lang('Checks.notIn'), "error") + return + end if timeout[ps.getIdentifier(src)] then - ps.notify(src, 'You are still waiting for the last minigame to finish', 'error') + ps.notify(src, ps.lang('Catches.cooldown'), 'error') return end timeOut(src) - ps.addItem(src, "isosafrole", 1) + ps.addItem(src, "isosafrole", 1) end) RegisterServerEvent('md-drugs:server:stealmdp2p', function(num) local src = source - if not ps.checkDistance(src, xtcLocations.mdp2p[num].loc, 3.0) then return end + if not ps.checkDistance(src, xtcLocations.mdp2p[num].loc, 3.0) then + ps.notify(src, ps.lang('Checks.notIn'), "error") + return + end if timeout[ps.getIdentifier(src)] then - ps.notify(src, 'You are still waiting for the last minigame to finish', 'error') + ps.notify(src, ps.lang('Catches.cooldown'), 'error') return end timeOut(src) @@ -126,7 +153,7 @@ end) RegisterServerEvent('md-drugs:server:makextc', function(data) local src = source if not activePresses[ps.getIdentifier(src)] then - ps.notify(src, 'You Dont Have A Pill Press', 'error') + ps.notify(src, ps.lang('xtc.noPressOut'), 'error') return end craft(src, RecipeList[activePresses[ps.getIdentifier(src)].press][data], data) @@ -137,14 +164,14 @@ RegisterServerEvent('md-drugs:server:buypress', function() if ps.removeMoney(src,"cash", RecipeList.presses['singlepress'].cash) then ps.addItem(src, "singlepress", 1) else - ps.notify(ps.lang('xtc.cash'), "error") + ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") end end) RegisterServerEvent('md-drugs:server:upgradepress', function(data) local src = source if not ps.checkDistance(src, xtcLocations.xtcpress[data].loc, 2.0) then - ps.notify(src, ps.lang('xtc.toofar'), "error") + ps.notify(src, ps.lang('Catches.notIn'), "error") return end craft(src, RecipeList.presses[data], data) @@ -156,9 +183,12 @@ end) ------------- making powder RegisterServerEvent('md-drugs:server:makingrawxtc', function(num) local src = source - if not ps.checkDistance(src, xtcLocations.rawxtcloc[num].loc, 3.0) then return end + if not ps.checkDistance(src, xtcLocations.rawxtcloc[num].loc, 3.0) then + ps.notify(src, ps.lang('Checks.notIn'), "error") + return + end if timeout[ps.getIdentifier(src)] then - ps.notify(src, 'You are still waiting for the last minigame to finish', 'error') + ps.notify(src, ps.lang('Catches.cooldown'), 'error') return end timeOut(src) @@ -174,10 +204,8 @@ local function getColor(color) } if colors[color] then return colors[color][math.random(#colors[color])] - else - ps.notify('Invalid color specified', 'error') - return nil end + return nil end RegisterServerEvent('md-drugs:server:stamp', function(num, color) @@ -199,7 +227,7 @@ RegisterServerEvent('md-drugs:server:stamp', function(num, color) elseif ps.removeItem(src, colors[color].."4", 1) then ps.addItem(src, item..'4', 1) else - ps.notify('You Dont Have Unstamped '..color..' Pills', 'error') + ps.notify(src, ps.lang('xtc.noPills'), 'error') end end) diff --git a/serverRun.lua b/serverRun.lua index 42cf07c..37febbe 100644 --- a/serverRun.lua +++ b/serverRun.lua @@ -16,7 +16,6 @@ function loadFile(filePath) ps.error("Error executing Lua chunk from '" .. filePath .. "': " .. tostring(execErr)) return false end - ps.success("Successfully loaded module '" .. filePath .. "' from resource '" .. resourceName .. "'.") return true end diff --git a/shared/config.lua b/shared/config.lua index 3820cd8..0989d61 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -1,17 +1,12 @@ Config = {} --Ignore. ps = exports.ps_lib:init() -ps.loadLangs("wookie") -Config.respawnTime = 3 -- Seconds +ps.loadLangs("en") + +Config.respawnTime = 100 -- Seconds Config.Fuel = "LegacyFuel" -- type the name of script you use i.e. ps-fuel, cdn-fuel, LegacyFuel Config.TierSystem = true -- allows for three tiers of certain drugs ( coke, heroin, crack, lsd) -Config.StupidassNewQbItemName = true -- true if you have updated your items.lua from base qb after november 2023 because changing item names this far in a framework is 3 IQ points total Config.RequestModelTime = 30000 -- if you need more time than this, uhhhh wow -Config.FancyCokeAnims = true -- if you want multi location this needs to be false - -Config.Joblock = false -- if you want weed to be a job -Config.weedjob = "" -- what the job name is Config.Badtrip = 20 -- number means % chance to spawn a clone that chases and attacks while on mescaline -Config.MethHeist = false Config.SuccessfulChance = 90 --- this is the chance of a Success wholesale 1-100 Config.AlertPoliceWholesale = 90 -- 1-100 of how often it will alert police Config.WholesaleTimeout = 600 -- time in seconds to get to the location @@ -52,11 +47,11 @@ Config.minigametype = 'ox' -- look above for options or choose none if you dont --- Config.Drugs = { cocaine = true, - consumables =false, - crack = true, + consumables = true, cornerselling = true, + crack = true, + deliveries = true, heroin = true, - deliveries = false, lean = true, lsd = true, mescaline = true, @@ -64,6 +59,7 @@ Config.Drugs = { oxyruns = true, pharma = true, shrooms = true, + TravelingMerchant = true, weed = true, wholesale = false, xtc = true,