updated deliveries to be server sided and adjusted all locations to vec4

This commit is contained in:
Mustache Dom committed 2024-11-23 15:33:17 -08:00
1 parent cf5cfba909
commit 001378704c
4 files changed
+108 -104

No files matched your search

+2 -3
View File
@@ -44,8 +44,8 @@ RegisterNetEvent('md-drugs:client:setLocation', function(data)
SetNewWaypoint(coord.x, coord.y)
if isActive then return end
isActive = true
local Buyer = CreatePed(0, "g_m_y_famdnf_01",coord.x, coord.y, coord.z-1, 180.0, false, false)
Freeze(Buyer, true, 180)
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, {
icon = 'fas fa-user-secret',
label = Lang.targets.Delivery.hand,
@@ -62,4 +62,3 @@ RegisterNetEvent('md-drugs:client:setLocation', function(data)
end
}, nil)
end)
+99 -13
View File
@@ -1,7 +1,86 @@
QBCore = exports['qb-core']:GetCoreObject()
local QBCore = exports['qb-core']:GetCoreObject()
-- Callbacks
local dloc = {
{coords = vector4(282.48, -1814.32, 27.23, 145.11)},
{coords = vector4(-296.11, -1300.65, 31.31, 270.87)},
{coords = vector4(-36.64, -1492.04, 31.22, 151.91)},
{coords = vector4(282.48, -1814.32, 27.23, 232.19)},
{coords = vector4(54.54, -1873.22, 22.81, 131.47)},
{coords = vector4(-269.34, -2437.25, 6.40, 252.67)},
{coords = vector4(269.19, -3248.55, 5.79, 252.67)},
{coords = vector4(632.94, -3015.44, 7.34, 3.44)},
{coords = vector4(1049.55, -2427.88, 30.30, 79.52)},
{coords = vector4(853.16, -2207.32, 30.68, 284.88)},
{coords = vector4(903.10, -1721.98, 32.25, 168.71)},
{coords = vector4(1289.30, -1710.49, 55.48, 208.57)},
{coords = vector4(1412.01, -1490.53, 60.66, 132.46)},
{coords = vector4(734.26, -1311.26, 27.01, 102.99)},
{coords = vector4(1231.60, -1083.06, 38.53, 102.99)},
{coords = vector4(1143.55, -1000.19, 45.32, 257.05)},
{coords = vector4(1264.82, -702.87, 64.72, 257.05)},
{coords = vector4(1119.65, -639.76, 56.81, 284.53)},
{coords = vector4(1129.59, -462.59, 66.49, 79.23)},
{coords = vector4(42.80, -811.45, 31.43, 79.23)},
{coords = vector4(-509.48, -1001.66, 23.55, 79.23)},
{coords = vector4(-830.97, -862.41, 20.69, 13.72)},
{coords = vector4(-1320.26, -1177.34, 4.89, 74.29)},
{coords = vector4(-1097.63, -1673.24, 8.40, 136.51)},
{coords = vector4(-1147.61, -1452.10, 4.60, 51.50)},
{coords = vector4(-1241.69, -1208.39, 8.52, 107.56)},
{coords = vector4(-1876.92, -584.44, 11.85, 329.54)},
{coords = vector4(-1303.94, -441.39, 35.22, 128.73)},
{coords = vector4(-1705.48, -433.46, 42.17, 128.73)},
{coords = vector4(-1305.99, 336.35, 65.50, 35.13)},
{coords = vector4(-741.80, 484.84, 109.47, 110.85)},
{coords = vector4(-409.57, 341.49, 108.91, 270.45)},
{coords = vector4(-126.44, 588.18, 204.71, 8.12)},
{coords = vector4(211.42, -101.42, 73.28, 174.10)},
{coords = vector4(490.61, -95.04, 66.44, 273.57)},
{coords = vector4(387.19, -993.59, 29.42, 273.57)},
{coords = vector4(-500.47, -712.37, 33.21, 273.57)},
{coords = vector4(2572.20, 479.97, 108.68, 80.27)},
{coords = vector4(-430.10, 1205.41, 325.76, 169.25)},
{coords = vector4(-126.06, 1896.58, 197.33, 169.25)},
{coords = vector4(-2521.08, 2310.31, 33.22, 276.87)},
{coords = vector4(1129.01, 2125.14, 55.55, 276.87)},
{coords = vector4(1546.64, 2166.56, 78.72, 100.37)},
{coords = vector4(404.34, 2584.54, 43.52, 100.37)},
{coords = vector4(180.15, 2792.99, 45.66, 283.04)},
{coords = vector4(287.67, 2843.89, 44.70, 118.41)},
{coords = vector4(2030.23, 3184.42, 45.13, 146.06)},
{coords = vector4(2175.33, 3321.92, 46.13, 214.53)},
{coords = vector4(2389.61, 3340.98, 47.34, 214.52)},
{coords = vector4(1716.25, 3295.08, 41.26, 196.21)},
{coords = vector4(1779.38, 3640.83, 34.50, 24.16)},
{coords = vector4(1894.59, 3715.34, 32.75, 127.89)},
{coords = vector4(1861.90, 3857.15, 36.27, 293.45)},
{coords = vector4(996.38, 3575.07, 34.61, 328.30)},
{coords = vector4(387.45, 3584.73, 33.29, 351.41)},
{coords = vector4(68.08, 3693.22, 40.66, 63.98)},
{coords = vector4(15.55, 3688.70, 39.81, 230.89)},
{coords = vector4(2566.59, 4283.34, 41.97, 348.53)},
{coords = vector4(2570.82, 4667.95, 34.08, 135.30)},
{coords = vector4(2882.05, 4511.72, 48.02, 66.58)},
{coords = vector4(2243.78, 5154.02, 57.89, 139.42)},
{coords = vector4(1642.91, 4846.08, 45.51, 109.83)},
{coords = vector4(1308.87, 4362.17, 41.55, 256.01)},
{coords = vector4(-1090.27, 4940.57, 214.13, 256.01)},
{coords = vector4(-552.37, 5348.37, 74.76, 62.18)},
{coords = vector4(-679.02, 5834.27, 17.33, 137.18)},
{coords = vector4(-481.97, 6276.93, 13.35, 323.16)},
{coords = vector4(-24.92, 6472.60, 31.49, 144.42)},
{coords = vector4(36.03, 6549.18, 31.43, 287.85)},
{coords = vector4(406.08, 6526.43, 27.75, 97.45)},
{coords = vector4(1522.39, 6329.23, 24.61, 331.71)},
{coords = vector4(1741.39, 6419.62, 35.04, 331.71)},
{coords = vector4(3426.72, 5174.42, 7.40, 112.64)},
{coords = vector4(2525.99, 2586.62, 38.94, 257.02)},
{coords = vector4(2696.29, 1664.44, 24.52, 70.12)},
{coords = vector4(106.24, -1280.32, 29.24, 350.89)},
{coords = vector4(223.98, 121.53, 102.76, 259.68)},
{coords = vector4(102.19, -255.02, 50.05, 83.59)},
}
lib.callback.register('md-drugs:server:getDealers', function(data)
local check = MySQL.query.await('SELECT * FROM dealers', {})
local loc = json.encode({x = 899.98, y = -2603.24, z = 6.11, h = 176.12 })
@@ -16,29 +95,36 @@ lib.callback.register('md-drugs:server:getDealers', function(data)
end)
local DeliveryItems = {
{ item = "weed_brick", minrep = 0, payout = {min = 10, max = 50}},
{ item = "coke_brick", minrep = 0, payout = {min = 10, max = 50}},
}
lib.callback.register('md-drugs:server:GetDeliveryItem', function(data)
local src = source
local Player = getPlayer(src)
local item = math.random(1, #QBConfig.DeliveryItems)
local itemnum = math.random(1, #DeliveryItems)
local item = DeliveryItems[itemnum].item
local amount = math.random(1,4)
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
local locnum = math.random(1, #QBConfig.DeliveryLocations)
local locnum = math.random(1, #dloc)
local coord = json.encode({
x = math.floor(QBConfig.DeliveryLocations[locnum].coords.x * 100) / 100,
y = math.floor(QBConfig.DeliveryLocations[locnum].coords.y * 100) / 100,
z = math.floor(QBConfig.DeliveryLocations[locnum].coords.z * 100) / 100,
x = dloc[locnum].coords.x,
y = dloc[locnum].coords.y,
z = dloc[locnum].coords.z ,
w = dloc[locnum].coords.w
})
if not check[1] then
MySQL.insert('INSERT INTO deliveriesdealer SET cid = ?, itemdata = ?, timestart = ?, maxtime = ?, location = ?',
{Player.PlayerData.citizenid, json.encode({item = QBConfig.DeliveryItems[item].item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
AddItem(Player.PlayerData.source, QBConfig.DeliveryItems[item].item, amount)
return true, QBConfig.DeliveryItems[item].item, amount, coord
{Player.PlayerData.citizenid, json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
AddItem(Player.PlayerData.source, 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}) Notifys(src, 'You Failed To Make It In Time!', 'error' ) return false end
Notifys(src,'You Already Have A Delivery To Make', 'error' ) return false, QBConfig.DeliveryItems[item].item, amount, coord
Notifys(src,'You Already Have A Delivery To Make', 'error' ) return false, item, amount, coord
end
end)
@@ -54,7 +140,7 @@ RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount)
if item ~= itemData.item then return end
if amount ~= itemData.amount then return end
if RemoveItem(src, item, amount) then
for k, v in pairs (QBConfig.DeliveryItems) do
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)
+5 -2
View File
@@ -1,7 +1,7 @@
Config = {} --Ignore.
Config.Target = 'ox' -- qb or ox
Config.respawnTime = 600 -- Seconds
Config.respawnTime = 150 -- 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
@@ -47,4 +47,7 @@ Config.Minigames = {
glspot = {gridSize = 6, timeLimit = 999999, charSet = "alphabet", required = 10},
glmath = {timeLimit = 300000},
}
Config.minigametype = 'blrapidlines' -- look above for options or choose none if you dont want any minigames
Config.minigametype = 'blrapidlines' -- look above for options or choose none if you dont want any minigames
-------- Woah Where did like all the locations go?
--- read the readme to find out
+2 -86
View File
@@ -8,92 +8,8 @@ QBConfig.CustomDirtyMoney = false
QBConfig.CustomDirtyMoneyitem = ''
QBConfig.Dealers = {}
QBConfig.DeliveryItems = {
{ item = "weed_brick", minrep = 0, payout = {min = 10, max = 50}},
{ item = "coke_brick", minrep = 0, payout = {min = 10, max = 50}},
}
QBConfig.DeliveryLocations = {
[1] = { ["label"] = "Pork Factory", ["coords"] = vector3(-296.27, -1300.54, 31.31),},
[2] = { ["label"] = "Forum Drive Deli", ["coords"] = vector3(-36.69, -1492.13, 31.22),},
[3] = { ["label"] = "Hayes Autos South LS", ["coords"] = vector3(282.55, -1814.39, 27.1),},
[4] = { ["label"] = "Grove Street", ["coords"] = vector3(54.55, -1873.15, 22.8),},
[5] = { ["label"] = "Port1", ["coords"] = vector3(-269.4, -2437.15, 6.36),},
[6] = { ["label"] = "Port2", ["coords"] = vector3(269.16, -3248.54, 5.79),},
[7] = { ["label"] = "Port3", ["coords"] = vector3(632.9, -3015.42, 7.34),},
[8] = { ["label"] = "Industrial1", ["coords"] = vector3(1049.52, -2427.96, 30.3),},
[9] = { ["label"] = "Industrial2", ["coords"] = vector3(853.26, -2207.3, 30.68),},
[10] = { ["label"] = "Industrial3", ["coords"] = vector3(903.02, -1721.94, 32.18),},
[11] = { ["label"] = "EastLS1", ["coords"] = vector3(1289.33, -1710.47, 55.51),},
[12] = { ["label"] = "EastLS2", ["coords"] = vector3(1411.94, -1490.54, 60.66),},
[13] = { ["label"] = "Industrial4", ["coords"] = vector3(734.26, -1311.26, 27.01),},
[14] = { ["label"] = "Industrial5", ["coords"] = vector3(1231.6, -1083.06, 38.53),},
[15] = { ["label"] = "Mirror1", ["coords"] = vector3(1143.55, -1000.19, 45.32),},
[16] = { ["label"] = "Mirror2", ["coords"] = vector3(1264.82, -702.87, 64.72),},
[17] = { ["label"] = "Mirror3", ["coords"] = vector3(1119.65, -639.76, 56.81),},
[18] = { ["label"] = "Mirror4", ["coords"] = vector3(1129.59, -462.59, 66.49),},
[19] = { ["label"] = "City1", ["coords"] = vector3(42.8, -811.45, 31.43),},
[20] = { ["label"] = "City2", ["coords"] = vector3(-509.48, -1001.66, 23.55),},
[21] = { ["label"] = "City3", ["coords"] = vector3(-830.97, -862.41, 20.69),},
[22] = { ["label"] = "Vesp1", ["coords"] = vector3(-1320.26, -1177.34, 4.89),},
[23] = { ["label"] = "Vesp2", ["coords"] = vector3(-1097.63, -1673.24, 8.4),},
[24] = { ["label"] = "Vesp3", ["coords"] = vector3(-1147.61, -1452.1, 4.6),},
[25] = { ["label"] = "Vesp4", ["coords"] = vector3(-1241.69, -1208.39, 8.52),},
[26] = { ["label"] = "Vesp5", ["coords"] = vector3(-1876.92, -584.44, 11.85),},
[27] = { ["label"] = "City4", ["coords"] = vector3(-1303.94, -441.39, 35.22),},
[28] = { ["label"] = "City5", ["coords"] = vector3(-1705.48, -433.46, 42.17),},
[29] = { ["label"] = "City6", ["coords"] = vector3(-1305.99, 336.35, 65.5),},
[30] = { ["label"] = "Vinewood1", ["coords"] = vector3(-741.8, 484.84, 109.47),},
[31] = { ["label"] = "Vinewood2", ["coords"] = vector3(-409.57, 341.49, 108.91),},
[32] = { ["label"] = "Vinewood3", ["coords"] = vector3(-126.44, 588.18, 204.71),},
[33] = { ["label"] = "Vinewood4", ["coords"] = vector3(211.42, -101.42, 73.28),},
[34] = { ["label"] = "Vinewood5", ["coords"] = vector3(490.61, -95.04, 66.44),},
[35] = { ["label"] = "City7", ["coords"] = vector3(387.19, -993.59, 29.42),},
[36] = { ["label"] = "City8", ["coords"] = vector3(-500.47, -712.37, 33.21),},
[37] = { ["label"] = "EastHW", ["coords"] = vector3(2572.2, 479.97, 108.68),},
[38] = { ["label"] = "Vinewood6", ["coords"] = vector3(-430.1, 1205.41, 325.76),},
[39] = { ["label"] = "VinewoodHills1", ["coords"] = vector3(-126.06, 1896.58, 197.33),},
[40] = { ["label"] = "VinewoodHills2", ["coords"] = vector3(-2521.08, 2310.31, 33.22),},
[41] = { ["label"] = "RedwoodsCons", ["coords"] = vector3(1129.01, 2125.14, 55.55),},
[42] = { ["label"] = "RedwoodsFarm", ["coords"] = vector3(1546.64, 2166.56, 78.72),},
[43] = { ["label"] = "Harmony1", ["coords"] = vector3(404.34, 2584.54, 43.52),},
[44] = { ["label"] = "Harmony2", ["coords"] = vector3(180.15, 2792.99, 45.66),},
[45] = { ["label"] = "Harmony3", ["coords"] = vector3(287.67, 2843.89, 44.7),},
[46] = { ["label"] = "Sandy1", ["coords"] = vector3(2030.23, 3184.42, 45.13),},
[47] = { ["label"] = "Sandy2", ["coords"] = vector3(2175.33, 3321.92, 46.13),},
[48] = { ["label"] = "Sandy3", ["coords"] = vector3(2389.61, 3340.98, 47.34),},
[49] = { ["label"] = "Sandy4", ["coords"] = vector3(1716.25, 3295.08, 41.26),},
[50] = { ["label"] = "Sandy5", ["coords"] = vector3(1779.38, 3640.83, 34.5),},
[51] = { ["label"] = "Sandy6", ["coords"] = vector3(1894.59, 3715.34, 32.75),},
[52] = { ["label"] = "Sandy7", ["coords"] = vector3(1861.9, 3857.15, 36.27),},
[53] = { ["label"] = "Sandy8", ["coords"] = vector3(996.38, 3575.07, 34.61),},
[54] = { ["label"] = "Sandy9", ["coords"] = vector3(387.45, 3584.73, 33.29),},
[55] = { ["label"] = "Stab1", ["coords"] = vector3(68.08, 3693.22, 40.66),},
[56] = { ["label"] = "Stab2", ["coords"] = vector3(15.55, 3688.7, 39.81),},
[57] = { ["label"] = "Sandy10", ["coords"] = vector3(2566.59, 4283.34, 41.97),},
[58] = { ["label"] = "Grape1", ["coords"] = vector3(2570.82, 4667.95, 34.08),},
[59] = { ["label"] = "Grape2", ["coords"] = vector3(2882.05, 4511.72, 48.02),},
[60] = { ["label"] = "Grape3", ["coords"] = vector3(2243.78, 5154.02, 57.89),},
[61] = { ["label"] = "Grape4", ["coords"] = vector3(1642.91, 4846.08, 45.51),},
[62] = { ["label"] = "Grape5", ["coords"] = vector3(1308.87, 4362.17, 41.55),},
[63] = { ["label"] = "Paleto1", ["coords"] = vector3(-1090.27, 4940.57, 214.13),},
[64] = { ["label"] = "Paleto2", ["coords"] = vector3(-552.37, 5348.37, 74.76),},
[65] = { ["label"] = "Paleto3", ["coords"] = vector3(-679.02, 5834.27, 17.33),},
[66] = { ["label"] = "Paleto4", ["coords"] = vector3(-481.97, 6276.93, 13.35),},
[67] = { ["label"] = "Paleto5", ["coords"] = vector3(-24.92, 6472.6, 31.49),},
[68] = { ["label"] = "Paleto6", ["coords"] = vector3(36.03, 6549.18, 31.43),},
[69] = { ["label"] = "Paleto6", ["coords"] = vector3(406.08, 6526.43, 27.75),},
[70] = { ["label"] = "Paleto7", ["coords"] = vector3(1522.39, 6329.23, 24.61),},
[71] = { ["label"] = "Paleto8", ["coords"] = vector3(1741.39, 6419.62, 35.04),},
[72] = { ["label"] = "Lighthouse", ["coords"] = vector3(3426.72, 5174.42, 7.4),},
[73] = { ["label"] = "EastSandy", ["coords"] = vector3(2525.99, 2586.62, 38.94),},
[74] = { ["label"] = "Power Station", ["coords"] = vector3(2696.29, 1664.44, 24.52),},
[75] = { ["label"] = "Stripclub", ["coords"] = vector3(106.24, -1280.32, 29.24),},
[76] = { ["label"] = "Vinewood Video", ["coords"] = vector3(223.98, 121.53, 102.76),},
[77] = { ["label"] = "Taxi", ["coords"] = vector3(882.67, -160.26, 77.11),},
[78] = { ["label"] = "Resort", ["coords"] = vector3(-1245.63, 376.21, 75.34),},
[79] = { ["label"] = "Bahama Mamas", ["coords"] = vector3(-1383.1, -639.99, 28.67),},
}
-- Delivery locations and items is now in server/deliveries.lua
-- cornerselling pricing and rep is now in server/cornerselling.lua
QBConfig.NoSellZones = {
{loc = vector3(445.11, -991.3, 30.69), width = 10.0, length = 10.0, height = 10.0, rot = 180.0},