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 minigametype = Config.minigametype
|
||||
@@ -6,11 +5,19 @@ local notifytype = Config.Notify
|
||||
local dispatch = Config.Dispatch
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
function progressbar(text, time, anim)
|
||||
@@ -240,6 +247,7 @@ end
|
||||
function makeMenu(name, rep)
|
||||
local menu = {}
|
||||
local data = lib.callback.await('md-drugs:server:menu', false, name)
|
||||
print(data)
|
||||
for k, v in pairs (data.table) do
|
||||
local allow = false
|
||||
if rep == nil then
|
||||
@@ -249,9 +257,9 @@ function makeMenu(name, rep)
|
||||
end
|
||||
if allow then
|
||||
menu[#menu + 1] = {
|
||||
icon = GetImage(v.name),
|
||||
description = '$'.. v.price,
|
||||
title = GetLabel(v.name),
|
||||
icon = GetImage(v.name) or 'missing Item',
|
||||
description = '$'.. v.price or 'Missing Item',
|
||||
title = GetLabel(v.name) or 'Missing Item',
|
||||
onSelect = function()
|
||||
local settext = "Cost: $"..v.price
|
||||
local dialog = exports.ox_lib:inputDialog(v.name .."!", {
|
||||
@@ -445,7 +453,13 @@ function AddBoxZoneSingle(name, loc, data)
|
||||
})
|
||||
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)
|
||||
for k, v in pairs (table) do
|
||||
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,
|
||||
data = k,
|
||||
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
|
||||
@@ -476,7 +490,7 @@ function AddBoxZoneMulti(name, table, data)
|
||||
data = k,
|
||||
distance = 2.5,
|
||||
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
|
||||
@@ -494,7 +508,7 @@ function AddBoxZoneMulti(name, table, data)
|
||||
label = data.label or "fa-solid fa-eye",
|
||||
data = k,
|
||||
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)
|
||||
if not v.taken then
|
||||
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)
|
||||
AddSingleModel(WeedPlant[k], {icon = "fas fa-hand",label = Lang.targets.weed.pick, action = function() pick(k) end}, k)
|
||||
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` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`cid` varchar(50) NOT NULL,
|
||||
|
||||
+8
-8
@@ -81,7 +81,7 @@ RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
|
||||
}
|
||||
for _, v in ipairs(cokeTiers) do
|
||||
if count >= 1 then break end
|
||||
if Player.Functions.GetItemByName(v.item) then
|
||||
if hasItem(src, v.item, 1) then
|
||||
tier = v.tier
|
||||
count = count + 1
|
||||
end
|
||||
@@ -110,7 +110,7 @@ RegisterServerEvent('md-drugs:server:bagcoke', function(num)
|
||||
{item = 'loosecokestagethree', tier = 'tier3', log = ' Bagged Coke tier 3'}
|
||||
}
|
||||
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
|
||||
count = count + 1
|
||||
tier = v.tier
|
||||
@@ -128,14 +128,14 @@ for k, v in pairs (cokecut) do
|
||||
CUI(k, function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if not Player.Functions.GetItemByName('bakingsoda') then Notifys(src, 'You Need Baking Soda For this', 'error') return end
|
||||
if Player.Functions.GetItemByName(item.name) then
|
||||
if not hasItem(src, 'bakingsoda', 1) then Notifys(src, 'You Need Baking Soda For this', 'error') return end
|
||||
if hasItem(src, k, 1) then
|
||||
if not Itemcheck(src, 'bakingsoda', 1) then return end
|
||||
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting It Further')
|
||||
if not check then return end
|
||||
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting It Further')
|
||||
if not check then return end
|
||||
if RemoveItem(src, k, 1) and RemoveItem(src, 'bakingsoda', 1) then
|
||||
AddItem(src, 'loosecoke', v)
|
||||
end
|
||||
AddItem(src, 'loosecoke', v)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
+54
-20
@@ -1,4 +1,4 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
--[[
|
||||
effect options
|
||||
alien
|
||||
@@ -158,24 +158,58 @@ for k, v in pairs(Consume) do
|
||||
end
|
||||
|
||||
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
|
||||
local Player = getPlayer(source)
|
||||
local hunger, thirst = Player.PlayerData.metadata.hunger, Player.PlayerData.metadata.thirst
|
||||
if stat == "thirst" then
|
||||
local value = thirst + statval
|
||||
Player.Functions.SetMetaData('thirst', value)
|
||||
TriggerClientEvent('hud:client:UpdateNeeds', source, hunger, value)
|
||||
elseif stat == "hunger" then
|
||||
local value = hunger + statval
|
||||
Player.Functions.SetMetaData('hunger', value)
|
||||
TriggerClientEvent('hud:client:UpdateNeeds', source, value, thirst)
|
||||
elseif stat == "stress" then
|
||||
local value = Player.PlayerData.metadata.stress + statval
|
||||
Player.Functions.SetMetaData('stress', value)
|
||||
TriggerClientEvent('hud:client:UpdateStress', source, Player.PlayerData.metadata.stress, value)
|
||||
elseif stat == "armor" then
|
||||
local value = Player.PlayerData.metadata.armor + statval
|
||||
TriggerEvent('hospital:server:SetArmor', value)
|
||||
TriggerClientEvent('hud:client:UpdateStress', source, Player.PlayerData.metadata.armor, value)
|
||||
else
|
||||
local source = source
|
||||
local hunger, thirst, stress, armor
|
||||
if Config.Framework == "qb" then
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
hunger = Player.PlayerData.metadata["hunger"]
|
||||
thirst = Player.PlayerData.metadata["thirst"]
|
||||
stress = Player.PlayerData.metadata["stress"]
|
||||
armor = Player.PlayerData.metadata["armor"]
|
||||
|
||||
if stat == "thirst" then
|
||||
local value = math.min(thirst + statval, 100)
|
||||
Player.Functions.SetMetaData('thirst', value)
|
||||
TriggerClientEvent('hud:client:UpdateNeeds', source, hunger, value)
|
||||
elseif stat == "hunger" then
|
||||
local value = math.min(hunger + statval, 100)
|
||||
Player.Functions.SetMetaData('hunger', value)
|
||||
TriggerClientEvent('hud:client:UpdateNeeds', source, value, thirst)
|
||||
elseif stat == "stress" then
|
||||
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)
|
||||
+17
-36
@@ -1,4 +1,4 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local DrugDeals = {}
|
||||
local Drugs = {
|
||||
["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 rep = getRep(source, 'cornerselling')
|
||||
if not Player then return nil end
|
||||
local type = 0
|
||||
for k, v in pairs(Drugs) do
|
||||
local item = Player.Functions.GetItemByName(k)
|
||||
if item and type == 0 then
|
||||
type = type + 1
|
||||
Log(GetName(source) .. ' Allowed To Sell ' .. item.name .. '!' , 'cornerselling')
|
||||
local amount = math.random(1,item.amount)
|
||||
local item = getItemCount(source, k)
|
||||
if item >= 1 then
|
||||
if item > 15 then item = 15 end
|
||||
Log(GetName(source) .. ' Allowed To Sell ' .. k .. '!' , 'cornerselling')
|
||||
local amount = math.random(1, item)
|
||||
if amount >= 15 then amount = 15 end
|
||||
local price = math.random(Drugs[k]['min'], Drugs[k]['max']) * amount
|
||||
local result = math.floor(price * rep.price)
|
||||
table.insert(DrugDeals, {item = item.name, amount = amount, price = result, cid = Player.PlayerData.citizenid, ped = ped})
|
||||
return {item = item.name, amount = amount, price = result, ped = ped}
|
||||
table.insert(DrugDeals, {item = k, amount = amount, price = result, cid = getCid(source), ped = ped})
|
||||
return {item = k, amount = amount, price = result, ped = ped}
|
||||
end
|
||||
end
|
||||
if type == 0 then
|
||||
return {item = 'nothing', amount = 0, price = 0, ped = ped}
|
||||
end
|
||||
return {item = 'nothing', amount = 0, price = 0, ped = ped}
|
||||
end)
|
||||
|
||||
lib.callback.register('md-drugs:server:hasDrugs', function(source)
|
||||
local Player = getPlayer(source)
|
||||
for k, v in pairs(Drugs) do
|
||||
local item = Player.Functions.GetItemByName(k)
|
||||
local item = hasItem(source, k, 1)
|
||||
if item then
|
||||
return true
|
||||
end
|
||||
@@ -165,28 +162,12 @@ RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price
|
||||
end
|
||||
end
|
||||
if not isIn then return end
|
||||
for k, v in pairs (DrugDeals) do
|
||||
if v.cid == Player.PlayerData.citizenid then
|
||||
if v.item == item then
|
||||
if v.amount == amount then
|
||||
if v.price == price then
|
||||
if RemoveItem(src, item, amount) then
|
||||
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
|
||||
for k, v in pairs (DrugDeals) do
|
||||
if v.cid == getCid(source) and v.item == item and v.amount == amount and v.price == price then
|
||||
if handleCornersell(src, item, amount, price) then
|
||||
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
|
||||
@@ -207,7 +188,7 @@ RegisterServerEvent('md-drugs:server:cornerselling:stop', function()
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
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)
|
||||
table.remove(DrugDeals, k)
|
||||
end
|
||||
|
||||
+3
-4
@@ -1,4 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
RegisterServerEvent('md-drugs:server:makecrackone', function(num)
|
||||
local src = source
|
||||
@@ -13,7 +12,7 @@ RegisterServerEvent('md-drugs:server:makecrackone', function(num)
|
||||
}
|
||||
for _, v in ipairs(crackTiers) do
|
||||
if count >= 1 then break end
|
||||
if Player.Functions.GetItemByName(v.item) then
|
||||
if hasItem(src, v.item, 1) then
|
||||
tier = v.tier
|
||||
count = count + 1
|
||||
end
|
||||
@@ -36,7 +35,7 @@ RegisterServerEvent('md-drugs:server:bagcrack', function(num)
|
||||
}
|
||||
for _, v in ipairs(crackTiers) do
|
||||
if count >= 1 then break end
|
||||
if Player.Functions.GetItemByName(v.item) then
|
||||
if hasItem(src, v.item, 1) then
|
||||
tier = v.tier
|
||||
count = count + 1
|
||||
end
|
||||
@@ -50,7 +49,7 @@ for k, v in pairs (cokecut) do
|
||||
CUI(k, function(source, item)
|
||||
local src = source
|
||||
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
|
||||
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting Crack Rock Further')
|
||||
if not check then return end
|
||||
|
||||
+10
-11
@@ -1,4 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local dloc = {
|
||||
{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 item = DeliveryItems[itemnum].item
|
||||
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 coord = json.encode({
|
||||
x = dloc[locnum].coords.x,
|
||||
@@ -115,14 +114,14 @@ lib.callback.register('md-drugs:server:GetDeliveryItem', function(data)
|
||||
})
|
||||
if not check[1] then
|
||||
MySQL.insert('INSERT INTO deliveriesdealer SET cid = ?, itemdata = ?, timestart = ?, maxtime = ?, location = ?',
|
||||
{Player.PlayerData.citizenid, json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
|
||||
AddItem(Player.PlayerData.source, item, amount)
|
||||
{getCid(src), json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
|
||||
AddItem(src, item, amount)
|
||||
return true, item, amount, coord
|
||||
else
|
||||
local time = os.time()
|
||||
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
|
||||
|
||||
if timeout > 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) 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
|
||||
end
|
||||
end)
|
||||
@@ -130,23 +129,23 @@ end)
|
||||
RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {getCid(src)})
|
||||
if not check[1] then return end
|
||||
local time = os.time()
|
||||
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
|
||||
local itemData = json.decode(check[1].itemdata)
|
||||
if timeout >= 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) 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 amount ~= itemData.amount then return end
|
||||
if RemoveItem(src, item, amount) then
|
||||
for k, v in pairs (DeliveryItems) do
|
||||
if v.item == item then
|
||||
local income = math.random(v.payout.min, v.payout.max)
|
||||
Player.Functions.AddMoney('cash', income)
|
||||
AddRep(src, 'dealerrep')
|
||||
addMoney(src, 'cash', income)
|
||||
AddRep(src, 'dealerrep')
|
||||
end
|
||||
end
|
||||
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {getCid(src)})
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -173,7 +172,7 @@ lib.addCommand("newdealer", {
|
||||
end
|
||||
|
||||
MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', {
|
||||
dealerName, pos, 'nil', Player.PlayerData.citizenid
|
||||
dealerName, pos, 'nil', getCid(source)
|
||||
}, function()
|
||||
QBConfig.Dealers[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 inventory = Config.Inventory -- qb or ox
|
||||
------------------------------------------ logging stuff
|
||||
@@ -6,9 +6,15 @@ local logs = false
|
||||
local logapi = GetConvar("fivemerrLogs", "")
|
||||
local endpoint = 'https://api.fivemerr.com/v1/logs'
|
||||
local headers = {
|
||||
['Authorization'] = logapi,
|
||||
['Content-Type'] = 'application/json',
|
||||
}
|
||||
['Authorization'] = logapi,
|
||||
['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()
|
||||
if logs then
|
||||
@@ -53,21 +59,42 @@ CreateThread(function()
|
||||
elseif GetResourceState('qb-inventory') == 'started' then
|
||||
invname = 'qb-inventory'
|
||||
else
|
||||
invname = 'inventory'
|
||||
invname = 'inventory'
|
||||
end
|
||||
end)
|
||||
------------------------------------ Player Stuff functions
|
||||
function getPlayer(source)
|
||||
function getPlayer(source)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
return Player
|
||||
if Config.Framework == 'qb' then
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
return Player
|
||||
elseif Config.Framework == 'esx' then
|
||||
local Player = ESX.GetPlayerFromId(src)
|
||||
return Player
|
||||
end
|
||||
end
|
||||
|
||||
function GetName(source)
|
||||
local Player = getPlayer(source)
|
||||
return Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname
|
||||
function GetName(source)
|
||||
local src = source
|
||||
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
|
||||
|
||||
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)
|
||||
local ped = GetPlayerPed(source)
|
||||
local playerCoords = GetEntityCoords(ped)
|
||||
@@ -117,7 +144,11 @@ function GetLabels(item)
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
function Itemcheck(source, item, amount)
|
||||
@@ -131,9 +162,9 @@ function Itemcheck(source, item, amount)
|
||||
return false
|
||||
end
|
||||
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
|
||||
return true
|
||||
return true
|
||||
else
|
||||
Notifys(source, 'You Need ' .. amount .. ' Of ' .. GetLabels(item) .. ' To Do This', 'error')
|
||||
return false
|
||||
@@ -141,6 +172,48 @@ function Itemcheck(source, item, amount)
|
||||
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)
|
||||
if inventory == 'qb' then
|
||||
local Player = getPlayer(source)
|
||||
@@ -162,16 +235,14 @@ end
|
||||
function AddItem(source, item, amount)
|
||||
if inventory == 'qb' then
|
||||
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)
|
||||
return true
|
||||
else
|
||||
else
|
||||
print('Failed To Give Item: ' .. item .. ' Check Your qb-core/shared/items.lua')
|
||||
return false
|
||||
end
|
||||
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
|
||||
return true
|
||||
else
|
||||
@@ -181,66 +252,69 @@ function AddItem(source, item, amount)
|
||||
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)
|
||||
local Player = getPlayer(source)
|
||||
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
function removeMoney(source, type, amount)
|
||||
if Config.Framework == 'qb' then
|
||||
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
|
||||
local table = json.encode({
|
||||
coke = Player.PlayerData.metadata.coke or 0,
|
||||
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)
|
||||
local new = handleFresh(source)
|
||||
return new[type]
|
||||
else
|
||||
local reps = json.decode(sql[1].drugrep)
|
||||
local rep = ''
|
||||
if reps.coke == nil then rep = reps[1] else rep = reps end
|
||||
if type == 'coke' then
|
||||
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
|
||||
return rep[type]
|
||||
end
|
||||
end
|
||||
|
||||
function GetAllRep(source)
|
||||
local Player = getPlayer(source)
|
||||
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
function GetAllRep(source)
|
||||
local Player = getPlayer(source)
|
||||
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {getCid(source)})
|
||||
if not sql[1] then
|
||||
local table = json.encode({
|
||||
coke = Player.PlayerData.metadata.coke or 0,
|
||||
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)
|
||||
local new = handleFresh(source)
|
||||
return new
|
||||
else
|
||||
local rep = json.decode(sql[1].drugrep)
|
||||
if rep.coke == nil then return rep[1] end
|
||||
@@ -251,7 +325,7 @@ end
|
||||
function AddRep(source, type, amount)
|
||||
if not amount then amount = 1 end
|
||||
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 update
|
||||
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}})
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif type == 'coke' then
|
||||
update = json.encode({coke = rep.coke + amount, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = rep.cornerselling})
|
||||
elseif type == 'heroin' then
|
||||
update = json.encode({coke = rep.coke, heroin = rep.heroin + amount, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = rep.cornerselling})
|
||||
elseif type == 'lsd' then
|
||||
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd +amount , dealerrep = rep.dealerrep, cornerselling = rep.cornerselling})
|
||||
elseif type == 'dealerrep' then
|
||||
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep + amount, cornerselling = rep.cornerselling})
|
||||
end
|
||||
if update == '' then return false end
|
||||
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, getCid(source)})
|
||||
return true
|
||||
else
|
||||
rep[type] = rep[type] + amount
|
||||
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {json.encode(rep), getCid(source)})
|
||||
return true
|
||||
end
|
||||
if update == '' then return false end
|
||||
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, Player.PlayerData.citizenid})
|
||||
return true
|
||||
end
|
||||
|
||||
lib.addCommand('addCornerSellingTOREP', {
|
||||
@@ -323,6 +393,27 @@ function getCops()
|
||||
return amount
|
||||
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)
|
||||
local amount = 0
|
||||
local players = QBCore.Functions.GetQBPlayers()
|
||||
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local prices = {
|
||||
heroinlabkitprice = 10000
|
||||
}
|
||||
@@ -40,7 +40,7 @@ end
|
||||
lib.callback.register('removeCleaningkit', function(source)
|
||||
local Player = getPlayer(source)
|
||||
for k, v in pairs(heroinLabKits) do
|
||||
if v.ownerid == Player.PlayerData.citizenid then
|
||||
if v.ownerid == getCid(source) then
|
||||
RemoveItem(source, 'cleaningkit', 1)
|
||||
return true
|
||||
end
|
||||
@@ -117,7 +117,7 @@ local function hasHKit(src)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
for k, v in pairs(heroinLabKits) do
|
||||
if v.ownerid == Player.PlayerData.citizenid then
|
||||
if v.ownerid == getCid(source) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -129,7 +129,7 @@ RegisterServerEvent('md-drugs:server:getheroinlabkitback', function()
|
||||
local Player = getPlayer(src)
|
||||
if not hasHKit(src) then return end
|
||||
for k, v in pairs (heroinLabKits) do
|
||||
if v.ownerid == Player.PlayerData.citizenid then
|
||||
if v.ownerid == getCid(source) then
|
||||
table.remove(heroinLabKits, k)
|
||||
AddItem(src, 'heroinlabkit', 1)
|
||||
end
|
||||
@@ -146,7 +146,7 @@ CUI('heroinlabkit', function(source, item)
|
||||
RemoveItem(src, 'heroinlabkit', 1)
|
||||
table.insert(heroinLabKits, {
|
||||
src = src,
|
||||
ownerid = Player.PlayerData.citizenid,
|
||||
ownerid = getCid(source),
|
||||
coords = loc,
|
||||
name = GetName(src)
|
||||
})
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
RegisterServerEvent('md-drugs:server:givelean', function()
|
||||
local chance = math.random(1,100)
|
||||
|
||||
@@ -112,6 +112,10 @@ local Target = {
|
||||
}
|
||||
|
||||
function checkLoc(source, event, num)
|
||||
print('Checking Location')
|
||||
print('Event: ' .. event)
|
||||
print('Num: ' .. num)
|
||||
|
||||
local ped = source
|
||||
local pos = GetPlayerPed(ped)
|
||||
local coord = GetEntityCoords(pos)
|
||||
@@ -123,6 +127,7 @@ function checkLoc(source, event, num)
|
||||
end
|
||||
local dist = #(coord - loc)
|
||||
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')
|
||||
return true
|
||||
else
|
||||
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local prices = {
|
||||
tabcost = 100, -- price per piece of tab paper event does 10 at a time
|
||||
lsdlabkitcost = 10000 -- price of the lsd lab kit
|
||||
@@ -28,7 +28,7 @@ CUI('lsdlabkit', function(source, item)
|
||||
if RemoveItem(src, 'lsdlabkit', 1) then
|
||||
table.insert(lsdTables, {
|
||||
owner = GetName(src),
|
||||
ownerid = Player.PlayerData.citizenid,
|
||||
ownerid = getCid(source),
|
||||
src = src,
|
||||
loc = loc
|
||||
})
|
||||
@@ -40,7 +40,7 @@ local function hasLabKit(source)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
for k, v in pairs (lsdTables) do
|
||||
if v.ownerid == Player.PlayerData.citizenid then
|
||||
if v.ownerid == getCid(source) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -58,7 +58,7 @@ RegisterServerEvent('md-drugs:server:getlabkitback', function()
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
for k, v in pairs (lsdTables) do
|
||||
if v.ownerid == Player.PlayerData.citizenid then
|
||||
if v.ownerid == getCid(source) then
|
||||
table.remove(lsdTables, k)
|
||||
AddItem(src, 'lsdlabkit', 1)
|
||||
end
|
||||
@@ -210,7 +210,7 @@ AddEventHandler('playerDropped', function()
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
for k, v in pairs (lsdTables) do
|
||||
if v.ownerid == Player.PlayerData.citizenid then
|
||||
if v.ownerid == getCid(source) then
|
||||
table.remove(lsdTables, k)
|
||||
AddItem(src, 'lsdlabkit', 1)
|
||||
end
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local m = {
|
||||
{ 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()
|
||||
local src = source
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local prices = {
|
||||
payfortruck = 500,
|
||||
hotchance = 30,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local function GetJob(source)
|
||||
local src = source
|
||||
|
||||
+4
-5
@@ -1,4 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local recipe = {
|
||||
cocaine = {
|
||||
@@ -141,8 +140,8 @@ function GetRecipe(source, type, method, tier)
|
||||
local has = 0
|
||||
local need = 0
|
||||
for k, v in pairs (recipe[type][method][tier].take) do
|
||||
local item = Player.Functions.GetItemByName(k)
|
||||
if item and item.amount >= v then
|
||||
local item = hasItem(src, k, v)
|
||||
if item == true then
|
||||
has = has + 1
|
||||
else
|
||||
Notifys(src, ' You Need ' .. v .. ' Of ' .. GetLabels(k) .. ' To Do This', 'error')
|
||||
@@ -151,10 +150,10 @@ function GetRecipe(source, type, method, tier)
|
||||
end
|
||||
if has == need then
|
||||
for k, v in pairs (recipe[type][method][tier].take) do
|
||||
RemoveItem(src, k, v)
|
||||
RemoveItem(src, k, v)
|
||||
end
|
||||
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')
|
||||
end
|
||||
return true
|
||||
|
||||
+3
-3
@@ -1,4 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local stores = {
|
||||
travel = {
|
||||
@@ -67,11 +66,12 @@ lib.callback.register('md-drugs:server:menu', function(source, data)
|
||||
end)
|
||||
|
||||
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
|
||||
if table[i].name == item then
|
||||
if not table[i].price == price then return end
|
||||
if Player.Functions.RemoveMoney(tostring(money), tonumber(table[i].price) * tonumber(amount)) then
|
||||
if removeMoney(src, tostring(money), tonumber(table[i].price) * tonumber(amount)) then
|
||||
AddItem(src, item, amount)
|
||||
Log(GetName(src) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant')
|
||||
end
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local s = {
|
||||
{ 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 = {
|
||||
{ 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"},
|
||||
|
||||
@@ -21,7 +21,7 @@ for k, v in pairs (burners) do
|
||||
local Player = getPlayer(src)
|
||||
if getCops() < Config.PoliceCount then return Notifys(src, Lang.Wholesale.na, 'error') end
|
||||
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' )
|
||||
end
|
||||
end
|
||||
@@ -36,12 +36,12 @@ for k, v in pairs (burners) do
|
||||
src = src,
|
||||
item = k,
|
||||
location = getRandW(src),
|
||||
cid = Player.PlayerData.citizenid,
|
||||
cid = GetCid(source),
|
||||
type = v,
|
||||
price = Price[tab]
|
||||
})
|
||||
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])
|
||||
end
|
||||
end
|
||||
@@ -53,7 +53,7 @@ RegisterNetEvent('md-drugs:server:SuccessSale', function(data)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
for k, v in pairs (active) do
|
||||
if v.cid == Player.PlayerData.citizenid then
|
||||
if v.cid == GetCid(source) then
|
||||
local payout = math.random(v.price.min, v.price.max)
|
||||
for m, d in pairs (v.type) do
|
||||
local git = Player.Functions.GetItemByName(d)
|
||||
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
-------------------- stealing ingridients
|
||||
local activePresses = {}
|
||||
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,
|
||||
get = v.item,
|
||||
owner = GetName(src),
|
||||
ownerid = Player.PlayerData.citizenid,
|
||||
ownerid = GetCid(source),
|
||||
src = src,
|
||||
loc = loc
|
||||
})
|
||||
@@ -47,7 +47,7 @@ RegisterServerEvent('md-drugs:server:getpressback', function(type)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
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
|
||||
table.remove(activePresses, k)
|
||||
AddItem(src, v.get, 1)
|
||||
@@ -62,7 +62,7 @@ local function pressout(source)
|
||||
local ped = GetPlayerPed(src)
|
||||
local coords = GetEntityCoords(ped)
|
||||
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
|
||||
return v.press
|
||||
end
|
||||
@@ -243,7 +243,7 @@ AddEventHandler('playerDropped', function()
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
for k, v in pairs (activePresses) do
|
||||
if v.ownerid == Player.PlayerData.citizenid then
|
||||
if v.ownerid == GetCid(source) then
|
||||
table.remove(activePresses, k)
|
||||
AddItem(src, v.get, 1)
|
||||
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
|
||||
|
||||
-------- 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