- finish rewrite of deliveries

This commit is contained in:
Mustache Dom committed 2026-01-23 23:40:20 -07:00
1 parent a975406031
commit addce12081
5 files changed
+330 -375

No files matched your search

+85 -90
View File
@@ -1,90 +1,85 @@
----TODO: Make dealers better
--local isActive = false local dealer = {}
--local dealer = {} local buyer = nil
--local function SpawnDealer()
-- if #dealer >= 1 then repeat
-- for k,v in pairs (dealer) do Wait(100)
-- DeletePed(v) until GlobalState.MDDrugsLocations.Deliveries.dealers ~= nil
-- end
-- dealer = {} local function SpawnDealer()
-- end if #dealer >= 1 then
-- for k,v in pairs(GlobalState.MDDrugsLocations.Dealers) do for k,v in pairs (dealer) do
-- local Ped = "g_m_y_famdnf_01" DeletePed(v)
-- requestModel(Ped, 30000) end
-- local loc = json.decode(v.coords) dealer = {}
-- dealer[k] = CreatePed(0, Ped,loc.x,loc.y, loc.z-1, loc.h, false, false) end
-- Freeze(dealer[k], true, loc.h) for k,v in pairs(GlobalState.MDDrugsLocations.Deliveries.dealers) do
-- Bridge.Target.AddLocalEntity(dealer[k], { requestModel(v.model)
-- { dealer[k] = CreatePed(0, v.model, v.coords.x, v.coords.y, v.coords.z-1, v.coords.w, false, false)
-- icon = 'fas fa-user-secret', Freeze(dealer[k], true, v.coords.w)
-- label = Bridge.Language.Locale('Deliveries.targetGetDel'), Bridge.Target.AddLocalEntity(dealer[k], {
-- action = function() {
-- local data = Bridge.Callback.Trigger('md-drugs:server:GetDeliveryItem', k) icon = Bridge.Language.Locale('Deliveries.targetGetDelIcon'),
-- if type(data) == 'table' and data.coords then label = Bridge.Language.Locale('Deliveries.targetGetDel'),
-- TriggerEvent('md-drugs:client:setLocation', data) action = function()
-- end TriggerServerEvent('md-drugs:server:requestDelivery', k)
-- end, end,
-- }, },
-- { {
-- icon = "fa-solid fa-store", icon = Bridge.Language.Locale('Deliveries.targetOpenShopIcon'),
-- label = Bridge.Language.Locale('Deliveries.targetOpenShop'), label = Bridge.Language.Locale('Deliveries.targetOpenShop'),
-- action = function() action = function()
-- local rep = GetRep() local rep = GetRep()
-- local items = Bridge.Callback.Trigger('md-drugs:server:dealerList', k) local options = {}
-- local options = {} for m, d in pairs (GlobalState.MDDrugsRecipes.Deliveries) do
-- for m, d in pairs (items) do if rep.dealerrep >= d.minrep then
-- if rep.dealerrep >= d.minrep then options[#options+1] = {
-- options[#options+1] = { title = Bridge.Inventory.GetItemInfo(d.name).label,
-- title = Bridge.Inventory.GetItemInfo(d.name).label, description = '$' .. d.price,
-- description = '$' .. d.price, icon = Bridge.Inventory.GetItemInfo(d.name).image,
-- icon = Bridge.Inventory.GetItemInfo(d.name).image, onSelect = function()
-- onSelect = function() TriggerServerEvent('md-drugs:server:buyItemDealer', m, k)
-- TriggerServerEvent('md-drugs:server:buyItemDealer', m, k) end,
-- end, }
-- } end
-- end end
-- end Bridge.Menu.Open({
-- Bridge.Menu.Open({ id = 'DealerMenu',
-- id = 'DealerMenu', title = Bridge.Language.Locale('Deliveries.shopHeader'),
-- title = Bridge.Language.Locale('Deliveries.shopHeader'), description = Bridge.Language.Locale('Deliveries.shopHeader'),
-- description = Bridge.Language.Locale('Deliveries.shopHeader'), options = options
-- options = options })
-- }) end,
-- end, }
-- } })
-- }) end
-- end end
--end
-- SpawnDealer()
--RegisterNetEvent('md-drugs:client:RefreshDealers', function()
-- SpawnDealer() RegisterNetEvent('md-drugs:client:RefreshDealers', function()
--end) SpawnDealer()
-- end)
--SpawnDealer()
-- RegisterNetEvent('md-drugs:client:setLocation', function(data)
--RegisterNetEvent('md-drugs:client:setLocation', function(data) if buyer then
-- local coord = json.decode(data.coords) DeletePed(buyer)
-- SetNewWaypoint(coord.x, coord.y) end
-- if isActive then return end local coord = data.coords
-- isActive = true SetNewWaypoint(coord.x, coord.y)
-- local Buyer = CreatePed(0, "g_m_y_famdnf_01",coord.x, coord.y, coord.z-1, coord.w, false, false) requestModel("g_m_y_famdnf_01")
-- Freeze(Buyer, true, coord.w) buyer = CreatePed(0, "g_m_y_famdnf_01",coord.x, coord.y, coord.z-1, coord.w, false, false)
-- Bridge.Target.AddLocalEntity(Buyer, { Freeze(buyer, true, coord.w)
-- { Bridge.Target.AddLocalEntity(buyer , {
-- icon = 'fas fa-user-secret', {
-- label = Bridge.Language.Locale('Deliveries.targetHandOff'), icon = Bridge.Language.Locale('Deliveries.targetHandOffIcon'),
-- action = function() label = Bridge.Language.Locale('Deliveries.targetHandOff'),
-- if not progressbar(Bridge.Language.Locale('Deliveries.delivering')) then return end action = function()
-- isActive = false if not progressbar(Bridge.Language.Locale('Deliveries.delivering')) then return end
-- DeletePed(Buyer) TriggerServerEvent('md-drugs:server:giveDeliveryItems')
-- TriggerServerEvent('md-drugs:server:giveDeliveryItems', data.item, data.amount) Wait(400)
-- end, DeletePed(buyer)
-- canInteract = function() end,
-- if isActive then }
-- return true })
-- end end)
-- end
-- }
-- })
--end)
--
+7 -14
View File
@@ -60,25 +60,18 @@
"Deliveries": { "Deliveries": {
"targetGetDel": "Get Delivery Mission", "targetGetDel": "Get Delivery Mission",
"targetGetDelIcon": "fas fa-user-secret",
"targetOpenShop": "Open Dealer Shop", "targetOpenShop": "Open Dealer Shop",
"targetOpenShopIcon": "fas fa-store",
"shopHeader": "Dealer Shop", "shopHeader": "Dealer Shop",
"targetHandOff": "Hand Off Delivery", "targetHandOff": "Hand Off Delivery",
"targetHandOffIcon": "fa-solid fa-box-open",
"delivering": "Handing The Package To Drug Dealer", "delivering": "Handing The Package To Drug Dealer",
"itemDoesntExist": "Player: %s attempted to exploit the deliveries shop event by trying to purchase an item that does not exist in the deliveries shop: %s",
"alreadyDelivering": "You Are Already Delivering A Package", "alreadyDelivering": "You Are Already Delivering A Package",
"slowAf": "You Took To Long!", "slowAf": "You Took To Long And Now The Customer Cancelled You Fucking Turtle!",
"newDealerHelp": { "deliveryFailed": "Dude, You Didnt Even Bring The Drugs I Asked For!",
"help": "Place A Dealer", "delivery_success": "You Successfully Delivered The Package!"
"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"
}, },
"heroin": { "heroin": {
+8 -9
View File
@@ -1,9 +1,10 @@
CREATE TABLE IF NOT EXISTS `dealers` ( DROP TABLE IF EXISTS `dealers`;
CREATE TABLE `dealers` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '0', `coords` text DEFAULT NULL,
`coords` longtext DEFAULT NULL,
`time` longtext DEFAULT NULL,
`createdby` varchar(50) NOT NULL DEFAULT '0', `createdby` varchar(50) NOT NULL DEFAULT '0',
`model` text DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
@@ -12,12 +13,10 @@ CREATE TABLE IF NOT EXISTS `deliveriesdealer` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`cid` varchar(50) NOT NULL, `cid` varchar(50) NOT NULL,
`itemdata` varchar(50) NOT NULL, `itemdata` varchar(50) NOT NULL,
`timestart` varchar(50) NOT NULL, `maxtime` int(11) NOT NULL DEFAULT 0,
`timestop` varchar(50) DEFAULT NULL,
`maxtime` varchar(50) NOT NULL,
`location` varchar(255) DEFAULT NULL, `location` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
CREATE TABLE IF NOT EXISTS `drugrep` ( CREATE TABLE IF NOT EXISTS `drugrep` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
@@ -25,4 +24,4 @@ CREATE TABLE IF NOT EXISTS `drugrep` (
`drugrep` varchar(255) DEFAULT NULL, `drugrep` varchar(255) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL, `name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
+229 -261
View File
@@ -1,261 +1,229 @@
--Locations = Locations or {} Locations, Recipes = Locations or {}, Recipes or {}
--
--local dloc = { Locations.Deliveries = {
-- {coords = vector4(282.48, -1814.32, 27.23, 145.11)}, dropOff = {
-- {coords = vector4(-296.11, -1300.65, 31.31, 270.87)}, {coords = vector4(282.48, -1814.32, 27.23, 145.11)},
-- {coords = vector4(-36.64, -1492.04, 31.22, 151.91)}, {coords = vector4(-296.11, -1300.65, 31.31, 270.87)},
-- {coords = vector4(282.48, -1814.32, 27.23, 232.19)}, {coords = vector4(-36.64, -1492.04, 31.22, 151.91)},
-- {coords = vector4(54.54, -1873.22, 22.81, 131.47)}, {coords = vector4(282.48, -1814.32, 27.23, 232.19)},
-- {coords = vector4(-269.34, -2437.25, 6.40, 252.67)}, {coords = vector4(54.54, -1873.22, 22.81, 131.47)},
-- {coords = vector4(269.19, -3248.55, 5.79, 252.67)}, {coords = vector4(-269.34, -2437.25, 6.40, 252.67)},
-- {coords = vector4(632.94, -3015.44, 7.34, 3.44)}, {coords = vector4(269.19, -3248.55, 5.79, 252.67)},
-- {coords = vector4(1049.55, -2427.88, 30.30, 79.52)}, {coords = vector4(632.94, -3015.44, 7.34, 3.44)},
-- {coords = vector4(853.16, -2207.32, 30.68, 284.88)}, {coords = vector4(1049.55, -2427.88, 30.30, 79.52)},
-- {coords = vector4(903.10, -1721.98, 32.25, 168.71)}, {coords = vector4(853.16, -2207.32, 30.68, 284.88)},
-- {coords = vector4(1289.30, -1710.49, 55.48, 208.57)}, {coords = vector4(903.10, -1721.98, 32.25, 168.71)},
-- {coords = vector4(1412.01, -1490.53, 60.66, 132.46)}, {coords = vector4(1289.30, -1710.49, 55.48, 208.57)},
-- {coords = vector4(734.26, -1311.26, 27.01, 102.99)}, {coords = vector4(1412.01, -1490.53, 60.66, 132.46)},
-- {coords = vector4(1231.60, -1083.06, 38.53, 102.99)}, {coords = vector4(734.26, -1311.26, 27.01, 102.99)},
-- {coords = vector4(1143.55, -1000.19, 45.32, 257.05)}, {coords = vector4(1231.60, -1083.06, 38.53, 102.99)},
-- {coords = vector4(1264.82, -702.87, 64.72, 257.05)}, {coords = vector4(1143.55, -1000.19, 45.32, 257.05)},
-- {coords = vector4(1119.65, -639.76, 56.81, 284.53)}, {coords = vector4(1264.82, -702.87, 64.72, 257.05)},
-- {coords = vector4(1129.59, -462.59, 66.49, 79.23)}, {coords = vector4(1119.65, -639.76, 56.81, 284.53)},
-- {coords = vector4(42.80, -811.45, 31.43, 79.23)}, {coords = vector4(1129.59, -462.59, 66.49, 79.23)},
-- {coords = vector4(-509.48, -1001.66, 23.55, 79.23)}, {coords = vector4(42.80, -811.45, 31.43, 79.23)},
-- {coords = vector4(-830.97, -862.41, 20.69, 13.72)}, {coords = vector4(-509.48, -1001.66, 23.55, 79.23)},
-- {coords = vector4(-1320.26, -1177.34, 4.89, 74.29)}, {coords = vector4(-830.97, -862.41, 20.69, 13.72)},
-- {coords = vector4(-1097.63, -1673.24, 8.40, 136.51)}, {coords = vector4(-1320.26, -1177.34, 4.89, 74.29)},
-- {coords = vector4(-1147.61, -1452.10, 4.60, 51.50)}, {coords = vector4(-1097.63, -1673.24, 8.40, 136.51)},
-- {coords = vector4(-1241.69, -1208.39, 8.52, 107.56)}, {coords = vector4(-1147.61, -1452.10, 4.60, 51.50)},
-- {coords = vector4(-1876.92, -584.44, 11.85, 329.54)}, {coords = vector4(-1241.69, -1208.39, 8.52, 107.56)},
-- {coords = vector4(-1303.94, -441.39, 35.22, 128.73)}, {coords = vector4(-1876.92, -584.44, 11.85, 329.54)},
-- {coords = vector4(-1705.48, -433.46, 42.17, 128.73)}, {coords = vector4(-1303.94, -441.39, 35.22, 128.73)},
-- {coords = vector4(-1305.99, 336.35, 65.50, 35.13)}, {coords = vector4(-1705.48, -433.46, 42.17, 128.73)},
-- {coords = vector4(-741.80, 484.84, 109.47, 110.85)}, {coords = vector4(-1305.99, 336.35, 65.50, 35.13)},
-- {coords = vector4(-409.57, 341.49, 108.91, 270.45)}, {coords = vector4(-741.80, 484.84, 109.47, 110.85)},
-- {coords = vector4(-126.44, 588.18, 204.71, 8.12)}, {coords = vector4(-409.57, 341.49, 108.91, 270.45)},
-- {coords = vector4(211.42, -101.42, 73.28, 174.10)}, {coords = vector4(-126.44, 588.18, 204.71, 8.12)},
-- {coords = vector4(490.61, -95.04, 66.44, 273.57)}, {coords = vector4(211.42, -101.42, 73.28, 174.10)},
-- {coords = vector4(387.19, -993.59, 29.42, 273.57)}, {coords = vector4(490.61, -95.04, 66.44, 273.57)},
-- {coords = vector4(-500.47, -712.37, 33.21, 273.57)}, {coords = vector4(387.19, -993.59, 29.42, 273.57)},
-- {coords = vector4(2572.20, 479.97, 108.68, 80.27)}, {coords = vector4(-500.47, -712.37, 33.21, 273.57)},
-- {coords = vector4(-430.10, 1205.41, 325.76, 169.25)}, {coords = vector4(2572.20, 479.97, 108.68, 80.27)},
-- {coords = vector4(-126.06, 1896.58, 197.33, 169.25)}, {coords = vector4(-430.10, 1205.41, 325.76, 169.25)},
-- {coords = vector4(-2521.08, 2310.31, 33.22, 276.87)}, {coords = vector4(-126.06, 1896.58, 197.33, 169.25)},
-- {coords = vector4(1129.01, 2125.14, 55.55, 276.87)}, {coords = vector4(-2521.08, 2310.31, 33.22, 276.87)},
-- {coords = vector4(1546.64, 2166.56, 78.72, 100.37)}, {coords = vector4(1129.01, 2125.14, 55.55, 276.87)},
-- {coords = vector4(404.34, 2584.54, 43.52, 100.37)}, {coords = vector4(1546.64, 2166.56, 78.72, 100.37)},
-- {coords = vector4(180.15, 2792.99, 45.66, 283.04)}, {coords = vector4(404.34, 2584.54, 43.52, 100.37)},
-- {coords = vector4(287.67, 2843.89, 44.70, 118.41)}, {coords = vector4(180.15, 2792.99, 45.66, 283.04)},
-- {coords = vector4(2030.23, 3184.42, 45.13, 146.06)}, {coords = vector4(287.67, 2843.89, 44.70, 118.41)},
-- {coords = vector4(2175.33, 3321.92, 46.13, 214.53)}, {coords = vector4(2030.23, 3184.42, 45.13, 146.06)},
-- {coords = vector4(2389.61, 3340.98, 47.34, 214.52)}, {coords = vector4(2175.33, 3321.92, 46.13, 214.53)},
-- {coords = vector4(1716.25, 3295.08, 41.26, 196.21)}, {coords = vector4(2389.61, 3340.98, 47.34, 214.52)},
-- {coords = vector4(1779.38, 3640.83, 34.50, 24.16)}, {coords = vector4(1716.25, 3295.08, 41.26, 196.21)},
-- {coords = vector4(1894.59, 3715.34, 32.75, 127.89)}, {coords = vector4(1779.38, 3640.83, 34.50, 24.16)},
-- {coords = vector4(1861.90, 3857.15, 36.27, 293.45)}, {coords = vector4(1894.59, 3715.34, 32.75, 127.89)},
-- {coords = vector4(996.38, 3575.07, 34.61, 328.30)}, {coords = vector4(1861.90, 3857.15, 36.27, 293.45)},
-- {coords = vector4(387.45, 3584.73, 33.29, 351.41)}, {coords = vector4(996.38, 3575.07, 34.61, 328.30)},
-- {coords = vector4(68.08, 3693.22, 40.66, 63.98)}, {coords = vector4(387.45, 3584.73, 33.29, 351.41)},
-- {coords = vector4(15.55, 3688.70, 39.81, 230.89)}, {coords = vector4(68.08, 3693.22, 40.66, 63.98)},
-- {coords = vector4(2566.59, 4283.34, 41.97, 348.53)}, {coords = vector4(15.55, 3688.70, 39.81, 230.89)},
-- {coords = vector4(2570.82, 4667.95, 34.08, 135.30)}, {coords = vector4(2566.59, 4283.34, 41.97, 348.53)},
-- {coords = vector4(2882.05, 4511.72, 48.02, 66.58)}, {coords = vector4(2570.82, 4667.95, 34.08, 135.30)},
-- {coords = vector4(2243.78, 5154.02, 57.89, 139.42)}, {coords = vector4(2882.05, 4511.72, 48.02, 66.58)},
-- {coords = vector4(1642.91, 4846.08, 45.51, 109.83)}, {coords = vector4(2243.78, 5154.02, 57.89, 139.42)},
-- {coords = vector4(1308.87, 4362.17, 41.55, 256.01)}, {coords = vector4(1642.91, 4846.08, 45.51, 109.83)},
-- {coords = vector4(-1090.27, 4940.57, 214.13, 256.01)}, {coords = vector4(1308.87, 4362.17, 41.55, 256.01)},
-- {coords = vector4(-552.37, 5348.37, 74.76, 62.18)}, {coords = vector4(-1090.27, 4940.57, 214.13, 256.01)},
-- {coords = vector4(-679.02, 5834.27, 17.33, 137.18)}, {coords = vector4(-552.37, 5348.37, 74.76, 62.18)},
-- {coords = vector4(-481.97, 6276.93, 13.35, 323.16)}, {coords = vector4(-679.02, 5834.27, 17.33, 137.18)},
-- {coords = vector4(-24.92, 6472.60, 31.49, 144.42)}, {coords = vector4(-481.97, 6276.93, 13.35, 323.16)},
-- {coords = vector4(36.03, 6549.18, 31.43, 287.85)}, {coords = vector4(-24.92, 6472.60, 31.49, 144.42)},
-- {coords = vector4(406.08, 6526.43, 27.75, 97.45)}, {coords = vector4(36.03, 6549.18, 31.43, 287.85)},
-- {coords = vector4(1522.39, 6329.23, 24.61, 331.71)}, {coords = vector4(406.08, 6526.43, 27.75, 97.45)},
-- {coords = vector4(1741.39, 6419.62, 35.04, 331.71)}, {coords = vector4(1522.39, 6329.23, 24.61, 331.71)},
-- {coords = vector4(3426.72, 5174.42, 7.40, 112.64)}, {coords = vector4(1741.39, 6419.62, 35.04, 331.71)},
-- {coords = vector4(2525.99, 2586.62, 38.94, 257.02)}, {coords = vector4(3426.72, 5174.42, 7.40, 112.64)},
-- {coords = vector4(2696.29, 1664.44, 24.52, 70.12)}, {coords = vector4(2525.99, 2586.62, 38.94, 257.02)},
-- {coords = vector4(106.24, -1280.32, 29.24, 350.89)}, {coords = vector4(2696.29, 1664.44, 24.52, 70.12)},
-- {coords = vector4(223.98, 121.53, 102.76, 259.68)}, {coords = vector4(106.24, -1280.32, 29.24, 350.89)},
-- {coords = vector4(102.19, -255.02, 50.05, 83.59)}, {coords = vector4(223.98, 121.53, 102.76, 259.68)},
--} {coords = vector4(102.19, -255.02, 50.05, 83.59)},
--local Products = { }
-- {name = "weed_whitewidow_seed", price = 15, amount = 150, minrep = 0}, }
-- {name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0}, Recipes.Deliveries = {
-- {name = "weed_purplehaze_seed", price = 15, amount = 150, minrep = 0}, {name = "weed_whitewidow_seed", price = 15, amount = 150, minrep = 0},
-- {name = "weed_ogkush_seed", price = 15, amount = 150, minrep = 0}, {name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0},
-- {name = "weed_amnesia_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},
--local Dealers = {} }
-- GlobalState.MDDrugsRecipes = Recipes
--
--Bridge.Callback.Register('md-drugs:server:dealerList', function(source, location) local drugDeliveryItem = {
-- local coords = json.decode(Dealers[location].coords) {item = 'coke_brick', amount = 1},
-- coords = vector3(coords.x, coords.y, coords.z) {item = 'weed_brick', amount = 1},
-- if not checkDistance(source, coords, 4.0, 'md-drugs:server:dealerList') then }
-- return local Dealers = {}
-- end
-- return Products CreateThread(function()
--end) local dealers = MySQL.query.await('SELECT * FROM dealers', {})
-- if #dealers > 0 then
--local DeliveryItems = { for i = 1, #dealers do
-- { item = "weed_brick", minrep = 0, payout = {min = 10, max = 50}}, local coords = json.decode(dealers[i].coords)
-- { item = "coke_brick", minrep = 0, payout = {min = 10, max = 50}}, Dealers[#Dealers + 1] = {
--} coords = vector4(coords.x, coords.y, coords.z, coords.w),
-- model = dealers[i].model or 'a_m_m_skater_01',
--Bridge.Callback.Register('md-drugs:server:GetDeliveryItem', function(source, data) }
-- local src = source end
-- local itemnum = math.random(1, #DeliveryItems) Locations.Deliveries.dealers = Dealers
-- local item = DeliveryItems[itemnum].item GlobalState.MDDrugsLocations = Locations
-- local amount = math.random(1,4) end
-- local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Bridge.Framework.GetPlayerIdentifier(src)}) end)
-- local locnum = math.random(1, #dloc)
-- local coord = json.encode({ RegisterCommand('newdealer', function(source, args, rawCommand)
-- x = dloc[locnum].coords.x, local src = source
-- y = dloc[locnum].coords.y, if not IsPlayerAceAllowed(src, "command") then
-- z = dloc[locnum].coords.z , return
-- w = dloc[locnum].coords.w end
-- }) local model = args[1] or 'a_m_m_skater_01'
-- if not check[1] then local coords, heading = GetEntityCoords(GetPlayerPed(src)), GetEntityHeading(GetPlayerPed(src))
-- MySQL.insert('INSERT INTO deliveriesdealer SET cid = ?, itemdata = ?, timestart = ?, maxtime = ?, location = ?', local vec = vector4(coords.x, coords.y, coords.z, heading)
-- {Bridge.Framework.GetPlayerIdentifier(src), json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord }) MySQL.query.await('INSERT INTO dealers (model, coords, createdby) VALUES (?, ?, ?)', {model, json.encode(vec), Bridge.Framework.GetPlayerIdentifier(src)})
-- Bridge.Inventory.AddItem(src, item, amount) Dealers[#Dealers + 1] = {
-- local tab = { coords = vec,
-- bool = true, model = model,
-- item = item, }
-- amount = amount, Locations.Deliveries.dealers = Dealers
-- coords = coord GlobalState.MDDrugsLocations = Locations
-- } Wait(1000)
-- return tab TriggerClientEvent('md-drugs:client:RefreshDealers', -1)
-- else end, false)
-- local time = os.time()
-- local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60) TriggerClientEvent('chat:addSuggestion', -1, '/newdealer', 'Spawns a new delivery dealer at your location.', {
-- { name="model", help="Ped model to use (optional)." }
-- if timeout > 15 then })
-- MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Bridge.Framework.GetPlayerIdentifier(src)})
-- Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Deliveries.slowAf'), 'error' ) RegisterNetEvent('md-drugs:server:buyItemDealer', function(item, dealerId)
-- return {bool = false} local src = source
-- end if not Dealers[dealerId] then return end
-- Bridge.Notify.SendNotify(src,Bridge.Language.Locale('Deliveries.alreadyDelivering'), 'error' ) if not checkDistance(src, Dealers[dealerId].coords, 5.0, 'md-drugs:server:buyItemDealer') then
-- local tab = { return
-- bool = false, end
-- item = item, local itemExists = Recipes.Deliveries[item]
-- amount = amount,
-- coords = coord if not itemExists then
-- } Bridge.Prints.Warn(Bridge.Language.Locale('Deliveries.itemDoesntExist', Bridge.Framework.GetPlayerIdentifier(src), item))
-- return tab return
-- end end
--end) if Bridge.Framework.RemoveAccountBalance(src, 'cash', itemExists.price) then
-- Bridge.Inventory.AddItem(src, itemExists.name, 1)
--RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount) else
-- local src = source Bridge.Notify.Error(src, Bridge.Language.Locale('Deliveries.purchase_fail_funds'))
-- local id = Bridge.Framework.GetPlayerIdentifier(src) end
-- local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {id}) end)
-- if not check[1] then return end
-- local time = os.time() local active = {}
-- local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60) CreateThread(function()
-- local itemData = json.decode(check[1].itemdata) local deliveries = MySQL.query.await('SELECT * FROM deliveriesdealer', {})
-- if timeout >= 15 then if deliveries and #deliveries > 0 then
-- MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {id}) for i = 1, #deliveries do
-- Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Deliveries.slowAf'), 'error' ) local itemdata = json.decode(deliveries[i].itemdata)
-- return local location = json.decode(deliveries[i].location)
-- end active[deliveries[i].cid] = {
-- coords = vector4(location.x, location.y, location.z, location.w or 180.0),
-- if item ~= itemData.item then return end item = itemdata.item,
-- if amount ~= itemData.amount then return end amount = itemdata.amount,
-- local coords = json.decode(check[1].location) timestop = deliveries[i].maxtime,
-- coords = vector3(coords.x, coords.y, coords.z) }
-- if not checkDistance(src, coords, 5.0, 'md-drugs:server:giveDeliveryItems') then end
-- return end
-- end end)
-- if Bridge.Inventory.RemoveItem(src, item, amount) then
-- for k, v in pairs (DeliveryItems) do RegisterNetEvent('md-drugs:server:requestDelivery', function(dealerId)
-- if v.item == item then local src = source
-- local income = math.random(v.payout.min, v.payout.max) if not Dealers[dealerId] then return end
-- Bridge.Framework.AddAccountBalance(src, 'cash', income) if not checkDistance(src, Dealers[dealerId].coords, 5.0, 'md-drugs:server:requestDelivery') then
-- AddRep(src, 'dealerrep') return
-- end end
-- end local id = Bridge.Framework.GetPlayerIdentifier(src)
-- MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {id}) if active[id] then
-- end local currentTime = os.time()
--end) if currentTime > active[id].timestop then
---- TODO: COmmands Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Deliveries.slowAf'), 'error')
--ps.registerCommand("newdealer", { active[id] = nil
-- help = Bridge.Language.Locale('Deliveries.newDealerHelp.help'), return
-- description = { end
-- { name = "name", help = Bridge.Language.Locale('Deliveries.newDealerHelp.name'), type = "string" }, Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Deliveries.alreadyDelivering'), 'error')
-- { name = "min", help = Bridge.Language.Locale('Deliveries.newDealerHelp.timeMin'), type = "number" }, TriggerClientEvent('md-drugs:client:setLocation', src, active[id])
-- { name = "max", help = Bridge.Language.Locale('Deliveries.newDealerHelp.timeMax'), type = "number" } return
-- }, end
-- admin = true, local deliveryLoc = Locations.Deliveries.dropOff[math.random(1, #Locations.Deliveries.dropOff)]
--}, function(source, args) local item = drugDeliveryItem[math.random(1, #drugDeliveryItem)]
-- local ped = GetPlayerPed(source) active[id] = {
-- local coords = GetEntityCoords(ped) coords = deliveryLoc.coords,
-- local Player = ps.getPlayer(source) item = item.item,
-- if not Player then return end amount = item.amount,
-- timestop = os.time() + (15 * 60),
-- local dealerName = args[1] }
-- local pos = json.encode({x = coords.x, y = coords.y, z = coords.z}) MySQL.query.await('INSERT INTO deliveriesdealer (cid, itemdata, maxtime, location) VALUES (?, ?, ?, ?)', {
-- id,
-- local result = MySQL.scalar.await('SELECT name FROM dealers WHERE name = ?', { dealerName }) json.encode({item = item.item, amount = item.amount}),
-- if result then active[id].timestop,
-- return Bridge.Notify.SendNotify(source,Bridge.Language.Locale('Deliveries.DealerExists'), "error") json.encode({x = deliveryLoc.coords.x, y = deliveryLoc.coords.y, z = deliveryLoc.coords.z, w = deliveryLoc.coords.w or 180.0}),
-- end })
-- Bridge.Inventory.AddItem(src, item.item, item.amount)
-- MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', { TriggerClientEvent('md-drugs:client:setLocation', src, active[id])
-- dealerName, pos, 'nil', Bridge.Framework.GetPlayerIdentifier(source) end)
-- })
-- Wait(1000) RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(pedID)
-- Locations.Dealers = MySQL.query.await('SELECT * FROM dealers') local src = source
-- GlobalState.MDDrugsLocations = Locations local id = Bridge.Framework.GetPlayerIdentifier(src)
-- TriggerClientEvent('md-drugs:client:RefreshDealers', -1) if not active[id] then
--end) return
-- end
--ps.registerCommand("deletedealer", { if not checkDistance(src, active[id].coords, 5.0, 'md-drugs:server:giveDeliveryItems') then
-- help = Bridge.Language.Locale('Deliveries.deleteDealerHelp.help'), return
-- description = { end
-- { name = "name", help = Bridge.Language.Locale('Deliveries.deleteDealerHelp.name'), type = "string" }
-- }, if not Bridge.Inventory.RemoveItem(src, active[id].item, active[id].amount) then
-- admin = true Bridge.Notify.Error(src, Bridge.Language.Locale('Deliveries.deliveryFailed'))
--}, function(source, args) return
-- local dealerName = args.name end
-- local result = MySQL.scalar.await('SELECT * FROM dealers WHERE name = ?', { dealerName })
-- Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Deliveries.delivery_success'), 'success')
-- if result and result[1] then AddRep(src, 'dealerrep', 1)
-- MySQL.query('DELETE FROM dealers WHERE name = ?', { dealerName }) active[id] = nil
-- Wait(1000) MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {id})
-- Locations.Dealers = MySQL.query.await('SELECT * FROM dealers') end)
-- GlobalState.MDDrugsLocations = Locations
-- TriggerClientEvent('md-drugs:client:RefreshDealers', -1)
-- Bridge.Notify.SendNotify(source, Bridge.Language.Locale('Deliveries.deleteDealerSuccess'), "success")
-- else
-- Bridge.Notify.SendNotify(source, Bridge.Language.Locale('Deliveries.deleteDealerFail'), "error")
-- end
--end)
--
--
--RegisterNetEvent('md-drugs:server:buyItemDealer', function(num, loc)
-- local src = source
-- local itemData = Products[num]
-- if not itemData then return end
-- local coords = json.decode(Dealers[loc].coords)
-- coords = vector3(coords.x, coords.y, coords.z)
-- if not checkDistance(src, coords, 5.0, 'md-drugs:server:buyItemDealer') then
-- return
-- end
-- if not Bridge.Framework.RemoveAccountBalance(src, 'cash', itemData.price) or not Bridge.Framework.RemoveAccountBalance(src,'bank', itemData.price) then
-- Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), 'error')
-- return
-- end
-- Bridge.Inventory.AddItem(src, itemData.name, 1)
-- Bridge.Notify.SendNotify(src, string.format(Bridge.Language.Locale('Deliveries.buyItemSuccess'), 1, Bridge.Inventory.GetItemInfo(itemData.name).label, itemData.price), 'success')
--end)
--
--Dealers = MySQL.query.await('SELECT * FROM dealers')
--if Dealers and not Dealers[1] then
-- MySQL.insert('INSERT INTO dealers SET name = ?, coords = ?, time = ?, createdby = ?', {'MD', json.encode({x = 899.98, y = -2603.24, z = 6.11, h = 176.12 }), 'any', 'code Newb'})
--end
--Locations.Dealers = Dealers
--GlobalState.MDDrugsLocations = Locations
+1 -1
View File
@@ -65,7 +65,7 @@ settings.Locs = {
Locations = Locations or {} Locations = Locations or {}
GlobalState.MDDrugsLocations.Wholesale = settings GlobalState.MDDrugsLocations = Locations
for k, v in pairs (burners) do for k, v in pairs (burners) do
Bridge.Framework.RegisterUsableItem(k, function(source, item) Bridge.Framework.RegisterUsableItem(k, function(source, item)