From fc8a6230675de54c1ba4d63ab8df9749cb44271e Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Thu, 22 Jan 2026 02:08:35 -0700 Subject: [PATCH] locales and wholesale --- client/crack.lua | 4 +- client/heroin.lua | 14 +- client/lean.lua | 4 +- client/wholesale.lua | 246 ++++++++++---------------- locales/en.json | 51 ++++-- server/cocaine.lua | 28 +-- server/cornerselling.lua | 12 +- server/crack.lua | 28 +-- server/functions.lua | 6 +- server/heroin.lua | 8 +- server/lean.lua | 37 +--- server/mescaline.lua | 2 +- server/plantSpawns.lua | 3 - server/wholesale.lua | 367 ++++++++++++++++++--------------------- shared/config.lua | 5 +- 15 files changed, 356 insertions(+), 459 deletions(-) diff --git a/client/crack.lua b/client/crack.lua index 2360d74..9bf9936 100644 --- a/client/crack.lua +++ b/client/crack.lua @@ -4,7 +4,7 @@ for k, v in pairs (locations.makecrack) do Bridge.Target.AddBoxZone('makeCrack'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, { { label = Bridge.Language.Locale('crack.targetMake'), - icon = 'fa-solid fa-temperature-high', + icon = Bridge.Language.Locale('crack.makeIcon'), action = function() if not itemCheck('baking_soda') then return end if not minigame() then @@ -26,7 +26,7 @@ for k, v in pairs (locations.bagcrack) do Bridge.Target.AddBoxZone('bagCrack'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, { { label = Bridge.Language.Locale('crack.targetBag'), - icon = 'fa-solid fa-weight-scale', + icon = Bridge.Language.Locale('crack.bagIcon'), action = function() if not itemCheck('empty_weed_bag') then return end if not progressbar(Bridge.Language.Locale('crack.bag')) then return end diff --git a/client/heroin.lua b/client/heroin.lua index ef94687..876db1c 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -9,7 +9,7 @@ local function createLabKit(coord, head) PlaceObjectOnGroundProperly(heroinlabkit) Bridge.Target.AddLocalEntity(heroinlabkit, { { - icon = "fa-solid fa-temperature-high", + icon = Bridge.Language.Locale('heroin.cookIcon'), label = Bridge.Language.Locale('heroin.targetCook'), action = function() if not itemCheck('empty_vial') then return end @@ -31,7 +31,7 @@ local function createLabKit(coord, head) end }, { - icon = "fas fa-box-circle-check", + icon = Bridge.Language.Locale('heroin.targetPickupIcon'), label = Bridge.Language.Locale('heroin.targetPickup'), action = function() if not progressbar(Bridge.Language.Locale('heroin.pbPickup')) then return end @@ -45,7 +45,7 @@ local function createLabKit(coord, head) end }, { - icon = "fa-solid fa-hand-sparkles", + icon = Bridge.Language.Locale('heroin.targetCleanIcon'), label = Bridge.Language.Locale('heroin.targetClean'), action = function() if not itemCheck('cleaningkit') then return end @@ -64,7 +64,7 @@ for k, v in pairs (locations.dryplant) do Bridge.Target.AddBoxZone('dryHeroin'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, { { label = Bridge.Language.Locale('heroin.targetDry'), - icon = 'fa-solid fa-temperature-high', + icon = Bridge.Language.Locale('heroin.dryIcon'), action = function() if not progressbar(Bridge.Language.Locale('heroin.pbDry')) then return end TriggerServerEvent("md-drugs:server:dryplant", k) @@ -80,7 +80,7 @@ for k, v in pairs (locations.cutheroinone) do Bridge.Target.AddBoxZone('cutHeroin'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, { { label = Bridge.Language.Locale('heroin.targetCutHeroin'), - icon = 'fa-solid fa-seedling', + icon = Bridge.Language.Locale('heroin.cutIcon'), action = function() if not itemCheck('baking_soda') then return end if not progressbar(Bridge.Language.Locale('heroin.pbCutHeroin')) then return end @@ -103,7 +103,7 @@ for k, v in pairs (locations.buyKit) do Bridge.Target.AddLocalEntity(peds[k], { { label = Bridge.Language.Locale('heroin.targetBuyKit'), - icon = 'fa-solid fa-box-open', + icon = Bridge.Language.Locale('heroin.buyIcon'), action = function() if not progressbar(Bridge.Language.Locale('heroin.pbBuyKit')) then return end TriggerServerEvent("md-drugs:server:getheroinlabkit", k) @@ -135,7 +135,7 @@ for k, v in pairs (locations.fillneedle) do Bridge.Target.AddBoxZone('fillNeedle'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, { { label = Bridge.Language.Locale('heroin.targetFill'), - icon = 'fa-solid fa-syringe', + icon = Bridge.Language.Locale('heroin.fillNeedleIcon'), action = function() if not minigame() then TriggerServerEvent("md-drugs:server:failheroin", k) return end if not progressbar(Bridge.Language.Locale('heroin.pbFill')) then return end diff --git a/client/lean.lua b/client/lean.lua index 5ec5c02..02141bd 100644 --- a/client/lean.lua +++ b/client/lean.lua @@ -50,7 +50,7 @@ local function SpawnCarPedChase(loc) Bridge.Target.AddLocalEntity(leanCar, { { name = 'leancar', - icon = 'fa-solid fa-car', + icon = Bridge.Language.Locale('lean.carIcon'), label = Bridge.Language.Locale('lean.stealFromTruck'), action = function() if not minigame() then return end @@ -74,7 +74,7 @@ for k, v in pairs (location.SyrupVendor) do Freeze(leanPeds[k], true, v.loc.w) Bridge.Target.AddLocalEntity(leanPeds[k], { { - icon = "fa-solid fa-hand-holding-medical", + icon = Bridge.Language.Locale('lean.startMission'), label = Bridge.Language.Locale('lean.startMission'), action = function() SpawnCarPedChase() diff --git a/client/wholesale.lua b/client/wholesale.lua index 8c57197..23b6ce3 100644 --- a/client/wholesale.lua +++ b/client/wholesale.lua @@ -1,152 +1,94 @@ ---local miss = false ---local settings = ps.callback('md-drugs:server:GetWSsettings') --- ---function SetUpPeds(drugCount) --- local attackerCount = settings.WholesaleAmbushBase --- if settings.WholesaleAmbushScale then --- if drugCount > settings.WholesaleAmbushTier1 then --- attackerCount = 3 --- end --- if drugCount > settings.WholesaleAmbushTier2 then --- attackerCount = 4 --- end --- if drugCount > settings.WholesaleAmbushTier3 then --- attackerCount = 5 --- end --- end --- local weaponTier = settings.WholesaleWeaponsTier1 --- if settings.WholesaleWeaponTiers then --- if drugCount > settings.WholesaleAmbushTier3 then --- weaponTier = settings.WholesaleWeaponsTier4 --- elseif drugCount > settings.WholesaleAmbushTier2 then --- weaponTier = settings.WholesaleWeaponsTier3 --- elseif drugCount > settings.WholesaleAmbushTier1 then --- weaponTier = settings.WholesaleWeaponsTier2 --- end --- end --- local playerPed = PlayerPedId() --- local playerCoords = GetEntityCoords(playerPed, false) --- local models = {"g_m_y_ballasout_01", "g_m_y_famdnf_01", "g_m_y_famca_01", "g_m_y_mexgoon_01", "g_m_y_salvagoon_01"} --- for i = 1, attackerCount do --- local angle = (360 / attackerCount) * i --- local x = playerCoords.x + math.cos(math.rad(angle)) * 15 --- local y = playerCoords.y + math.sin(math.rad(angle)) * 15 --- local z = playerCoords.z --- local modelHash = GetHashKey(models[math.random(1, #models)]) --- requestModel(modelHash) --- local ped = CreatePed(4, modelHash, x, y, z, 0.0, true, false) --- local weapon = weaponTier[math.random(1, #weaponTier)] --- SetPedRelationshipGroupHash(ped, GetHashKey("HATES_PLAYER")) --- SetPedCombatAttributes(ped, 46, true) --- SetPedCombatAttributes(ped, 0, true) --- SetPedCombatAttributes(ped, 5, true) --- SetPedCombatAttributes(ped, 2, true) --- local healthMultiplier = 1.0 --- if drugCount > settings.WholesaleAmbushTier3 then --- healthMultiplier = 1.5 --- elseif drugCount > settings.WholesaleAmbushTier2 then --- healthMultiplier = 1.3 --- elseif drugCount > settings.WholesaleAmbushTier1 then --- healthMultiplier = 1.2 --- end --- local baseHealth = GetEntityHealth(ped) --- SetEntityHealth(ped, math.floor(baseHealth * healthMultiplier)) --- GiveWeaponToPed(ped, GetHashKey(weapon), 500, false, true) --- TaskCombatPed(ped, playerPed, 0, 16) --- local blip = AddBlipForEntity(ped) --- SetBlipAsShortRange(blip, true) --- SetBlipColour(blip, 1) --- SetBlipScale(blip, 0.7) --- SetEntityAsNoLongerNeeded(ped) --- end --- local tierName = "Basic" --- if drugCount > settings.WholesaleAmbushTier3 then --- tierName = "Elite" --- elseif drugCount > settings.WholesaleAmbushTier2 then --- tierName = "Advanced" --- elseif drugCount > settings.WholesaleAmbushTier1 then --- tierName = "Medium" --- end --- Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.ambush'), attackerCount, tierName), 'error') ---end --- ---RegisterNetEvent("md-drugs:client:GetLocation", function(drug) --- if miss then --- SetNewWaypoint(drug.location.x, drug.location.y) --- else --- local loc = drug.location --- local timer = 0 --- miss = true --- SetNewWaypoint(loc.x, loc.y) --- if settings.WholesaleShowEstimates and drug.count > 0 then --- local bonusTiers = math.floor(drug.count / 10) --- local potentialBonus = math.min(bonusTiers * settings.WholesaleQuantityBonus, settings.WholesaleMaxBonus) --- local bonusPercent = math.floor(potentialBonus * 100) --- local minPayout = math.floor(drug.price.min * (1 + potentialBonus)) --- local maxPayout = math.floor(drug.price.max * (1 + potentialBonus)) --- local totalMinPayout = drug.count * minPayout --- local totalMaxPayout = drug.count * maxPayout --- Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.count'), drug.count), 'info') --- if bonusPercent > 0 then --- Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.bonus'), bonusPercent), 'info') --- end --- Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.estimate'), totalMinPayout, totalMaxPayout), 'info') --- elseif drug.count <= 0 then --- Bridge.Notify.SendNotify(Bridge.Language.Locale('wholesale.no_drugs'), 'error') --- end --- requestModel("g_m_y_famdnf_01", settings.RequestModelTime) --- local current = "g_m_y_famdnf_01" --- local drugdealer = CreatePed(0, current,loc.x,loc.y,loc.z-1, 90.0, false, false) --- FreezeEntityPosition(drugdealer, true) --- SetEntityInvincible(drugdealer, true) --- Bridge.Target.AddLocalEntity(drugdealer, {{ --- label = Bridge.Language.Locale('wholesale.targetBuyer'), --- icon = "fas fa-eye", --- action = function() --- local luck = math.random(1,100) --- if luck <= settings.SuccessfulChance then --- if not ps.progressbar(Bridge.Language.Locale('wholesale.wholesaling')) then return end --- TriggerServerEvent("md-drugs:server:SuccessSale", drug) --- else --- ps.progressbar("Deal Going Bad") --- if settings.WholesaleAmbushEnabled then --- SetUpPeds(drug.count) --- end --- if settings.WholesaleFailPoliceAlert > 0 then --- local alertChance = math.random(1, 100) --- if alertChance <= settings.WholesaleFailPoliceAlert then --- PoliceCall(100) --- end --- end --- TriggerServerEvent('md-drugs:server:CleanupWholesale') --- end --- Wait(3000) --- DeleteEntity(drugdealer) --- miss = false --- end --- }},drugdealer ) --- repeat --- Wait(1000) --- timer = timer + 1 --- until #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 or timer == settings.WholesaleTimeout + 1 --- PoliceCall(settings.AlertPoliceWholesale) --- if timer <= settings.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 then --- timer = 0 --- else --- Bridge.Notify.SendNotify(Bridge.Language.Locale('wholesale.tooLong'), 'error') --- DeleteEntity(drugdealer) --- TriggerServerEvent('md-drugs:server:CleanupWholesale') --- if settings.WholesaleResetOnTimeout then --- miss = false --- end --- end --- end ---end) --- ---RegisterNetEvent('md-drugs:client:WholesaleComplete', function(data) --- local bonusText = "" --- if data.bonus > 0 then --- bonusText = " (+" .. data.bonus .. "% quantity bonus)" --- end --- Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.complete'), data.quantity, data.payout, bonusText), 'success') ---end) \ No newline at end of file +local active = false +local active, ped, peds = false, nil, {} + +local function loop(wholesaleData) + local timeout = 600 -- 10 minutes + while active do + Wait(1000) + local dist = #(GetEntityCoords(PlayerPedId()) - vector3(wholesaleData.location.x, wholesaleData.location.y, wholesaleData.location.z)) + if dist < 100.0 then + if IsEntityDead(PlayerPedId()) then + active = false + Bridge.Point.Remove('md-drugs:wholesaleZone'..Bridge.Framework.GetPlayerIdentifier()) + TriggerServerEvent('md-drugs:server:getkilledFuckingNoob') + for k, v in pairs (peds) do + DeleteEntity(v) + end + peds = {} + break + end + end + timeout = timeout - 1 + if timeout <= 0 then + break + end + end +end + +function SetUpPeds(attackerCount, location) + local models = {"g_m_y_ballasout_01", "g_m_y_famdnf_01", "g_m_y_famca_01", "g_m_y_mexgoon_01", "g_m_y_salvagoon_01"} + for i = 1, attackerCount do + local angle = (360 / attackerCount) * i + local x = location.x + math.cos(math.rad(angle)) * 15 + local y = location.y + math.sin(math.rad(angle)) * 15 + local z = location.z + local modelHash = GetHashKey(models[math.random(1, #models)]) + requestModel(modelHash) + peds[#peds+1] = CreatePed(4, modelHash, x, y, z, 0.0, true, true) + local weapon = math.random(1, 2) == 1 and "WEAPON_PISTOL" or "WEAPON_BAT" + SetPedRelationshipGroupHash(peds[#peds], GetHashKey("HATES_PLAYER")) + SetPedCombatAttributes(peds[#peds], 46, true) + SetPedCombatAttributes(peds[#peds], 0, true) + SetPedCombatAttributes(peds[#peds], 5, true) + SetPedCombatAttributes(peds[#peds], 2, true) + GiveWeaponToPed(peds[#peds], GetHashKey(weapon), 500, false, true) + TaskCombatPed(peds[#peds], PlayerPedId(), 0, 16) + end +end + +RegisterNetEvent("md-drugs:client:GetLocation", function(wholesaleData) + if active then return end + if not wholesaleData then return end + active = true + SetNewWaypoint(wholesaleData.location.x, wholesaleData.location.y) + Bridge.Notify.SendNotify(Bridge.Language.Locale('wholesale.go_location'), 'success') + Bridge.Point.Register( + 'md-drugs:wholesaleZone'..Bridge.Framework.GetPlayerIdentifier(), + vector3(wholesaleData.location.x, wholesaleData.location.y, wholesaleData.location.z), + 50.0, + nil, + function(point, data) + if wholesaleData.ambush then + SetUpPeds(wholesaleData.attackerCount, wholesaleData.location) + loop(wholesaleData) + end + requestModel(GetHashKey("s_m_m_ammucountry")) + ped = CreatePed(4, GetHashKey("s_m_m_ammucountry"), wholesaleData.location.x, wholesaleData.location.y, wholesaleData.location.z, wholesaleData.location.w, false, true) + FreezeEntityPosition(ped, true) + TaskStartScenarioInPlace(ped, "WORLD_HUMAN_STAND_IMPATIENT", 0, true) + Bridge.Notify.SendNotify(Bridge.Language.Locale('wholesale.meet_dealer'), 'info') + Bridge.Target.AddLocalEntity(ped, { + { + label = Bridge.Language.Locale('wholesale.sell_drugs'), + icon = Bridge.Language.Locale('wholesale.sell_drugs_icon'), + action = function() + if not progressbar(Bridge.Language.Locale('wholesale.selling_drugs'), 15000) then return end + TriggerServerEvent('md-drugs:server:SuccessSale') + DeleteEntity(ped) + active = false + Bridge.Point.Remove('md-drugs:wholesaleZone'.. Bridge.Framework.GetPlayerIdentifier()) + end + } + }) + end, + function(point, data) + Bridge.Point.Remove('md-drugs:wholesaleZone'.. Bridge.Framework.GetPlayerIdentifier()) + return data + end) +end) + + +RegisterNetEvent('md-drugs:client:MarkLocation', function(data) + SetNewWaypoint(data.x, data.y) + Bridge.Notify.SendNotify(Bridge.Language.Locale('wholesale.go_location'), 'success') +end) \ No newline at end of file diff --git a/locales/en.json b/locales/en.json index 7256814..0482e1b 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1,6 +1,6 @@ { "Catches": { - "notIn": "You Are Not In The Correct Location", + "outOfRangeWarn": "Player: %s attempted to exploit Event: '%s' by triggering the event out of range.", "needItems": "You Do Not Have The Required Items", "notEnoughMoney": "Youre To Broke", "buySuccess": "You Bought %s %s For $%s", @@ -8,8 +8,9 @@ "itemNeeded": "You Need %s", "cooldown": "Slow Down Speed Racer", "invalidItem": "This Item Is Not Sold Here", - "onCooldownWarn": "%s Attempted To Run Event %s \n while on cooldown", - "noCops": "Not Enough Police Online" + "onCooldownWarn": "Player: %s Attempted To Run Event %s \n while on cooldown", + "noCops": "Not Enough Police Online", + "missedTable": "Player: %s attempted to exploit Event: '%s' by triggering the event without being in a server table" }, "coke": { @@ -54,9 +55,12 @@ "crack": { "targetMake": "Cook Some Crack", + "makeIcon": "fa-solid fa-temperature-high", "cook": "Cooking Crack", "targetBag": "Bag Crack", - "bag": "Bagging Crack" + "bagIcon": "fa-solid fa-weight-scale", + "bag": "Bagging Crack", + "breakdown": "Breaking Down Crack Even Further" }, "Deliveries": { @@ -87,21 +91,29 @@ "picking": "Picking Heroin", "targetCook": "Cook Heroin", "pbCook": "Cooking Up Heroin", + "cookIcon": "fa-solid fa-temperature-high", "targetPickup": "Pick Up Lab", + "targetPickupIcon": "fa-solid fa-box-circle-check", "pbPickup": "Picking Up Lab", "targetClean": "Clean Lab", + "targetCleanIcon": "fa-solid fa-broom", "pbClean": "Cleaning Lab", "targetDry": "Dry Out Plant", + "dryIcon": "fa-solid fa-temperature-high", "pbDry": "Drying Out Plant", "targetCutHeroin": "Cut Heroin", "pbCutHeroin": "Cutting Heroin", + "cutIcon": "fa-solid fa-mortal-pestle", "targetBuyKit": "Buy Heroin Lab Kit", + "buyIcon": "fa-solid fa-box-open", + "fillNeedleIcon": "fa-solid fa-syringe", "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", + "hasKitAlreadyPlaced": "You Already Have A Heroin Lab Kit Placed", "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" @@ -111,7 +123,15 @@ "stealFromTruck": "Steal From Truck", "startMission": "Start Lean Mission", "notOnRun": "You Are Not On A Lean Run", - "alreadyChasing": "You Are Already Chasing A Truck" + "alreadyChasing": "You Are Already Chasing A Truck", + "carIcon": "fa-solid fa-truck-fast", + "startMissionIcon": "fa-solid fa-hand-holding-medical", + "makingLean": "Making Lean", + "makeLeanMenuTitle": "Lean Creation", + "makeLeanMenuDesc": "Choose Your Ingredients", + "vehDoesntExist": "Player: %s attempted to exploit the lean event by triggering the event when the vehicle does not exist.", + "wrongVehModel": "Player: %s attempted to exploit the lean event by triggering the event in the wrong vehicle model.", + "maxTaken": "You Have Taken The Maximum Amount Of Lean From This Run" }, "lsd": { @@ -223,20 +243,13 @@ }, "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", - "count": "Quantity detected: %s", - "bonus": "Quantity bonus: +%s%%", - "estimate": "Estimated payout: $%s - $%s", - "no_drugs": "You do not have any of this drug to sell", - "ambush": "Ambush! %s attackers with %s weapons are approaching!", - "complete": "Sold %s items for $%s%s", - "min_quantity": "You must sell at least %s items to wholesale", - "deal_failed_cleanup": "Deal failed - you can try again" + "go_location": "Your Meeting Spot Has Been Marked On Your GPS", + "sell_drugs": "Hand Over Product", + "sell_drugs_icon": "fa-solid fa-handshake", + "selling_drugs": "Handing Over The Product", + "not_enough_police": "Not Enough Police Online To Start A Wholesale Deal", + "not_enough_drugs": "Wholesale Is Meant For Large Amounts Of Drugs", + "ambush_fail_warn": "Player: %s attempted to exploit the wholesale Sale event by triggering the event when they should be ambushed." }, "xtc": { diff --git a/server/cocaine.lua b/server/cocaine.lua index 7d48bad..a737f77 100644 --- a/server/cocaine.lua +++ b/server/cocaine.lua @@ -128,20 +128,26 @@ RegisterServerEvent('md-drugs:server:bagcoke', function(num) AddRep(src, 'coke', 1) end) -local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3} +local cokecut = { + loosecokestagetwo = {give = {loosecoke =2}, take = {loosecokestagetwo = 1, bakingsoda = 1}}, + loosecokestagethree = {give = {loosecokestagetwo = 3}, take = {loosecokestagethree = 1, bakingsoda = 1}}, +} for k, v in pairs (cokecut) do Bridge.Framework.RegisterUsableItem(k, function(source, item) local src = source - if not Bridge.Inventory.HasItem(src, 'bakingsoda') then - Bridge.Notify.SendNotify(src, Bridge.Language.Locale('coke.needBakingSoda'), 'error') - return - end - if Bridge.Inventory.HasItem(src,item.name) then - local check = Bridge.Callback.Trigger('md-drugs:client:uncuff', src, Bridge.Language.Locale('coke.cutCokeAgain')) - if not check then return end - if Bridge.Inventory.RemoveItem(src, k, 1) and Bridge.Inventory.RemoveItem(src, 'bakingsoda', 1) then - Bridge.Inventory.AddItem(src, 'loosecoke', v) + local can = true + for k, v in pairs (v.take) do + local count = Bridge.Inventory.GetItemCount(src, k) + if count < v then + can = false + break end - end + end + if not can then + return craft(src, v) + end + local progress = Bridge.Callback.Trigger("md-drugs:client:uncuff", src, Bridge.Language.Locale('coke.cutCokeAgain')) + if not progress then return end + craft(src, v) end) end \ No newline at end of file diff --git a/server/cornerselling.lua b/server/cornerselling.lua index 4fed47a..e5552c3 100644 --- a/server/cornerselling.lua +++ b/server/cornerselling.lua @@ -157,15 +157,6 @@ local function getDrugBack(source, item, amount) end end -local function getLoc(src, ped) - local coords, peds = GetEntityCoords(GetPlayerPed(src)), GetEntityCoords(ped) - local dist = #(coords - peds) - if dist < 5.0 then - return true - end - return false -end - Bridge.Callback.Register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, ped) local src = source local rep = getRep(source, 'cornerselling') @@ -284,8 +275,7 @@ end) RegisterCommand('cornersell', function(source, args, raw) local src = source - local jobCount = Bridge.Framework.GetPlayersByJob('police') - if #jobCount < cornsellConfig.policeRequired then + if #Bridge.Framework.GetPlayersByJob('police') < cornsellConfig.policeRequired then Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.noCops'), 'error') return end diff --git a/server/crack.lua b/server/crack.lua index b78313b..9b73173 100644 --- a/server/crack.lua +++ b/server/crack.lua @@ -81,21 +81,27 @@ RegisterServerEvent('md-drugs:server:bagcrack', function(num) end end) -local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3} +local cokecut = { + crackrockstagetwo = {give = {crackrock = 2}, take = {crackrockstagetwo = 1, bakingsoda = 1}}, + crackrockstagethree = { give = {crackrock = 3}, take = {crackrockstagethree = 1, bakingsoda = 1}}, +} for k, v in pairs (cokecut) do Bridge.Framework.RegisterUsableItem(k, function(source, item) local src = source - if not Bridge.Inventory.HasItem(src, 'bakingsoda') then - Bridge.Notify.SendNotify(src, Bridge.Language.Locale('coke.needBakingSoda'), 'error') - return - end - if Bridge.Inventory.HasItem(src,item.name) then - local check = Bridge.Callback.Trigger('md-drugs:client:uncuff', src, 'Cutting It Further') - if not check then return end - if Bridge.Inventory.RemoveItem(src, k, 1) and Bridge.Inventory.RemoveItem(src, 'bakingsoda', 1) then - Bridge.Inventory.AddItem(src, 'crackrock', v) + local can = true + for k, v in pairs (v.take) do + local count = Bridge.Inventory.GetItemCount(src, k) + if count < v then + can = false + break end - end + end + if not can then + return craft(src, v) + end + local progress = Bridge.Callback.Trigger("md-drugs:client:uncuff", src, Bridge.Language.Locale('crack.breakdown')) + if not progress then return end + craft(src, v) end) end diff --git a/server/functions.lua b/server/functions.lua index 715d6c4..53b2206 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -2,6 +2,7 @@ local timeOutPlayers = {} local playerRep = {} local playerWarnings = {} local trollExploiters = true + local function trollPlayer(src) if not trollExploiters then return end CreateThread(function() @@ -40,8 +41,7 @@ end function timeOut(src, event) if timeOutPlayers[src] then - local first, last = Bridge.Framework.GetPlayerName(src) - Bridge.Prints.Warn(Bridge.Language.Locale('Catches.onCooldownWarn', first .. ' ' .. last, event)) + Bridge.Prints.Warn(Bridge.Language.Locale('Catches.onCooldownWarn', Bridge.Framework.GetPlayerIdentifier(src), event)) playerWarnings[src] = (playerWarnings[src] or 0) + 1 if playerWarnings[src] >= 5 then trollPlayer(src) @@ -156,4 +156,4 @@ Bridge.Callback.Register('md-drugs:server:GetRep', function(source, cb, args) return rep end) --TODO: fix versioncheck -Bridge.Version.VersionChecker('Mustachedom/md-drugs/', false) \ No newline at end of file +Bridge.Version.VersionChecker('Mustachedom/md-drugs', false) \ No newline at end of file diff --git a/server/heroin.lua b/server/heroin.lua index 5735338..ff8e716 100644 --- a/server/heroin.lua +++ b/server/heroin.lua @@ -101,6 +101,7 @@ RegisterServerEvent('md-drugs:server:cutheroin', function(num) for item, tiers in pairs (itemList) do if Bridge.Inventory.HasItem(src, item) then tier = tiers + break end end end @@ -167,7 +168,6 @@ Bridge.Framework.RegisterUsableItem('heroinlabkit', function(source, item) if Bridge.Inventory.RemoveItem(src, 'heroinlabkit', 1) then heroinLabKits[src] = { src = src, - ownerid = Bridge.Framework.GetPlayerIdentifier(src), coords = loc, } Bridge.Notify.SendNotify(src, Bridge.Language.Locale('heroin.placedKit'), "success") @@ -181,11 +181,10 @@ RegisterServerEvent('md-drugs:server:heatliquidheroin', function() if timeOut(src, 'md-drugs:server:heatliquidheroin') then return end if not heroinLabKits[src] then - Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error') + Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.missedTable', Bridge.Framework.GetPlayerIdentifier(src), 'md-drugs:server:heatliquidheroin'), 'error') return end - if not Bridge.Inventory.HasItem(src, 'emptyvial', 1) then return end local tier = 'tier1' if Config.TierSystem then local itemList = { @@ -209,8 +208,7 @@ RegisterServerEvent('md-drugs:server:failheatingheroin', function() local src = source if not heroinLabKits[src] then - Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error') - return + Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.missedTable', Bridge.Framework.GetPlayerIdentifier(src), 'md-drugs:server:failheatingheroin'), 'error') end local itemList = { diff --git a/server/lean.lua b/server/lean.lua index 6818eaa..ff4bf58 100644 --- a/server/lean.lua +++ b/server/lean.lua @@ -60,13 +60,15 @@ RegisterServerEvent('md-drugs:server:givelean', function() end local veh = onRun[src].vehicle if not veh or veh == 0 then + Bridge.Prints.Warn(src, Bridge.Language.Locale('lean.vehDoesntExist', Bridge.Framework.GetPlayerIdentifier(src)), 'error') return end if GetEntityModel(veh) ~= GetHashKey('pounder') then + Bridge.Prints.Warn(src, Bridge.Language.Locale('lean.wrongVehModel', Bridge.Framework.GetPlayerIdentifier(src)), 'error') return end local pcoords, vcoords = GetEntityCoords(GetPlayerPed(src)), GetEntityCoords(veh) - if #(pcoords - vcoords) > 10.0 then + if not checkDistance(src, vcoords, 5.0, 'md-drugs:server:givelean') then return end onRun[src].taken = onRun[src].taken + 1 @@ -80,37 +82,6 @@ RegisterServerEvent('md-drugs:server:givelean', function() end end) -exports.ps_lib:registerCrafter({ - loc = Locations.Lean.MakeLean, - recipes = { - cupoflean = { - amount = 1, - time = 5000, - anim = 'uncuff', - recipe = { - leancup = 1, - mdlean = 1, - sprunk = 1 - } - }, - cupofdextro = { - amount = 1, - time = 5000, - anim = 'uncuff', - recipe = { - leancup = 1, - mdreddextro = 1, - sprunk = 1 - } - } - }, - targetData = { - size = {height = 1.0, width = 1.0, length = 1.0, rotation = 180.0}, - label = 'Make Lean', - icon = 'fa-solid fa-mug-saucer', - }, -}) - Bridge.Callback.Register('md-drugs:server:registerLean', function(source, loc, vehicleNetId) local src = source if onRun[src] then @@ -120,10 +91,12 @@ Bridge.Callback.Register('md-drugs:server:registerLean', function(source, loc, v return false end if not vehicleNetId then + Bridge.Prints.Warn(src, Bridge.Language.Locale('lean.vehDoesntExist', Bridge.Framework.GetPlayerIdentifier(src)), 'error') return false end local veh = NetworkGetEntityFromNetworkId(vehicleNetId) if not veh or veh == 0 or GetEntityModel(veh) ~= GetHashKey('pounder') then + Bridge.Prints.Warn(src, Bridge.Language.Locale('lean.wrongVehModel', Bridge.Framework.GetPlayerIdentifier(src)), 'error') return false end diff --git a/server/mescaline.lua b/server/mescaline.lua index 3da8700..3e96234 100644 --- a/server/mescaline.lua +++ b/server/mescaline.lua @@ -1,4 +1,4 @@ -Recipes, locations = Recipes or {}, locations or {} +Recipes, Locations = Recipes or {}, Locations or {} Locations.Mescaline = { DryOutMescaline = { -- where to dry out your mescaline diff --git a/server/plantSpawns.lua b/server/plantSpawns.lua index 9419fe1..636dad1 100644 --- a/server/plantSpawns.lua +++ b/server/plantSpawns.lua @@ -227,9 +227,6 @@ for k, v in pairs (plantData) do v.coolDown(loc) v.itemGive(src) end - else - Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), 'error') - return end end) ::continue:: diff --git a/server/wholesale.lua b/server/wholesale.lua index 76274b8..9709cdb 100644 --- a/server/wholesale.lua +++ b/server/wholesale.lua @@ -1,197 +1,170 @@ --- ---local burners = { --- cokeburner = { "cokebaggy", "cokebaggystagethree", "cokebaggystagetwo"}, --- crackburner = {"baggedcracked", "baggedcrackedstagetwo", "baggedcrackedstagethree"}, --- lsdburner = {'smiley_tabs', 'yinyang_tabs', 'wildcherry_tabs', 'pineapple_tabs', 'bart_tabs', 'gratefuldead_tabs'}, --- heroinburner = {'heroin_ready', 'heroin_readystagetwo', 'heroin_readystagethree'}, --- xtcburner = {"white_playboys", "white_playboys2", "white_playboys3", "white_playboys4", "blue_playboys", "blue_playboys2", "blue_playboys3", "blue_playboys4", "red_playboys", "red_playboys2", "red_playboys3", "red_playboys4", "orange_playboys", "orange_playboy2s", "orange_playboys3", "orange_playboys4", "white_aliens", "white_aliens2", "white_aliens3", "white_aliens4", "blue_aliens", "blue_aliens2", "blue_aliens3", "blue_aliens4", "red_aliens", "red_aliens3", "red_aliens2", "red_aliens4", "orange_aliens", "orange_aliens2", "orange_aliens3", "orange_aliens4", "white_pl", "white_pl2", "white_pl3", "white_pl4", "blue_pl", "blue_pl2", "blue_pl3", "blue_pl4", "red_pl", "red_pl2", "red_pl3", "red_pl4", "orange_pl", "orange_pl2", "orange_pl3", "orange_pl4", "white_trolls", "white_trolls2", "white_trolls3", "white_trolls4", "blue_trolls", "blue_trolls2", "blue_trolls3", "blue_trolls4", "red_trolls", "red_trolls2", "red_trolls3", "red_trolls4", "orange_trolls", "orange_trolls2", "orange_trolls3", "orange_trolls4", "white_cats2", "white_cats3", "white_cats4", "white_cats", "blue_cats", "blue_cats3", "blue_cats2", "blue_cats4", "red_cats", "red_cats2", "red_cats3", "red_cats4", "orange_cats", "orange_cats2", "orange_cats3", "orange_cats4" }, --- methburner = {'methbaggy'}, ---} ---local active = {} ---local settings = {} --- ---settings.WholesaleQuantityBonus = 0.05 -- 5% bonus per 10 units sold (up to 20%) ---settings.WholesaleMaxBonus = 0.20 -- Maximum 20% bonus ---settings.WholesaleMinQuantity = 1 -- Minimum quantity required for wholesale ---settings.WholesaleAmbushEnabled = true -- Enable or disable ambush on failed deals ---settings.WholesaleAmbushBase = 2 -- Base number of attackers on failed deals ---settings.WholesaleAmbushScale = true -- Scale number of attackers based on drug quantity ---settings.WholesaleAmbushTier1 = 10 -- Drug quantity threshold for 3 attackers ---settings.WholesaleAmbushTier2 = 20 -- Drug quantity threshold for 4 attackers ---settings.WholesaleAmbushTier3 = 30 -- Drug quantity threshold for 5 attackers ---settings.WholesaleWeaponTiers = true -- Scale weapon difficulty based on drug quantity ---settings.WholesaleWeaponsTier1 = { -- Basic weapons (default) --- "WEAPON_PISTOL", --- "WEAPON_BAT", --- "WEAPON_KNIFE", --- "WEAPON_MACHETE" ---} ---settings.WholesaleWeaponsTier2 = { -- Medium weapons (10+ drugs) --- "WEAPON_COMBATPISTOL", --- "WEAPON_MICROSMG", --- "WEAPON_SAWNOFFSHOTGUN", --- "WEAPON_CROWBAR" ---} ---settings.WholesaleWeaponsTier3 = { -- Advanced weapons (20+ drugs) --- "WEAPON_APPISTOL", --- "WEAPON_SMG", --- "WEAPON_PUMPSHOTGUN", --- "WEAPON_CARBINERIFLE" ---} ---settings.WholesaleWeaponsTier4 = { -- Elite weapons (30+ drugs) --- "WEAPON_HEAVYPISTOL", --- "WEAPON_ASSAULTSMG", --- "WEAPON_ASSAULTSHOTGUN", --- "WEAPON_SPECIALCARBINE" ---} ---settings.WholesaleShowEstimates = true -- Show estimated value before deal ---settings.WholesaleFailPoliceAlert = 75 -- Chance to alert police on failed deals (0-100) ---settings.WholesaleResetOnTimeout = true -- Reset wholesale flag when buyer times out ---settings.SuccessfulChance = 90 --- this is the chance of a Success wholesale 1-100 ---settings.AlertPoliceWholesale = 90 -- 1-100 of how often it will alert police ---settings.WholesaleTimeout = 600 -- time in seconds to get to the location ---settings.PoliceCount = 0 --- ---local Price = { --- cokeburner = { --- min = 25, --- max = 50 --- }, --- crackburner = { --- min = 25, --- max = 50 --- }, --- lsdburner = { --- min = 25, --- max = 50 --- }, --- heroinburner = { --- min = 25, --- max = 50 --- }, --- xtcburner = { --- min = 25, --- max = 50 --- }, --- methburner = { --- min = 25, --- max = 50 --- } ---} ---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), ---} --- ---ps.registerCallback('md-drugs:server:GetWSsettings', function(source) --- return settings ---end) --- ---function getRandW(source) --- local rand = math.random(1, #locs) --- return locs[rand] ---end --- ---for k, v in pairs (burners) do --- ps.createUseable(k, function(source, item) --- if active[ps.getIdentifier(source)] then --- TriggerClientEvent("md-drugs:client:GetLocation", active[ps.getIdentifier(source)].src, active[ps.getIdentifier(source)]) --- return --- end --- if ps.getJobTypeCount('leo') < settings.PoliceCount then return Bridge.Notify.SendNotify(source, Bridge.Language.Locale('wholesale.notEnoughCops'), 'error') end --- if ps.removeItem(source, k, 1) then --- local drugs, count = {}, 0 --- for m, d in pairs (v) do --- local amt = ps.getItemCount(source, d) or 0 --- if amt > 0 then --- drugs[d] = (drugs[d] or 0) + amt --- count = count + amt --- end --- end --- if count < settings.WholesaleMinQuantity then --- ps.addItem(source, k, 1) --- Bridge.Notify.SendNotify(source, Bridge.Language.Locale('wholesale.not_enough_drugs') or 'Not enough drugs for wholesale deal', 'error') --- return --- end --- active[ps.getIdentifier(source)] = { --- src = source, --- item = k, --- location = getRandW(source), --- price = Price[k], --- count = count, --- drugs = drugs --- } --- TriggerClientEvent("md-drugs:client:GetLocation", active[ps.getIdentifier(source)].src, active[ps.getIdentifier(source)]) --- end --- end) ---end --- ---local function getBonus(quantity) --- local bonus = math.floor(quantity / 10) * settings.WholesaleQuantityBonus --- if bonus > settings.WholesaleMaxBonus then --- bonus = settings.WholesaleMaxBonus --- end --- return bonus ---end ---RegisterNetEvent('md-drugs:server:SuccessSale', function() --- local src = source --- local id = ps.getIdentifier(source) --- --- if not active[id] then --- return --- end --- local deal = active[id] --- if deal.count < settings.WholesaleMinQuantity then --- Bridge.Notify.SendNotify(src, 'Not enough drugs for wholesale deal', 'error') --- active[id] = nil --- return --- end --- local basePrice = math.floor(((deal.price.min + deal.price.max) / 2) * deal.count) --- local bonus = getBonus(deal.count) --- local finalPrice = math.floor(basePrice + (basePrice * bonus)) --- local need, have = 0,0 --- for k, v in pairs (deal.drugs) do --- need = need + 1 --- if ps.hasItem(src, k, v) then --- have = have + 1 --- end --- end --- if need ~= have then --- Bridge.Notify.SendNotify(src, 'You are missing some drugs for the deal', 'error') --- active[id] = nil --- return --- end --- local removed = true --- for k, v in pairs (deal.drugs) do --- if not ps.removeItem(src, k, v) then --- removed = false --- break --- end --- end --- if not removed then --- Bridge.Notify.SendNotify(src,'Failed to remove drugs for the deal', 'error') --- active[id] = nil --- return --- end --- ps.addMoney(src, 'cash', finalPrice, 'Wholesale sale successful' .. ' $' .. finalPrice) --- Bridge.Notify.SendNotify(src, 'Wholesale sale successful' .. ' $' .. finalPrice, 'success') --- active[id] = nil ---end) --- ---RegisterNetEvent('md-drugs:server:CleanupWholesale', function() --- local src = source --- local id = ps.getIdentifier(source) --- if active[id] then --- active[id] = nil --- end ---end) \ No newline at end of file + +local burners = { + cokeburner = { "cokebaggy", "cokebaggystagethree", "cokebaggystagetwo"}, + crackburner = {"baggedcracked", "baggedcrackedstagetwo", "baggedcrackedstagethree"}, + lsdburner = {'smiley_tabs', 'yinyang_tabs', 'wildcherry_tabs', 'pineapple_tabs', 'bart_tabs', 'gratefuldead_tabs'}, + heroinburner = {'heroin_ready', 'heroin_readystagetwo', 'heroin_readystagethree'}, + xtcburner = {"white_playboys", "white_playboys2", "white_playboys3", "white_playboys4", "blue_playboys", "blue_playboys2", "blue_playboys3", "blue_playboys4", "red_playboys", "red_playboys2", "red_playboys3", "red_playboys4", "orange_playboys", "orange_playboy2s", "orange_playboys3", "orange_playboys4", "white_aliens", "white_aliens2", "white_aliens3", "white_aliens4", "blue_aliens", "blue_aliens2", "blue_aliens3", "blue_aliens4", "red_aliens", "red_aliens3", "red_aliens2", "red_aliens4", "orange_aliens", "orange_aliens2", "orange_aliens3", "orange_aliens4", "white_pl", "white_pl2", "white_pl3", "white_pl4", "blue_pl", "blue_pl2", "blue_pl3", "blue_pl4", "red_pl", "red_pl2", "red_pl3", "red_pl4", "orange_pl", "orange_pl2", "orange_pl3", "orange_pl4", "white_trolls", "white_trolls2", "white_trolls3", "white_trolls4", "blue_trolls", "blue_trolls2", "blue_trolls3", "blue_trolls4", "red_trolls", "red_trolls2", "red_trolls3", "red_trolls4", "orange_trolls", "orange_trolls2", "orange_trolls3", "orange_trolls4", "white_cats2", "white_cats3", "white_cats4", "white_cats", "blue_cats", "blue_cats3", "blue_cats2", "blue_cats4", "red_cats", "red_cats2", "red_cats3", "red_cats4", "orange_cats", "orange_cats2", "orange_cats3", "orange_cats4" }, + methburner = {'methbaggy'}, +} +local active = {} +local settings = {} + +settings.WholesaleQuantityBonus = 0.05 -- 5% bonus per 10 units sold (up to 20%) +settings.WholesaleMaxBonus = 0.20 -- Maximum 20% bonus +settings.WholesaleMinQuantity = 5 -- Minimum quantity required for wholesale +settings.WholesaleAmbushEnabled = true -- Enable or disable ambush on failed deals +settings.WholesaleAmbushBase = 2 -- Base number of attackers on failed deals +settings.WholesaleAmbushScale = true -- Scale number of attackers based on drug quantity +settings.WholesaleAmbushTier1 = 10 -- Drug quantity threshold for 3 attackers +settings.WholesaleAmbushTier2 = 20 -- Drug quantity threshold for 4 attackers +settings.WholesaleAmbushTier3 = 30 -- Drug quantity threshold for 5 attackers +settings.FailChance = 20 -- Percentage chance of ambush occurring on a failed deal +settings.PoliceCount = 0 -- Minimum police required to initiate a wholesale deal +local Price = { + cokeburner = { + min = 25, + max = 50 + }, + crackburner = { + min = 25, + max = 50 + }, + lsdburner = { + min = 25, + max = 50 + }, + heroinburner = { + min = 25, + max = 50 + }, + xtcburner = { + min = 25, + max = 50 + }, + methburner = { + min = 25, + max = 50 + } +} + +settings.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), +} +Locations = Locations or {} + + +GlobalState.MDDrugsLocations.Wholesale = settings + +for k, v in pairs (burners) do + Bridge.Framework.RegisterUsableItem(k, function(source, item) + local src = source + if active[source] then + TriggerClientEvent("md-drugs:client:MarkLocation", src, active[source].location) + return + end + if #Bridge.Framework.GetPlayersByJob('police') < settings.PoliceCount then + return Bridge.Notify.SendNotify(source, Bridge.Language.Locale('wholesale.not_enough_police'), 'error') + end + local itemCount, itemList = 0, {} + for m, d in pairs (v) do + local amt = Bridge.Inventory.GetItemCount(source, d) or 0 + if amt > 0 then + itemCount = itemCount + amt + itemList[d] = amt + end + end + if itemCount < settings.WholesaleMinQuantity then + return Bridge.Notify.SendNotify(source, Bridge.Language.Locale('wholesale.not_enough_drugs'), 'error') + end + + if Bridge.Inventory.RemoveItem(src, k, 1) then + active[src] = { + count = itemCount, + itemList = itemList, + location = settings.Locs[math.random(1, #settings.Locs)], + price = math.random(Price[k].min, Price[k].max), + drugType = k, + ambush = math.random(1, 100) <= settings.FailChance and true or false, + } + if active[src].ambush and settings.WholesaleAmbushEnabled then + active[src].attackerCount = settings.WholesaleAmbushBase + if settings.WholesaleAmbushScale then + if active[src].count > settings.WholesaleAmbushTier1 then + active[src].attackerCount = active[src].attackerCount + 1 + end + if active[src].count > settings.WholesaleAmbushTier2 then + active[src].attackerCount = active[src].attackerCount + 1 + end + if active[src].count > settings.WholesaleAmbushTier3 then + active[src].attackerCount = active[src].attackerCount + 1 + end + end + else + active[src].attackerCount = 0 + end + TriggerClientEvent("md-drugs:client:GetLocation", src, active[src]) + end + end) +end + +RegisterNetEvent('md-drugs:server:SuccessSale', function(entity) + local src = source + if not active[src] then + return + end + if active[src].ambush then + Bridge.Prints.Warn(Bridge.Language.Locale('wholesale.ambush_fail_warn', Bridge.Framework.GetPlayerIdentifier(src))) + return + end + if not checkDistance(src, active[src].location, 5.0, 'md-drugs:server:SuccessSale') then + return + end + local basePrice = active[src].price * active[src].count + local bonusMultiplier = math.min(math.floor(active[src].count / 10) * settings.WholesaleQuantityBonus, settings.WholesaleMaxBonus) + local totalPrice = math.floor(basePrice * (1 + bonusMultiplier)) + for k, v in pairs (active[src].itemList) do + local has = Bridge.Inventory.GetItemCount(src, k) or 0 + if has < v then + return + end + end + for k, v in pairs (active[src].itemList) do + if not Bridge.Inventory.RemoveItem(src, k, v) then + return + end + end + Bridge.Framework.AddAccountBalance(src, 'cash', totalPrice) +end) + +RegisterNetEvent('md-drugs:server:CleanupWholesale', function() + local src = source + if active[src] then + active[src] = nil + end +end) + +RegisterNetEvent('md-drugs:server:getkilledFuckingNoob', function() + local src = source + if not active[src] then + return + end + for k, v in pairs (active[src].itemList) do + local has = Bridge.Inventory.GetItemCount(src, k) or 0 + if has > 0 then + Bridge.Inventory.RemoveItem(src, k, has) + end + end + active[src] = nil +end) \ No newline at end of file diff --git a/shared/config.lua b/shared/config.lua index 6e2d4d7..2ae4c52 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -1,10 +1,7 @@ Config = {} --Ignore. Bridge = exports.community_bridge:Bridge() -ps = exports.ps_lib:init() --Ignore. -ps.loadLangs("en") -- set your language -Config.Fuel = "LegacyFuel" -- type the name of script you use i.e. ps-fuel, cdn-fuel, LegacyFuel, ox_fuel Config.TierSystem = true -- allows for three tiers of certain drugs ( coke, heroin, crack, lsd) Config.Emotes = 'rp' -- rp, dp, scully, custom ----------------------------------- TierSystem levels ** ONLY IN USE IF CONFIG.TIERSYTEM IS TRUE @@ -32,11 +29,13 @@ Config.Minigames = { glmath = {timeLimit = 300000}, } Config.minigametype = 'ps_circle' -- look above for options or choose none if you dont want any minigames + Config.DefaultAnimation = { dict = "mp_arresting", clip = "a_uncuff", flag = 49, } + Config.ProgressBar = { Disables = { move = true, -- Disable movement