initial push
This commit is contained in:
1 parent
4cacab3c7c
commit
36131995d4
24 files changed
+336
-206
No files matched your search
+24
-10
@@ -1,4 +1,3 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
|
|
||||||
local progressbartype = Config.progressbartype
|
local progressbartype = Config.progressbartype
|
||||||
local minigametype = Config.minigametype
|
local minigametype = Config.minigametype
|
||||||
@@ -6,11 +5,19 @@ local notifytype = Config.Notify
|
|||||||
local dispatch = Config.Dispatch
|
local dispatch = Config.Dispatch
|
||||||
|
|
||||||
function getJobType()
|
function getJobType()
|
||||||
return QBCore.Functions.GetPlayerData().job.type
|
if Config.Framework == 'qb' then
|
||||||
|
return QBCore.Functions.GetPlayerData().job.type
|
||||||
|
elseif Config.Framework == 'esx' then
|
||||||
|
return ESX.PlayerData.job.type
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function getJobName()
|
function getJobName()
|
||||||
return QBCore.Functions.GetPlayerData().job.name
|
if Config.Framework == 'qb' then
|
||||||
|
return QBCore.Functions.GetPlayerData().job.name
|
||||||
|
elseif Config.Framework == 'esx' then
|
||||||
|
return ESX.PlayerData.job.name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function progressbar(text, time, anim)
|
function progressbar(text, time, anim)
|
||||||
@@ -240,6 +247,7 @@ end
|
|||||||
function makeMenu(name, rep)
|
function makeMenu(name, rep)
|
||||||
local menu = {}
|
local menu = {}
|
||||||
local data = lib.callback.await('md-drugs:server:menu', false, name)
|
local data = lib.callback.await('md-drugs:server:menu', false, name)
|
||||||
|
print(data)
|
||||||
for k, v in pairs (data.table) do
|
for k, v in pairs (data.table) do
|
||||||
local allow = false
|
local allow = false
|
||||||
if rep == nil then
|
if rep == nil then
|
||||||
@@ -249,9 +257,9 @@ function makeMenu(name, rep)
|
|||||||
end
|
end
|
||||||
if allow then
|
if allow then
|
||||||
menu[#menu + 1] = {
|
menu[#menu + 1] = {
|
||||||
icon = GetImage(v.name),
|
icon = GetImage(v.name) or 'missing Item',
|
||||||
description = '$'.. v.price,
|
description = '$'.. v.price or 'Missing Item',
|
||||||
title = GetLabel(v.name),
|
title = GetLabel(v.name) or 'Missing Item',
|
||||||
onSelect = function()
|
onSelect = function()
|
||||||
local settext = "Cost: $"..v.price
|
local settext = "Cost: $"..v.price
|
||||||
local dialog = exports.ox_lib:inputDialog(v.name .."!", {
|
local dialog = exports.ox_lib:inputDialog(v.name .."!", {
|
||||||
@@ -445,7 +453,13 @@ function AddBoxZoneSingle(name, loc, data)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local function getGang()
|
||||||
|
if Config.Framework == 'qb' then
|
||||||
|
return QBCore.Functions.GetPlayerData().gang.name
|
||||||
|
elseif Config.Framework == 'esx' then
|
||||||
|
return ESX.GetPlayerData().job.name
|
||||||
|
end
|
||||||
|
end
|
||||||
function AddBoxZoneMulti(name, table, data)
|
function AddBoxZoneMulti(name, table, data)
|
||||||
for k, v in pairs (table) do
|
for k, v in pairs (table) do
|
||||||
if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
|
if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
|
||||||
@@ -460,7 +474,7 @@ function AddBoxZoneMulti(name, table, data)
|
|||||||
label = data.label,
|
label = data.label,
|
||||||
data = k,
|
data = k,
|
||||||
canInteract = data.canInteract or function()
|
canInteract = data.canInteract or function()
|
||||||
if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
|
if getGang() == v.gang or v.gang == 1 then return true end end
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
distance = 2.5
|
distance = 2.5
|
||||||
@@ -476,7 +490,7 @@ function AddBoxZoneMulti(name, table, data)
|
|||||||
data = k,
|
data = k,
|
||||||
distance = 2.5,
|
distance = 2.5,
|
||||||
canInteract = data.canInteract or function()
|
canInteract = data.canInteract or function()
|
||||||
if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
|
if getGang() == v.gang or v.gang == 1 then return true end end
|
||||||
}
|
}
|
||||||
}, })
|
}, })
|
||||||
elseif Config.Target == 'interact' then
|
elseif Config.Target == 'interact' then
|
||||||
@@ -494,7 +508,7 @@ function AddBoxZoneMulti(name, table, data)
|
|||||||
label = data.label or "fa-solid fa-eye",
|
label = data.label or "fa-solid fa-eye",
|
||||||
data = k,
|
data = k,
|
||||||
canInteract = data.canInteract or function()
|
canInteract = data.canInteract or function()
|
||||||
if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
|
if getGang() == v.gang or v.gang == 1 then return true end end
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ RegisterNetEvent("weed:init", function()
|
|||||||
lib.requestModel('prop_weed_01', 1000)
|
lib.requestModel('prop_weed_01', 1000)
|
||||||
if not v.taken then
|
if not v.taken then
|
||||||
WeedPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z-3.5, false, true, true)
|
WeedPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z-3.5, false, true, true)
|
||||||
print(WeedPlant[k])
|
|
||||||
Freeze(WeedPlant[k],true, v.heading)
|
Freeze(WeedPlant[k],true, v.heading)
|
||||||
AddSingleModel(WeedPlant[k], {icon = "fas fa-hand",label = Lang.targets.weed.pick, action = function() pick(k) end}, k)
|
AddSingleModel(WeedPlant[k], {icon = "fas fa-hand",label = Lang.targets.weed.pick, action = function() pick(k) end}, k)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `dealers` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(50) NOT NULL DEFAULT '0',
|
||||||
|
`coords` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||||
|
`time` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||||
|
`createdby` varchar(50) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `deliveriesdealer` (
|
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,
|
||||||
|
|||||||
+8
-8
@@ -81,7 +81,7 @@ RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
|
|||||||
}
|
}
|
||||||
for _, v in ipairs(cokeTiers) do
|
for _, v in ipairs(cokeTiers) do
|
||||||
if count >= 1 then break end
|
if count >= 1 then break end
|
||||||
if Player.Functions.GetItemByName(v.item) then
|
if hasItem(src, v.item, 1) then
|
||||||
tier = v.tier
|
tier = v.tier
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
@@ -110,7 +110,7 @@ RegisterServerEvent('md-drugs:server:bagcoke', function(num)
|
|||||||
{item = 'loosecokestagethree', tier = 'tier3', log = ' Bagged Coke tier 3'}
|
{item = 'loosecokestagethree', tier = 'tier3', log = ' Bagged Coke tier 3'}
|
||||||
}
|
}
|
||||||
for _, v in ipairs(cokeTiers) do
|
for _, v in ipairs(cokeTiers) do
|
||||||
if Player.Functions.GetItemByName(v.item) then
|
if hasItem(src, v.item, 1) then
|
||||||
if count >= 1 then break end
|
if count >= 1 then break end
|
||||||
count = count + 1
|
count = count + 1
|
||||||
tier = v.tier
|
tier = v.tier
|
||||||
@@ -128,14 +128,14 @@ for k, v in pairs (cokecut) do
|
|||||||
CUI(k, function(source, item)
|
CUI(k, function(source, item)
|
||||||
local src = source
|
local src = source
|
||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
if not Player.Functions.GetItemByName('bakingsoda') then Notifys(src, 'You Need Baking Soda For this', 'error') return end
|
if not hasItem(src, 'bakingsoda', 1) then Notifys(src, 'You Need Baking Soda For this', 'error') return end
|
||||||
if Player.Functions.GetItemByName(item.name) then
|
if hasItem(src, k, 1) then
|
||||||
if not Itemcheck(src, 'bakingsoda', 1) then return end
|
if not Itemcheck(src, 'bakingsoda', 1) then return end
|
||||||
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting It Further')
|
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting It Further')
|
||||||
if not check then return end
|
if not check then return end
|
||||||
if RemoveItem(src, k, 1) and RemoveItem(src, 'bakingsoda', 1) then
|
if RemoveItem(src, k, 1) and RemoveItem(src, 'bakingsoda', 1) then
|
||||||
AddItem(src, 'loosecoke', v)
|
AddItem(src, 'loosecoke', v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
+54
-20
@@ -1,4 +1,4 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
--[[
|
--[[
|
||||||
effect options
|
effect options
|
||||||
alien
|
alien
|
||||||
@@ -158,24 +158,58 @@ for k, v in pairs(Consume) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
|
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
|
||||||
local Player = getPlayer(source)
|
local source = source
|
||||||
local hunger, thirst = Player.PlayerData.metadata.hunger, Player.PlayerData.metadata.thirst
|
local hunger, thirst, stress, armor
|
||||||
if stat == "thirst" then
|
if Config.Framework == "qb" then
|
||||||
local value = thirst + statval
|
local Player = QBCore.Functions.GetPlayer(source)
|
||||||
Player.Functions.SetMetaData('thirst', value)
|
hunger = Player.PlayerData.metadata["hunger"]
|
||||||
TriggerClientEvent('hud:client:UpdateNeeds', source, hunger, value)
|
thirst = Player.PlayerData.metadata["thirst"]
|
||||||
elseif stat == "hunger" then
|
stress = Player.PlayerData.metadata["stress"]
|
||||||
local value = hunger + statval
|
armor = Player.PlayerData.metadata["armor"]
|
||||||
Player.Functions.SetMetaData('hunger', value)
|
|
||||||
TriggerClientEvent('hud:client:UpdateNeeds', source, value, thirst)
|
if stat == "thirst" then
|
||||||
elseif stat == "stress" then
|
local value = math.min(thirst + statval, 100)
|
||||||
local value = Player.PlayerData.metadata.stress + statval
|
Player.Functions.SetMetaData('thirst', value)
|
||||||
Player.Functions.SetMetaData('stress', value)
|
TriggerClientEvent('hud:client:UpdateNeeds', source, hunger, value)
|
||||||
TriggerClientEvent('hud:client:UpdateStress', source, Player.PlayerData.metadata.stress, value)
|
elseif stat == "hunger" then
|
||||||
elseif stat == "armor" then
|
local value = math.min(hunger + statval, 100)
|
||||||
local value = Player.PlayerData.metadata.armor + statval
|
Player.Functions.SetMetaData('hunger', value)
|
||||||
TriggerEvent('hospital:server:SetArmor', value)
|
TriggerClientEvent('hud:client:UpdateNeeds', source, value, thirst)
|
||||||
TriggerClientEvent('hud:client:UpdateStress', source, Player.PlayerData.metadata.armor, value)
|
elseif stat == "stress" then
|
||||||
else
|
local value = math.min(stress + statval, 100)
|
||||||
|
Player.Functions.SetMetaData('stress', value)
|
||||||
|
TriggerClientEvent('hud:client:UpdateStress', source, Player.PlayerData.metadata.stress, value)
|
||||||
|
elseif stat == "armor" then
|
||||||
|
local value = math.min(armor + statval, 100)
|
||||||
|
Player.Functions.SetMetaData('armor', value)
|
||||||
|
TriggerEvent('hospital:server:SetArmor', value)
|
||||||
|
TriggerClientEvent('hud:client:UpdateArmor', source, armor, value)
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif Config.Framework == "esx" then
|
||||||
|
local Player = getPlayer(source)
|
||||||
|
if not Player then return end
|
||||||
|
hunger = Player.get('hunger') or 0
|
||||||
|
thirst = Player.get('thirst') or 0
|
||||||
|
stress = Player.get('stress') or 0
|
||||||
|
armor = GetPedArmour(GetPlayerPed(source))
|
||||||
|
|
||||||
|
if stat == "thirst" then
|
||||||
|
local value = math.min(thirst + statval, 100)
|
||||||
|
Player.set('thirst', value)
|
||||||
|
TriggerClientEvent('hud:client:UpdateNeeds', source, hunger, value)
|
||||||
|
elseif stat == "hunger" then
|
||||||
|
local value = math.min(hunger + statval, 100)
|
||||||
|
Player.set('hunger', value)
|
||||||
|
TriggerClientEvent('hud:client:UpdateNeeds', source, value, thirst)
|
||||||
|
elseif stat == "stress" then
|
||||||
|
local value = math.min(stress + statval, 100)
|
||||||
|
Player.set('stress', value)
|
||||||
|
TriggerClientEvent('hud:client:UpdateStress', source, stress, value)
|
||||||
|
elseif stat == "armor" then
|
||||||
|
local value = math.min(armor + statval, 100)
|
||||||
|
SetPedArmour(GetPlayerPed(source), value)
|
||||||
|
TriggerClientEvent('hud:client:UpdateArmor', source, armor, value)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
+17
-36
@@ -1,4 +1,4 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
local DrugDeals = {}
|
local DrugDeals = {}
|
||||||
local Drugs = {
|
local Drugs = {
|
||||||
["weed_white-widow"] = {rep = 1,min = 15, max = 24 },
|
["weed_white-widow"] = {rep = 1,min = 15, max = 24 },
|
||||||
@@ -125,29 +125,26 @@ lib.callback.register('md-drugs:server:cornerselling:getAvailableDrugs', functio
|
|||||||
local Player = getPlayer(source)
|
local Player = getPlayer(source)
|
||||||
local rep = getRep(source, 'cornerselling')
|
local rep = getRep(source, 'cornerselling')
|
||||||
if not Player then return nil end
|
if not Player then return nil end
|
||||||
local type = 0
|
|
||||||
for k, v in pairs(Drugs) do
|
for k, v in pairs(Drugs) do
|
||||||
local item = Player.Functions.GetItemByName(k)
|
local item = getItemCount(source, k)
|
||||||
if item and type == 0 then
|
if item >= 1 then
|
||||||
type = type + 1
|
if item > 15 then item = 15 end
|
||||||
Log(GetName(source) .. ' Allowed To Sell ' .. item.name .. '!' , 'cornerselling')
|
Log(GetName(source) .. ' Allowed To Sell ' .. k .. '!' , 'cornerselling')
|
||||||
local amount = math.random(1,item.amount)
|
local amount = math.random(1, item)
|
||||||
if amount >= 15 then amount = 15 end
|
if amount >= 15 then amount = 15 end
|
||||||
local price = math.random(Drugs[k]['min'], Drugs[k]['max']) * amount
|
local price = math.random(Drugs[k]['min'], Drugs[k]['max']) * amount
|
||||||
local result = math.floor(price * rep.price)
|
local result = math.floor(price * rep.price)
|
||||||
table.insert(DrugDeals, {item = item.name, amount = amount, price = result, cid = Player.PlayerData.citizenid, ped = ped})
|
table.insert(DrugDeals, {item = k, amount = amount, price = result, cid = getCid(source), ped = ped})
|
||||||
return {item = item.name, amount = amount, price = result, ped = ped}
|
return {item = k, amount = amount, price = result, ped = ped}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if type == 0 then
|
return {item = 'nothing', amount = 0, price = 0, ped = ped}
|
||||||
return {item = 'nothing', amount = 0, price = 0, ped = ped}
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
lib.callback.register('md-drugs:server:hasDrugs', function(source)
|
lib.callback.register('md-drugs:server:hasDrugs', function(source)
|
||||||
local Player = getPlayer(source)
|
local Player = getPlayer(source)
|
||||||
for k, v in pairs(Drugs) do
|
for k, v in pairs(Drugs) do
|
||||||
local item = Player.Functions.GetItemByName(k)
|
local item = hasItem(source, k, 1)
|
||||||
if item then
|
if item then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -165,28 +162,12 @@ RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not isIn then return end
|
if not isIn then return end
|
||||||
for k, v in pairs (DrugDeals) do
|
for k, v in pairs (DrugDeals) do
|
||||||
if v.cid == Player.PlayerData.citizenid then
|
if v.cid == getCid(source) and v.item == item and v.amount == amount and v.price == price then
|
||||||
if v.item == item then
|
if handleCornersell(src, item, amount, price) then
|
||||||
if v.amount == amount then
|
AddRep(src, 'cornerselling', Drugs[item].rep * amount)
|
||||||
if v.price == price then
|
Log(GetName(src) .. ' Sold ' .. amount .. ' Of ' .. item .. ' For A Price Of ' .. price .. '!' , 'cornerselling')
|
||||||
if RemoveItem(src, item, amount) then
|
table.remove(DrugDeals, k)
|
||||||
if QBConfig.MarkedBills then
|
|
||||||
local info = {
|
|
||||||
worth = price
|
|
||||||
}
|
|
||||||
Player.Functions.AddItem('markedbills', 1, false, info )
|
|
||||||
elseif QBConfig.CustomDirtyMoney == true then
|
|
||||||
AddItem(src, QBConfig.CustomDirtyMoneyitem, price)
|
|
||||||
else
|
|
||||||
Player.Functions.AddMoney('cash', price)
|
|
||||||
end
|
|
||||||
AddRep(src, 'cornerselling', Drugs[item].rep * amount)
|
|
||||||
Log(GetName(src) .. ' Sold ' .. amount .. ' Of ' .. item .. ' For A Price Of ' .. price .. '!' , 'cornerselling')
|
|
||||||
table.remove(DrugDeals, k)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -207,7 +188,7 @@ RegisterServerEvent('md-drugs:server:cornerselling:stop', function()
|
|||||||
local src = source
|
local src = source
|
||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
for k, v in pairs (DrugDeals) do
|
for k, v in pairs (DrugDeals) do
|
||||||
if v.cid == Player.PlayerData.citizenid then
|
if v.cid == getCid(source) then
|
||||||
TriggerClientEvent('md-drugs:client:cornerselling:remove', src, DrugDeals[k].ped)
|
TriggerClientEvent('md-drugs:client:cornerselling:remove', src, DrugDeals[k].ped)
|
||||||
table.remove(DrugDeals, k)
|
table.remove(DrugDeals, k)
|
||||||
end
|
end
|
||||||
|
|||||||
+3
-4
@@ -1,4 +1,3 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
|
|
||||||
RegisterServerEvent('md-drugs:server:makecrackone', function(num)
|
RegisterServerEvent('md-drugs:server:makecrackone', function(num)
|
||||||
local src = source
|
local src = source
|
||||||
@@ -13,7 +12,7 @@ RegisterServerEvent('md-drugs:server:makecrackone', function(num)
|
|||||||
}
|
}
|
||||||
for _, v in ipairs(crackTiers) do
|
for _, v in ipairs(crackTiers) do
|
||||||
if count >= 1 then break end
|
if count >= 1 then break end
|
||||||
if Player.Functions.GetItemByName(v.item) then
|
if hasItem(src, v.item, 1) then
|
||||||
tier = v.tier
|
tier = v.tier
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
@@ -36,7 +35,7 @@ RegisterServerEvent('md-drugs:server:bagcrack', function(num)
|
|||||||
}
|
}
|
||||||
for _, v in ipairs(crackTiers) do
|
for _, v in ipairs(crackTiers) do
|
||||||
if count >= 1 then break end
|
if count >= 1 then break end
|
||||||
if Player.Functions.GetItemByName(v.item) then
|
if hasItem(src, v.item, 1) then
|
||||||
tier = v.tier
|
tier = v.tier
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
@@ -50,7 +49,7 @@ for k, v in pairs (cokecut) do
|
|||||||
CUI(k, function(source, item)
|
CUI(k, function(source, item)
|
||||||
local src = source
|
local src = source
|
||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
if Player.Functions.GetItemByName(item.name) then
|
if hasItem(src, k, 1) then
|
||||||
if not Itemcheck(src, 'bakingsoda', 1) then return end
|
if not Itemcheck(src, 'bakingsoda', 1) then return end
|
||||||
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting Crack Rock Further')
|
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting Crack Rock Further')
|
||||||
if not check then return end
|
if not check then return end
|
||||||
|
|||||||
+10
-11
@@ -1,4 +1,3 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
|
|
||||||
local dloc = {
|
local dloc = {
|
||||||
{coords = vector4(282.48, -1814.32, 27.23, 145.11)},
|
{coords = vector4(282.48, -1814.32, 27.23, 145.11)},
|
||||||
@@ -105,7 +104,7 @@ lib.callback.register('md-drugs:server:GetDeliveryItem', function(data)
|
|||||||
local itemnum = math.random(1, #DeliveryItems)
|
local itemnum = math.random(1, #DeliveryItems)
|
||||||
local item = DeliveryItems[itemnum].item
|
local item = DeliveryItems[itemnum].item
|
||||||
local amount = math.random(1,4)
|
local amount = math.random(1,4)
|
||||||
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
|
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {getCid(src)})
|
||||||
local locnum = math.random(1, #dloc)
|
local locnum = math.random(1, #dloc)
|
||||||
local coord = json.encode({
|
local coord = json.encode({
|
||||||
x = dloc[locnum].coords.x,
|
x = dloc[locnum].coords.x,
|
||||||
@@ -115,14 +114,14 @@ lib.callback.register('md-drugs:server:GetDeliveryItem', function(data)
|
|||||||
})
|
})
|
||||||
if not check[1] then
|
if not check[1] then
|
||||||
MySQL.insert('INSERT INTO deliveriesdealer SET cid = ?, itemdata = ?, timestart = ?, maxtime = ?, location = ?',
|
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 })
|
{getCid(src), json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
|
||||||
AddItem(Player.PlayerData.source, item, amount)
|
AddItem(src, item, amount)
|
||||||
return true, item, amount, coord
|
return true, item, amount, coord
|
||||||
else
|
else
|
||||||
local time = os.time()
|
local time = os.time()
|
||||||
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
|
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
|
if timeout > 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {getCid(src)}) Notifys(src, 'You Failed To Make It In Time!', 'error' ) return false end
|
||||||
Notifys(src,'You Already Have A Delivery To Make', 'error' ) return false, item, amount, coord
|
Notifys(src,'You Already Have A Delivery To Make', 'error' ) return false, item, amount, coord
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -130,23 +129,23 @@ end)
|
|||||||
RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount)
|
RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount)
|
||||||
local src = source
|
local src = source
|
||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
|
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {getCid(src)})
|
||||||
if not check[1] then return end
|
if not check[1] then return end
|
||||||
local time = os.time()
|
local time = os.time()
|
||||||
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
|
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
|
||||||
local itemData = json.decode(check[1].itemdata)
|
local itemData = json.decode(check[1].itemdata)
|
||||||
if timeout >= 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) Notifys(source, 'You Failed To Make It In Time!', 'error' ) return end
|
if timeout >= 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {getCid(src)}) Notifys(source, 'You Failed To Make It In Time!', 'error' ) return end
|
||||||
if item ~= itemData.item then return end
|
if item ~= itemData.item then return end
|
||||||
if amount ~= itemData.amount then return end
|
if amount ~= itemData.amount then return end
|
||||||
if RemoveItem(src, item, amount) then
|
if RemoveItem(src, item, amount) then
|
||||||
for k, v in pairs (DeliveryItems) do
|
for k, v in pairs (DeliveryItems) do
|
||||||
if v.item == item then
|
if v.item == item then
|
||||||
local income = math.random(v.payout.min, v.payout.max)
|
local income = math.random(v.payout.min, v.payout.max)
|
||||||
Player.Functions.AddMoney('cash', income)
|
addMoney(src, 'cash', income)
|
||||||
AddRep(src, 'dealerrep')
|
AddRep(src, 'dealerrep')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
|
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {getCid(src)})
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -173,7 +172,7 @@ lib.addCommand("newdealer", {
|
|||||||
end
|
end
|
||||||
|
|
||||||
MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', {
|
MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', {
|
||||||
dealerName, pos, 'nil', Player.PlayerData.citizenid
|
dealerName, pos, 'nil', getCid(source)
|
||||||
}, function()
|
}, function()
|
||||||
QBConfig.Dealers[dealerName] = {
|
QBConfig.Dealers[dealerName] = {
|
||||||
name = dealerName,
|
name = dealerName,
|
||||||
|
|||||||
+172
-81
@@ -1,4 +1,4 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
local QBCore, ESX = {}, {}
|
||||||
local notify = Config.Notify -- qb or ox
|
local notify = Config.Notify -- qb or ox
|
||||||
local inventory = Config.Inventory -- qb or ox
|
local inventory = Config.Inventory -- qb or ox
|
||||||
------------------------------------------ logging stuff
|
------------------------------------------ logging stuff
|
||||||
@@ -6,9 +6,15 @@ local logs = false
|
|||||||
local logapi = GetConvar("fivemerrLogs", "")
|
local logapi = GetConvar("fivemerrLogs", "")
|
||||||
local endpoint = 'https://api.fivemerr.com/v1/logs'
|
local endpoint = 'https://api.fivemerr.com/v1/logs'
|
||||||
local headers = {
|
local headers = {
|
||||||
['Authorization'] = logapi,
|
['Authorization'] = logapi,
|
||||||
['Content-Type'] = 'application/json',
|
['Content-Type'] = 'application/json',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if Config.Framework == 'qb' then
|
||||||
|
QBCore = exports['qb-core']:GetCoreObject()
|
||||||
|
elseif Config.Framework == 'esx' then
|
||||||
|
ESX = exports['es_extended']:getSharedObject()
|
||||||
|
end
|
||||||
|
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
if logs then
|
if logs then
|
||||||
@@ -53,21 +59,42 @@ CreateThread(function()
|
|||||||
elseif GetResourceState('qb-inventory') == 'started' then
|
elseif GetResourceState('qb-inventory') == 'started' then
|
||||||
invname = 'qb-inventory'
|
invname = 'qb-inventory'
|
||||||
else
|
else
|
||||||
invname = 'inventory'
|
invname = 'inventory'
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
------------------------------------ Player Stuff functions
|
------------------------------------ Player Stuff functions
|
||||||
function getPlayer(source)
|
function getPlayer(source)
|
||||||
local src = source
|
local src = source
|
||||||
local Player = QBCore.Functions.GetPlayer(src)
|
if Config.Framework == 'qb' then
|
||||||
return Player
|
local Player = QBCore.Functions.GetPlayer(src)
|
||||||
|
return Player
|
||||||
|
elseif Config.Framework == 'esx' then
|
||||||
|
local Player = ESX.GetPlayerFromId(src)
|
||||||
|
return Player
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GetName(source)
|
function GetName(source)
|
||||||
local Player = getPlayer(source)
|
local src = source
|
||||||
return Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname
|
if Config.Framework == 'qb' then
|
||||||
|
local Player = getPlayer(src)
|
||||||
|
return Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname
|
||||||
|
elseif Config.Framework == 'esx' then
|
||||||
|
local Player = getPlayer(src)
|
||||||
|
return Player.getName()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function getCid(source)
|
||||||
|
local src = source
|
||||||
|
if Config.Framework == 'qb' then
|
||||||
|
local Player = getPlayer(src)
|
||||||
|
return Player.PlayerData.citizenid
|
||||||
|
elseif Config.Framework == 'esx' then
|
||||||
|
local Player = getPlayer(src)
|
||||||
|
return Player.getIdentifier()
|
||||||
|
end
|
||||||
|
end
|
||||||
function GetCoords(source)
|
function GetCoords(source)
|
||||||
local ped = GetPlayerPed(source)
|
local ped = GetPlayerPed(source)
|
||||||
local playerCoords = GetEntityCoords(ped)
|
local playerCoords = GetEntityCoords(ped)
|
||||||
@@ -117,7 +144,11 @@ function GetLabels(item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function CUI(item, useFunction)
|
function CUI(item, useFunction)
|
||||||
QBCore.Functions.CreateUseableItem(item, useFunction)
|
if Config.Framework == 'qb' then
|
||||||
|
QBCore.Functions.CreateUseableItem(item, useFunction)
|
||||||
|
elseif Config.Framework == 'esx' then
|
||||||
|
ESX.RegisterUsableItem(item, useFunction)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Itemcheck(source, item, amount)
|
function Itemcheck(source, item, amount)
|
||||||
@@ -131,9 +162,9 @@ function Itemcheck(source, item, amount)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
elseif inventory == 'ox' then
|
elseif inventory == 'ox' then
|
||||||
local items = exports.ox_inventory:GetItem(source, item, nil, false)
|
local items = exports.ox_inventory:GetItem(source, item, nil, false)
|
||||||
if items.count >= amount then
|
if items.count >= amount then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
Notifys(source, 'You Need ' .. amount .. ' Of ' .. GetLabels(item) .. ' To Do This', 'error')
|
Notifys(source, 'You Need ' .. amount .. ' Of ' .. GetLabels(item) .. ' To Do This', 'error')
|
||||||
return false
|
return false
|
||||||
@@ -141,6 +172,48 @@ function Itemcheck(source, item, amount)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function hasItem(source, item, amount)
|
||||||
|
if inventory == 'qb' then
|
||||||
|
local Player = getPlayer(source)
|
||||||
|
local itemchecks = Player.Functions.GetItemByName(item)
|
||||||
|
if itemchecks and itemchecks.amount >= amount then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
elseif inventory == 'ox' then
|
||||||
|
local items = exports.ox_inventory:GetItem(source, item, nil, false)
|
||||||
|
if items == nil then return false end
|
||||||
|
if items.count >= amount then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function getItemCount(source, item)
|
||||||
|
if inventory == 'qb' then
|
||||||
|
local Player = getPlayer(source)
|
||||||
|
local itemchecks = Player.Functions.GetItemByName(item)
|
||||||
|
if itemchecks then
|
||||||
|
return itemchecks.amount
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
elseif inventory == 'ox' then
|
||||||
|
local items = exports.ox_inventory:GetItem(source, item, nil, false)
|
||||||
|
if items == nil then
|
||||||
|
print('You are missing ' .. item)
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
if items.count >= 1 then
|
||||||
|
return items.count
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
function RemoveItem(source, item, amount)
|
function RemoveItem(source, item, amount)
|
||||||
if inventory == 'qb' then
|
if inventory == 'qb' then
|
||||||
local Player = getPlayer(source)
|
local Player = getPlayer(source)
|
||||||
@@ -162,16 +235,14 @@ end
|
|||||||
function AddItem(source, item, amount)
|
function AddItem(source, item, amount)
|
||||||
if inventory == 'qb' then
|
if inventory == 'qb' then
|
||||||
local Player = getPlayer(source)
|
local Player = getPlayer(source)
|
||||||
if Player.Functions.AddItem(item, amount) then
|
if Player.Functions.AddItem(item, amount) then
|
||||||
TriggerClientEvent(invname ..":client:ItemBox", source, QBCore.Shared.Items[item], "add", amount)
|
TriggerClientEvent(invname ..":client:ItemBox", source, QBCore.Shared.Items[item], "add", amount)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
print('Failed To Give Item: ' .. item .. ' Check Your qb-core/shared/items.lua')
|
print('Failed To Give Item: ' .. item .. ' Check Your qb-core/shared/items.lua')
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local carry = exports.ox_inventory:CanCarryItem(source, item, amount)
|
|
||||||
if not carry then Notifys(source, 'You Cant Carry that Much Weight!', 'error') return false end
|
|
||||||
if exports.ox_inventory:AddItem(source, item, amount) then
|
if exports.ox_inventory:AddItem(source, item, amount) then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@@ -181,66 +252,69 @@ function AddItem(source, item, amount)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function addMoney(source, type, amount)
|
||||||
|
if Config.Framework == 'qb' then
|
||||||
|
local Player = getPlayer(source)
|
||||||
|
if Player.Functions.AddMoney(type, amount) then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
elseif Config.Framework == 'esx' then
|
||||||
|
local Player = getPlayer(source)
|
||||||
|
if Player.addMoney(amount) then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function getRep(source, type)
|
function removeMoney(source, type, amount)
|
||||||
local Player = getPlayer(source)
|
if Config.Framework == 'qb' then
|
||||||
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
|
local Player = getPlayer(source)
|
||||||
|
if Player.Functions.RemoveMoney(type, amount) then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
elseif Config.Framework == 'esx' then
|
||||||
|
local Player = getPlayer(source)
|
||||||
|
Player.removeMoney(amount)
|
||||||
|
print(Player.removeMoney(amount))
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function handleFresh(source)
|
||||||
|
local table = json.encode({
|
||||||
|
coke = 0,lsd = 0,heroin = 0,dealerrep = 0,
|
||||||
|
cornerselling = { price = QBConfig.SellLevel[1].price,rep = 0,label = QBConfig.SellLevel[1].label,level = 1}
|
||||||
|
})
|
||||||
|
MySQL.insert('INSERT INTO drugrep SET cid = ?, drugrep = ?, name = ?', {getCid(source), table, GetName(source)})
|
||||||
|
Wait(1000)
|
||||||
|
return json.decode(table)
|
||||||
|
end
|
||||||
|
|
||||||
|
function getRep(source, type)
|
||||||
|
local Player = getPlayer(source)
|
||||||
|
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {getCid(source)})
|
||||||
if not sql[1] then
|
if not sql[1] then
|
||||||
local table = json.encode({
|
local new = handleFresh(source)
|
||||||
coke = Player.PlayerData.metadata.coke or 0,
|
return new[type]
|
||||||
lsd = Player.PlayerData.metadata.lsd or 0,
|
|
||||||
heroin = Player.PlayerData.metadata.heroin or 0,
|
|
||||||
dealerrep = Player.PlayerData.metadata.dealerrep or 0,
|
|
||||||
cornerselling = {
|
|
||||||
price = QBConfig.SellLevel[1].price,
|
|
||||||
rep = 0,
|
|
||||||
label = QBConfig.SellLevel[1].label,
|
|
||||||
level = 1
|
|
||||||
}
|
|
||||||
})
|
|
||||||
MySQL.insert('INSERT INTO drugrep SET cid = ?, drugrep = ?, name = ?', {Player.PlayerData.citizenid, table, GetName(source)})
|
|
||||||
Wait(1000)
|
|
||||||
return json.decode(table)
|
|
||||||
else
|
else
|
||||||
local reps = json.decode(sql[1].drugrep)
|
local reps = json.decode(sql[1].drugrep)
|
||||||
local rep = ''
|
local rep = ''
|
||||||
if reps.coke == nil then rep = reps[1] else rep = reps end
|
if reps.coke == nil then rep = reps[1] else rep = reps end
|
||||||
if type == 'coke' then
|
return rep[type]
|
||||||
return rep.coke
|
|
||||||
elseif type == 'heroin' then
|
|
||||||
return rep.heroin
|
|
||||||
elseif type == 'lsd' then
|
|
||||||
return rep.lsd
|
|
||||||
elseif type == 'dealerrep' then
|
|
||||||
return rep.dealerrep
|
|
||||||
elseif type == 'cornerselling' then
|
|
||||||
return rep.cornerselling
|
|
||||||
else
|
|
||||||
print('^1 Error: No Valid Drug Rep Option Chosen')
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GetAllRep(source)
|
function GetAllRep(source)
|
||||||
local Player = getPlayer(source)
|
local Player = getPlayer(source)
|
||||||
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
|
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {getCid(source)})
|
||||||
if not sql[1] then
|
if not sql[1] then
|
||||||
local table = json.encode({
|
local new = handleFresh(source)
|
||||||
coke = Player.PlayerData.metadata.coke or 0,
|
return new
|
||||||
lsd = Player.PlayerData.metadata.lsd or 0,
|
|
||||||
heroin = Player.PlayerData.metadata.heroin or 0,
|
|
||||||
dealerrep = Player.PlayerData.metadata.dealerrep or 0,
|
|
||||||
cornerselling = {
|
|
||||||
price = QBConfig.SellLevel[1].price,
|
|
||||||
rep = 0,
|
|
||||||
label = QBConfig.SellLevel[1].label,
|
|
||||||
level = 1
|
|
||||||
}
|
|
||||||
})
|
|
||||||
MySQL.insert('INSERT INTO drugrep SET cid = ?, drugrep = ?, name = ?', {Player.PlayerData.citizenid, table, GetName(source)})
|
|
||||||
Wait(1000)
|
|
||||||
return json.decode(table)
|
|
||||||
else
|
else
|
||||||
local rep = json.decode(sql[1].drugrep)
|
local rep = json.decode(sql[1].drugrep)
|
||||||
if rep.coke == nil then return rep[1] end
|
if rep.coke == nil then return rep[1] end
|
||||||
@@ -251,7 +325,7 @@ end
|
|||||||
function AddRep(source, type, amount)
|
function AddRep(source, type, amount)
|
||||||
if not amount then amount = 1 end
|
if not amount then amount = 1 end
|
||||||
local Player = getPlayer(source)
|
local Player = getPlayer(source)
|
||||||
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
|
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {getCid(source)})
|
||||||
local reps = json.decode(sql[1].drugrep)
|
local reps = json.decode(sql[1].drugrep)
|
||||||
local update
|
local update
|
||||||
local rep = ''
|
local rep = ''
|
||||||
@@ -265,19 +339,15 @@ function AddRep(source, type, amount)
|
|||||||
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = {label = v.label, price = v.price, rep = rep.cornerselling.rep + amount, level = k}})
|
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = {label = v.label, price = v.price, rep = rep.cornerselling.rep + amount, level = k}})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif type == 'coke' then
|
if update == '' then return false end
|
||||||
update = json.encode({coke = rep.coke + amount, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = rep.cornerselling})
|
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, getCid(source)})
|
||||||
elseif type == 'heroin' then
|
return true
|
||||||
update = json.encode({coke = rep.coke, heroin = rep.heroin + amount, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = rep.cornerselling})
|
else
|
||||||
elseif type == 'lsd' then
|
rep[type] = rep[type] + amount
|
||||||
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd +amount , dealerrep = rep.dealerrep, cornerselling = rep.cornerselling})
|
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {json.encode(rep), getCid(source)})
|
||||||
elseif type == 'dealerrep' then
|
return true
|
||||||
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep + amount, cornerselling = rep.cornerselling})
|
|
||||||
end
|
end
|
||||||
if update == '' then return false end
|
|
||||||
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, Player.PlayerData.citizenid})
|
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
lib.addCommand('addCornerSellingTOREP', {
|
lib.addCommand('addCornerSellingTOREP', {
|
||||||
@@ -323,6 +393,27 @@ function getCops()
|
|||||||
return amount
|
return amount
|
||||||
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
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args)
|
lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args)
|
||||||
local amount = 0
|
local amount = 0
|
||||||
local players = QBCore.Functions.GetQBPlayers()
|
local players = QBCore.Functions.GetQBPlayers()
|
||||||
|
|||||||
+5
-5
@@ -1,4 +1,4 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
local prices = {
|
local prices = {
|
||||||
heroinlabkitprice = 10000
|
heroinlabkitprice = 10000
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ end
|
|||||||
lib.callback.register('removeCleaningkit', function(source)
|
lib.callback.register('removeCleaningkit', function(source)
|
||||||
local Player = getPlayer(source)
|
local Player = getPlayer(source)
|
||||||
for k, v in pairs(heroinLabKits) do
|
for k, v in pairs(heroinLabKits) do
|
||||||
if v.ownerid == Player.PlayerData.citizenid then
|
if v.ownerid == getCid(source) then
|
||||||
RemoveItem(source, 'cleaningkit', 1)
|
RemoveItem(source, 'cleaningkit', 1)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -117,7 +117,7 @@ local function hasHKit(src)
|
|||||||
local src = source
|
local src = source
|
||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
for k, v in pairs(heroinLabKits) do
|
for k, v in pairs(heroinLabKits) do
|
||||||
if v.ownerid == Player.PlayerData.citizenid then
|
if v.ownerid == getCid(source) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -129,7 +129,7 @@ RegisterServerEvent('md-drugs:server:getheroinlabkitback', function()
|
|||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
if not hasHKit(src) then return end
|
if not hasHKit(src) then return end
|
||||||
for k, v in pairs (heroinLabKits) do
|
for k, v in pairs (heroinLabKits) do
|
||||||
if v.ownerid == Player.PlayerData.citizenid then
|
if v.ownerid == getCid(source) then
|
||||||
table.remove(heroinLabKits, k)
|
table.remove(heroinLabKits, k)
|
||||||
AddItem(src, 'heroinlabkit', 1)
|
AddItem(src, 'heroinlabkit', 1)
|
||||||
end
|
end
|
||||||
@@ -146,7 +146,7 @@ CUI('heroinlabkit', function(source, item)
|
|||||||
RemoveItem(src, 'heroinlabkit', 1)
|
RemoveItem(src, 'heroinlabkit', 1)
|
||||||
table.insert(heroinLabKits, {
|
table.insert(heroinLabKits, {
|
||||||
src = src,
|
src = src,
|
||||||
ownerid = Player.PlayerData.citizenid,
|
ownerid = getCid(source),
|
||||||
coords = loc,
|
coords = loc,
|
||||||
name = GetName(src)
|
name = GetName(src)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
|
|
||||||
RegisterServerEvent('md-drugs:server:givelean', function()
|
RegisterServerEvent('md-drugs:server:givelean', function()
|
||||||
local chance = math.random(1,100)
|
local chance = math.random(1,100)
|
||||||
|
|||||||
@@ -112,6 +112,10 @@ local Target = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkLoc(source, event, num)
|
function checkLoc(source, event, num)
|
||||||
|
print('Checking Location')
|
||||||
|
print('Event: ' .. event)
|
||||||
|
print('Num: ' .. num)
|
||||||
|
|
||||||
local ped = source
|
local ped = source
|
||||||
local pos = GetPlayerPed(ped)
|
local pos = GetPlayerPed(ped)
|
||||||
local coord = GetEntityCoords(pos)
|
local coord = GetEntityCoords(pos)
|
||||||
@@ -123,6 +127,7 @@ function checkLoc(source, event, num)
|
|||||||
end
|
end
|
||||||
local dist = #(coord - loc)
|
local dist = #(coord - loc)
|
||||||
if dist < 2.5 then
|
if dist < 2.5 then
|
||||||
|
print(GetName(source) .. ' Triggered the table ' .. event .. ' Within The Correct Distance')
|
||||||
Log(GetName(source) .. ' Triggered the table ' .. event .. ' Within The Correct Distance', 'locations')
|
Log(GetName(source) .. ' Triggered the table ' .. event .. ' Within The Correct Distance', 'locations')
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
|||||||
+5
-5
@@ -1,4 +1,4 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
local prices = {
|
local prices = {
|
||||||
tabcost = 100, -- price per piece of tab paper event does 10 at a time
|
tabcost = 100, -- price per piece of tab paper event does 10 at a time
|
||||||
lsdlabkitcost = 10000 -- price of the lsd lab kit
|
lsdlabkitcost = 10000 -- price of the lsd lab kit
|
||||||
@@ -28,7 +28,7 @@ CUI('lsdlabkit', function(source, item)
|
|||||||
if RemoveItem(src, 'lsdlabkit', 1) then
|
if RemoveItem(src, 'lsdlabkit', 1) then
|
||||||
table.insert(lsdTables, {
|
table.insert(lsdTables, {
|
||||||
owner = GetName(src),
|
owner = GetName(src),
|
||||||
ownerid = Player.PlayerData.citizenid,
|
ownerid = getCid(source),
|
||||||
src = src,
|
src = src,
|
||||||
loc = loc
|
loc = loc
|
||||||
})
|
})
|
||||||
@@ -40,7 +40,7 @@ local function hasLabKit(source)
|
|||||||
local src = source
|
local src = source
|
||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
for k, v in pairs (lsdTables) do
|
for k, v in pairs (lsdTables) do
|
||||||
if v.ownerid == Player.PlayerData.citizenid then
|
if v.ownerid == getCid(source) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -58,7 +58,7 @@ RegisterServerEvent('md-drugs:server:getlabkitback', function()
|
|||||||
local src = source
|
local src = source
|
||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
for k, v in pairs (lsdTables) do
|
for k, v in pairs (lsdTables) do
|
||||||
if v.ownerid == Player.PlayerData.citizenid then
|
if v.ownerid == getCid(source) then
|
||||||
table.remove(lsdTables, k)
|
table.remove(lsdTables, k)
|
||||||
AddItem(src, 'lsdlabkit', 1)
|
AddItem(src, 'lsdlabkit', 1)
|
||||||
end
|
end
|
||||||
@@ -210,7 +210,7 @@ AddEventHandler('playerDropped', function()
|
|||||||
local src = source
|
local src = source
|
||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
for k, v in pairs (lsdTables) do
|
for k, v in pairs (lsdTables) do
|
||||||
if v.ownerid == Player.PlayerData.citizenid then
|
if v.ownerid == getCid(source) then
|
||||||
table.remove(lsdTables, k)
|
table.remove(lsdTables, k)
|
||||||
AddItem(src, 'lsdlabkit', 1)
|
AddItem(src, 'lsdlabkit', 1)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
|
|
||||||
local m = {
|
local m = {
|
||||||
{ location = vector3(2598.73, 4207.89, 41.02), heading = 334.49, model = "prop_cactus_03"},
|
{ location = vector3(2598.73, 4207.89, 41.02), heading = 334.49, model = "prop_cactus_03"},
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
|
|
||||||
RegisterServerEvent('md-drugs:server:startcook', function()
|
RegisterServerEvent('md-drugs:server:startcook', function()
|
||||||
local src = source
|
local src = source
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
local prices = {
|
local prices = {
|
||||||
payfortruck = 500,
|
payfortruck = 500,
|
||||||
hotchance = 30,
|
hotchance = 30,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
|
|
||||||
local function GetJob(source)
|
local function GetJob(source)
|
||||||
local src = source
|
local src = source
|
||||||
|
|||||||
+4
-5
@@ -1,4 +1,3 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
|
|
||||||
local recipe = {
|
local recipe = {
|
||||||
cocaine = {
|
cocaine = {
|
||||||
@@ -141,8 +140,8 @@ function GetRecipe(source, type, method, tier)
|
|||||||
local has = 0
|
local has = 0
|
||||||
local need = 0
|
local need = 0
|
||||||
for k, v in pairs (recipe[type][method][tier].take) do
|
for k, v in pairs (recipe[type][method][tier].take) do
|
||||||
local item = Player.Functions.GetItemByName(k)
|
local item = hasItem(src, k, v)
|
||||||
if item and item.amount >= v then
|
if item == true then
|
||||||
has = has + 1
|
has = has + 1
|
||||||
else
|
else
|
||||||
Notifys(src, ' You Need ' .. v .. ' Of ' .. GetLabels(k) .. ' To Do This', 'error')
|
Notifys(src, ' You Need ' .. v .. ' Of ' .. GetLabels(k) .. ' To Do This', 'error')
|
||||||
@@ -151,10 +150,10 @@ function GetRecipe(source, type, method, tier)
|
|||||||
end
|
end
|
||||||
if has == need then
|
if has == need then
|
||||||
for k, v in pairs (recipe[type][method][tier].take) do
|
for k, v in pairs (recipe[type][method][tier].take) do
|
||||||
RemoveItem(src, k, v)
|
RemoveItem(src, k, v)
|
||||||
end
|
end
|
||||||
for k,v in pairs (recipe[type][method][tier].give) do
|
for k,v in pairs (recipe[type][method][tier].give) do
|
||||||
AddItem(src, k, v)
|
AddItem(src, k, v)
|
||||||
Log(GetName(src) .. ' Made ' .. GetLabels(k) .. '!', 'drugMaking')
|
Log(GetName(src) .. ' Made ' .. GetLabels(k) .. '!', 'drugMaking')
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,3 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
|
|
||||||
local stores = {
|
local stores = {
|
||||||
travel = {
|
travel = {
|
||||||
@@ -67,11 +66,12 @@ lib.callback.register('md-drugs:server:menu', function(source, data)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent("md-drugs:server:purchaseGoods", function(amount, money, item, price,table,num)
|
RegisterServerEvent("md-drugs:server:purchaseGoods", function(amount, money, item, price,table,num)
|
||||||
local src = source local Player = getPlayer(src)
|
local src = source
|
||||||
|
local Player = getPlayer(src)
|
||||||
for i = 1, #table do
|
for i = 1, #table do
|
||||||
if table[i].name == item then
|
if table[i].name == item then
|
||||||
if not table[i].price == price then return end
|
if not table[i].price == price then return end
|
||||||
if Player.Functions.RemoveMoney(tostring(money), tonumber(table[i].price) * tonumber(amount)) then
|
if removeMoney(src, tostring(money), tonumber(table[i].price) * tonumber(amount)) then
|
||||||
AddItem(src, item, amount)
|
AddItem(src, item, amount)
|
||||||
Log(GetName(src) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant')
|
Log(GetName(src) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant')
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
|
|
||||||
local s = {
|
local s = {
|
||||||
{ location = vector3(2185.14, 5183.81, 57.48), heading = 334.49, model = "mushroom"},
|
{ location = vector3(2185.14, 5183.81, 57.48), heading = 334.49, model = "mushroom"},
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
local weedPlant = {
|
local weedPlant = {
|
||||||
{ location = vector3(1049.63, -3202.12, -36.75), heading = 334.49, model = "prop_weed_01"},
|
{ location = vector3(1049.63, -3202.12, -36.75), heading = 334.49, model = "prop_weed_01"},
|
||||||
{ location = vector3(1050.85, -3202.15, -36.75), heading = 329.56, model = "prop_weed_01"},
|
{ location = vector3(1050.85, -3202.15, -36.75), heading = 329.56, model = "prop_weed_01"},
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ for k, v in pairs (burners) do
|
|||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
if getCops() < Config.PoliceCount then return Notifys(src, Lang.Wholesale.na, 'error') end
|
if getCops() < Config.PoliceCount then return Notifys(src, Lang.Wholesale.na, 'error') end
|
||||||
for m, d in pairs (active) do
|
for m, d in pairs (active) do
|
||||||
if d.cid == Player.PlayerData.citizenid then
|
if d.cid == GetCid(source) then
|
||||||
return Notifys(src, Lang.Wholesale.al, 'error' )
|
return Notifys(src, Lang.Wholesale.al, 'error' )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -36,12 +36,12 @@ for k, v in pairs (burners) do
|
|||||||
src = src,
|
src = src,
|
||||||
item = k,
|
item = k,
|
||||||
location = getRandW(src),
|
location = getRandW(src),
|
||||||
cid = Player.PlayerData.citizenid,
|
cid = GetCid(source),
|
||||||
type = v,
|
type = v,
|
||||||
price = Price[tab]
|
price = Price[tab]
|
||||||
})
|
})
|
||||||
for m, d in pairs (active) do
|
for m, d in pairs (active) do
|
||||||
if d.cid == Player.PlayerData.citizenid then
|
if d.cid == GetCid(source) then
|
||||||
TriggerClientEvent("md-drugs:client:GetLocation", src, active[m])
|
TriggerClientEvent("md-drugs:client:GetLocation", src, active[m])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -53,7 +53,7 @@ RegisterNetEvent('md-drugs:server:SuccessSale', function(data)
|
|||||||
local src = source
|
local src = source
|
||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
for k, v in pairs (active) do
|
for k, v in pairs (active) do
|
||||||
if v.cid == Player.PlayerData.citizenid then
|
if v.cid == GetCid(source) then
|
||||||
local payout = math.random(v.price.min, v.price.max)
|
local payout = math.random(v.price.min, v.price.max)
|
||||||
for m, d in pairs (v.type) do
|
for m, d in pairs (v.type) do
|
||||||
local git = Player.Functions.GetItemByName(d)
|
local git = Player.Functions.GetItemByName(d)
|
||||||
|
|||||||
+5
-5
@@ -1,4 +1,4 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
-------------------- stealing ingridients
|
-------------------- stealing ingridients
|
||||||
local activePresses = {}
|
local activePresses = {}
|
||||||
RegisterServerEvent('md-drugs:server:stealisosafrole', function(num)
|
RegisterServerEvent('md-drugs:server:stealisosafrole', function(num)
|
||||||
@@ -34,7 +34,7 @@ local check, loc = lib.callback.await('md-drugs:client:setpress', src, v.data)
|
|||||||
press = v.data,
|
press = v.data,
|
||||||
get = v.item,
|
get = v.item,
|
||||||
owner = GetName(src),
|
owner = GetName(src),
|
||||||
ownerid = Player.PlayerData.citizenid,
|
ownerid = GetCid(source),
|
||||||
src = src,
|
src = src,
|
||||||
loc = loc
|
loc = loc
|
||||||
})
|
})
|
||||||
@@ -47,7 +47,7 @@ RegisterServerEvent('md-drugs:server:getpressback', function(type)
|
|||||||
local src = source
|
local src = source
|
||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
for k, v in pairs (activePresses) do
|
for k, v in pairs (activePresses) do
|
||||||
if v.ownerid == Player.PlayerData.citizenid then
|
if v.ownerid == GetCid(source) then
|
||||||
if v.press == type then
|
if v.press == type then
|
||||||
table.remove(activePresses, k)
|
table.remove(activePresses, k)
|
||||||
AddItem(src, v.get, 1)
|
AddItem(src, v.get, 1)
|
||||||
@@ -62,7 +62,7 @@ local function pressout(source)
|
|||||||
local ped = GetPlayerPed(src)
|
local ped = GetPlayerPed(src)
|
||||||
local coords = GetEntityCoords(ped)
|
local coords = GetEntityCoords(ped)
|
||||||
for k, v in pairs (activePresses) do
|
for k, v in pairs (activePresses) do
|
||||||
if v.ownerid == Player.PlayerData.citizenid then
|
if v.ownerid == GetCid(source) then
|
||||||
if #(coords - v.loc) < 3.0 then
|
if #(coords - v.loc) < 3.0 then
|
||||||
return v.press
|
return v.press
|
||||||
end
|
end
|
||||||
@@ -243,7 +243,7 @@ AddEventHandler('playerDropped', function()
|
|||||||
local src = source
|
local src = source
|
||||||
local Player = getPlayer(src)
|
local Player = getPlayer(src)
|
||||||
for k, v in pairs (activePresses) do
|
for k, v in pairs (activePresses) do
|
||||||
if v.ownerid == Player.PlayerData.citizenid then
|
if v.ownerid == GetCid(source) then
|
||||||
table.remove(activePresses, k)
|
table.remove(activePresses, k)
|
||||||
AddItem(src, v.get, 1)
|
AddItem(src, v.get, 1)
|
||||||
end
|
end
|
||||||
|
|||||||
+7
-1
@@ -49,4 +49,10 @@ Config.Minigames = {
|
|||||||
Config.minigametype = 'ox' -- look above for options or choose none if you dont want any minigames
|
Config.minigametype = 'ox' -- look above for options or choose none if you dont want any minigames
|
||||||
|
|
||||||
-------- Woah Where did like all the locations go?
|
-------- Woah Where did like all the locations go?
|
||||||
--- read the readme to find out
|
--- read the readme to find out
|
||||||
|
Config.Framework = 'esx'
|
||||||
|
if Config.Framework == 'qb' then
|
||||||
|
QBCore = exports['qb-core']:GetCoreObject()
|
||||||
|
elseif Config.Framework == 'esx' then
|
||||||
|
ESX = exports['es_extended']:getSharedObject()
|
||||||
|
end
|
||||||
Reference in new issue
Block a user