6 Commits
Author SHA1 Message Date
Mustache Dom e0eb843d4e added qbx 2025-01-29 20:26:39 -08:00
Mustache Dom b4234abaf3 patch coke 2025-01-29 13:03:27 -08:00
Mustache Dom 0895ac8a44 fix cocaine 2025-01-29 13:01:45 -08:00
Mustache Dom df13abc3b0 fix wholesale esx 2025-01-29 12:59:49 -08:00
Mustache Dom f06778c345 update fix most of the script 2025-01-28 20:15:32 -08:00
Mustache Dom 36131995d4 initial push 2025-01-27 23:56:13 -08:00
28 changed files with 765 additions and 626 deletions

No files matched your search

+2 -1
View File
@@ -1,7 +1,8 @@
{ {
"Lua.diagnostics.disable": [ "Lua.diagnostics.disable": [
"missing-parameter", "missing-parameter",
"param-type-mismatch" "param-type-mismatch",
"lowercase-global"
], ],
"Lua.diagnostics.globals": [ "Lua.diagnostics.globals": [
"lib", "lib",
+63 -18
View File
@@ -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,33 @@ 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
elseif Config.Framework == 'qbx' then
return QBX.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
elseif Config.Framework == 'qbx' then
return QBX.PlayerData.job.name
end
end
function getGang()
if Config.Framework == 'qb' then
return QBCore.Functions.GetPlayerData().gang.name
elseif Config.Framework == 'esx' then
return ESX.GetPlayerData().job.name
elseif Config.Framework == 'qbx' then
return QBX.PlayerData.gang.name
end
end end
function progressbar(text, time, anim) function progressbar(text, time, anim)
@@ -57,8 +78,8 @@ function progressbar(text, time, anim)
until cancelled or test until cancelled or test
if test then return true end if test then return true end
else else
print"^1 SCRIPT ERROR: Md-DRUGS set your progressbar with one of the options!" print"^1 SCRIPT ERROR: Md-DRUGS set your progressbar with one of the options!"
end end
end end
function loadParticle(dict) function loadParticle(dict)
@@ -179,15 +200,15 @@ function minigame()
function Notify(text, type) function Notify(text, type)
if notifytype =='ox' then if notifytype =='ox' then
lib.notify({title = text, type = type}) lib.notify({title = text, type = type})
elseif notifytype == 'qb' then elseif notifytype == 'qb' then
QBCore.Functions.Notify(text, type) QBCore.Functions.Notify(text, type)
elseif notifytype == 'okok' then elseif notifytype == 'okok' then
exports['okokNotify']:Alert('', text, 4000, type, false) exports['okokNotify']:Alert('', text, 4000, type, false)
else else
print"^1 SCRIPT ERROR: Md-DRUGS set your notification with one of the options!" print"^1 SCRIPT ERROR: Md-DRUGS set your notification with one of the options!"
end end
end end
function GetImage(img) function GetImage(img)
if GetResourceState('ox_inventory') == 'started' then if GetResourceState('ox_inventory') == 'started' then
@@ -242,16 +263,16 @@ function makeMenu(name, rep)
local data = lib.callback.await('md-drugs:server:menu', false, name) local data = lib.callback.await('md-drugs:server:menu', false, name)
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
allow = true allow = true
else else
if rep.dealerrep >= v.minrep then allow = true end if rep.dealerrep >= v.minrep then allow = true end
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 .."!", {
@@ -395,7 +416,6 @@ function tele(coords)
DoScreenFadeIn(500) DoScreenFadeIn(500)
end end
function AddBoxZoneSingle(name, loc, data) function AddBoxZoneSingle(name, loc, data)
if Config.Target == 'qb' then if Config.Target == 'qb' then
exports['qb-target']:AddBoxZone(name, loc, 1.5, 1.75, {name = name, minZ = loc.z-1,maxZ = loc.z +1}, exports['qb-target']:AddBoxZone(name, loc, 1.5, 1.75, {name = name, minZ = loc.z-1,maxZ = loc.z +1},
@@ -460,7 +480,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 +496,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 +514,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
}, },
} }
}) })
@@ -641,6 +661,31 @@ function StartRay2()
until run == false until run == false
end end
function getAmbo()
if Config.Framework == 'qb' then
local Player = QBCore.Functions.GetPlayerData()
if Player.PlayerData.job.type == 'ems' then
return true
else
return false
end
elseif Config.Framework == 'esx' then
local Player = ESX.GetPlayerData()
if Player.job.name == 'ambulance' then
return true
else
return false
end
elseif Config.Framework == 'qbx' then
local Player = QBX.PlayerData
if Player.job.name == 'ambulance' then
return true
else
return false
end
end
end
CreateThread(function() CreateThread(function()
LoadModel('prop_plant_01b') LoadModel('prop_plant_01b')
LoadModel('prop_plant_01a') LoadModel('prop_plant_01a')
+1 -1
View File
@@ -1,13 +1,13 @@
local carryPackage = nil local carryPackage = nil
RegisterNetEvent("md-drugs:client:GetOxyCar", function() RegisterNetEvent("md-drugs:client:GetOxyCar", function()
print("oxy")
lib.requestModel("burrito3", Config.RequestModelTime) lib.requestModel("burrito3", Config.RequestModelTime)
local paid = lib.callback.await('md-drugs:server:payfortruck', false) local paid = lib.callback.await('md-drugs:server:payfortruck', false)
if not paid then return end if not paid then return end
local loca = lib.callback.await('md-drugs:server:getLocs', false) local loca = lib.callback.await('md-drugs:server:getLocs', false)
local loc = loca.singleSpot.truckspawn local loc = loca.singleSpot.truckspawn
local oxycar = CreateVehicle("burrito3",loc.x, loc.y,loc.z, loc.w, true, false) local oxycar = CreateVehicle("burrito3",loc.x, loc.y,loc.z, loc.w, true, false)
exports[Config.Fuel]:SetFuel(oxycar, 100.0)
TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(oxycar)) TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(oxycar))
Notify(Lang.oxy.truck, 'success') Notify(Lang.oxy.truck, 'success')
TriggerEvent("md-drugs:client:getoxylocationroute") TriggerEvent("md-drugs:client:getoxylocationroute")
+2 -1
View File
@@ -1,6 +1,6 @@
lib.callback.register("md-drugs:client:prescriptionpad", function(data, op) lib.callback.register("md-drugs:client:prescriptionpad", function(data, op)
if getJobType() ~= 'ems' then return end if not getAmbo() then return end
local input = lib.inputDialog('Who To Give A Prescription To?',{ local input = lib.inputDialog('Who To Give A Prescription To?',{
{type = 'select', label = 'Player Name', options = data}, {type = 'select', label = 'Player Name', options = data},
{type = 'select', label = 'Prescription', options = op}}) {type = 'select', label = 'Prescription', options = op}})
@@ -18,3 +18,4 @@ lib.callback.register("md-drugs:client:unbottle", function()
if not progressbar(Lang.Pharma.open, 4000, 'uncuff') then return end if not progressbar(Lang.Pharma.open, 4000, 'uncuff') then return end
return true return true
end) end)
-1
View File
@@ -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
+2
View File
@@ -4,7 +4,9 @@ description "drugs by mustache dom"
fx_version "cerulean" fx_version "cerulean"
game "gta5" game "gta5"
version '3.9.0' version '3.9.0'
client_scripts { client_scripts {
--'@qbx_core/modules/playerdata.lua',
'client/**.lua', 'client/**.lua',
} }
+9
View File
@@ -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,
+15 -28
View File
@@ -65,77 +65,64 @@ end)
RegisterServerEvent('md-drugs:server:cutcokeone', function(num) RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
local src = source local src = source
local Player = getPlayer(src)
local count = 0
if Config.FancyCokeAnims then if Config.FancyCokeAnims then
if not checkLoc(src, 'singleSpot', 'cutcoke') then return end if not checkLoc(src, 'singleSpot', 'cutcoke') then return end
else else
if not checkLoc(src, 'CuttingCoke', num) then return end if not checkLoc(src, 'CuttingCoke', num) then return end
end end
local tier = 'tier1'
if Config.TierSystem then if Config.TierSystem then
local tier = ''
local cokeTiers = { local cokeTiers = {
{item = 'coke', tier = 'tier1', log = ' Cut Coke'}, {item = 'coke', tier = 'tier1', log = ' Cut Coke'},
{item = 'cokestagetwo', tier = 'tier2', log = ' Cut Coke tier 2'}, {item = 'cokestagetwo', tier = 'tier2', log = ' Cut Coke tier 2'},
{item = 'cokestagethree', tier = 'tier3', log = ' Cut Coke tier 3'} {item = 'cokestagethree', tier = 'tier3', log = ' Cut Coke tier 3'}
} }
for _, v in ipairs(cokeTiers) do for _, v in ipairs(cokeTiers) do
if count >= 1 then break end if hasItem(src, v.item, 1) then
if Player.Functions.GetItemByName(v.item) then
tier = v.tier tier = v.tier
count = count + 1 break
end end
end end
if not GetRecipe(src, 'cocaine', 'cutcoke', tier) then return end
else
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end
end end
if not GetRecipe(src, 'cocaine', 'cutcoke', tier) then return end
end) end)
RegisterServerEvent('md-drugs:server:bagcoke', function(num) RegisterServerEvent('md-drugs:server:bagcoke', function(num)
local src = source local src = source
local Player = getPlayer(src)
local count = 0
local tier = ''
if Config.FancyCokeAnims then if Config.FancyCokeAnims then
if not checkLoc(src, 'singleSpot', 'bagcokepowder') then return end if not checkLoc(src, 'singleSpot', 'bagcokepowder') then return end
else else
if not checkLoc(src, 'BaggingCoke', num) then return end if not checkLoc(src, 'BaggingCoke', num) then return end
end end
local tier = 'tier1'
if Config.TierSystem then if Config.TierSystem then
local coke = getRep(src, 'coke')
local cokeTiers = { local cokeTiers = {
{item = 'loosecoke', tier = 'tier1', log = ' Bagged Coke'}, {item = 'loosecoke', tier = 'tier1', log = ' Bagged Coke'},
{item = 'loosecokestagetwo', tier = 'tier2', log = ' Bagged Coke tier 2'}, {item = 'loosecokestagetwo', tier = 'tier2', log = ' Bagged Coke tier 2'},
{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 tier = v.tier
count = count + 1 break
tier = v.tier
end end
end end
if not GetRecipe(src, 'cocaine', 'bagcoke', tier) then return end
AddRep(src, 'coke')
else
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end
end end
if not GetRecipe(src, 'cocaine', 'bagcoke', tier) then return end
AddRep(src, 'coke', 1)
end) end)
local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3} local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3}
for k, v in pairs (cokecut) do 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) if hasItem(src, k, 1) then
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 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
View File
@@ -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)
+31 -53
View File
@@ -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,71 +125,54 @@ 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') local amount = math.random(1, item)
local amount = math.random(1,item.amount) local price = (math.random(Drugs[k]['min'], Drugs[k]['max']) * amount) * rep.price
if amount >= 15 then amount = 15 end DrugDeals[getCid(source)] = {item = k, amount = amount, price = price, ped = ped}
local price = math.random(Drugs[k]['min'], Drugs[k]['max']) * amount Log(GetName(source) .. ' Allowed To Sell ' .. k .. '!' , 'cornerselling')
local result = math.floor(price * rep.price) return DrugDeals[getCid(source)]
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}
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)
for k, v in pairs(Drugs) do for k, v in pairs(Drugs) do
local item = Player.Functions.GetItemByName(k) if hasItem(source, k, 1) then
if item then
return true return true
end end
end end
return false return false
end) end)
RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price) local function csCheck(src, item, amount, price)
local src = source
local Player = getPlayer(src)
local isIn = false local isIn = false
for k, v in pairs (Drugs) do for k, v in pairs (Drugs) do
if item == k then if item == k then
isIn = true isIn = true
end end
end end
if not isIn then return end if not isIn then return false end
for k, v in pairs (DrugDeals) do
if v.cid == Player.PlayerData.citizenid then if DrugDeals[getCid(src)] then
if v.item == item then if DrugDeals[getCid(src)].item == item and DrugDeals[getCid(src)].amount == amount and DrugDeals[getCid(src)].price == price then
if v.amount == amount then return true
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
end
end end
end end
return false
end
RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price)
local src = source
if not csCheck(src, item, amount, price) then return end
if handleCornersell(src, item, amount, price) then
AddRep(src, 'cornerselling', Drugs[item].rep * amount)
Log(string.format('%s Sold %s Of %s For A Price Of $%s !', GetName(src),amount, item, price), 'cornerselling')
DrugDeals[getCid(src)] = nil
end
end) end)
lib.addCommand('cornersell', { lib.addCommand('cornersell', {
@@ -198,18 +181,13 @@ lib.addCommand('cornersell', {
}, },
}, function(source, args, raw) }, function(source, args, raw)
local src = source local src = source
local Player = getPlayer(src)
Log(GetName(source) .. ' Used Command cornersell!' , 'cornerselling') Log(GetName(source) .. ' Used Command cornersell!' , 'cornerselling')
TriggerClientEvent('md-drugs:client:cornerselling', src) TriggerClientEvent('md-drugs:client:cornerselling', src)
end) end)
RegisterServerEvent('md-drugs:server:cornerselling:stop', function() RegisterServerEvent('md-drugs:server:cornerselling:stop', function()
local src = source local src = source
local Player = getPlayer(src) if DrugDeals[getCid(src)] then
for k, v in pairs (DrugDeals) do DrugDeals[getCid(src)] = nil
if v.cid == Player.PlayerData.citizenid then
TriggerClientEvent('md-drugs:client:cornerselling:remove', src, DrugDeals[k].ped)
table.remove(DrugDeals, k)
end
end end
end) end)
+7 -13
View File
@@ -1,9 +1,7 @@
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
local Player = getPlayer(src) local type, tier ='cookcrack', 'tier1'
local count,type, tier = 0, 'cookcrack', 'tier1'
if not checkLoc(src, 'makecrack', num) then return end if not checkLoc(src, 'makecrack', num) then return end
if Config.TierSystem then if Config.TierSystem then
local crackTiers = { local crackTiers = {
@@ -12,10 +10,9 @@ RegisterServerEvent('md-drugs:server:makecrackone', function(num)
{item = 'loosecokestagethree', tier = 'tier3', log = ' Cut Crack tier 3'} {item = 'loosecokestagethree', tier = 'tier3', log = ' Cut Crack tier 3'}
} }
for _, v in ipairs(crackTiers) do for _, v in ipairs(crackTiers) do
if count >= 1 then break end if hasItem(src, v.item, 1) then
if Player.Functions.GetItemByName(v.item) then
tier = v.tier tier = v.tier
count = count + 1 break
end end
end end
end end
@@ -25,8 +22,7 @@ end)
RegisterServerEvent('md-drugs:server:bagcrack', function(num) RegisterServerEvent('md-drugs:server:bagcrack', function(num)
local src = source local src = source
local Player = getPlayer(src) local type, tier = 'bagcrack', 'tier1'
local count,type, tier = 0, 'bagcrack', 'tier1'
if not checkLoc(src, 'bagcrack', num) then return end if not checkLoc(src, 'bagcrack', num) then return end
if Config.TierSystem then if Config.TierSystem then
local crackTiers = { local crackTiers = {
@@ -35,10 +31,9 @@ RegisterServerEvent('md-drugs:server:bagcrack', function(num)
{item = 'crackrockstagethree', tier = 'tier3', log = ' Bagged Crack tier 3'} {item = 'crackrockstagethree', tier = 'tier3', log = ' Bagged Crack tier 3'}
} }
for _, v in ipairs(crackTiers) do for _, v in ipairs(crackTiers) do
if count >= 1 then break end if hasItem(src, v.item, 1) then
if Player.Functions.GetItemByName(v.item) then
tier = v.tier tier = v.tier
count = count + 1 break
end end
end end
end end
@@ -49,8 +44,7 @@ local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3}
for k, v in pairs (cokecut) do 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) if hasItem(src, k, 1) then
if Player.Functions.GetItemByName(item.name) 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
+19 -30
View File
@@ -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)},
@@ -85,7 +84,7 @@ lib.callback.register('md-drugs:server:getDealers', function(data)
local loc = json.encode({x = 899.98, y = -2603.24, z = 6.11, h = 176.12 }) local loc = json.encode({x = 899.98, y = -2603.24, z = 6.11, h = 176.12 })
if not check[1] then if not check[1] then
MySQL.insert('INSERT INTO dealers SET name = ?, coords = ?, time = ?, createdby = ?', {'MD', loc, 'any', 'code Newb'}) MySQL.insert('INSERT INTO dealers SET name = ?, coords = ?, time = ?, createdby = ?', {'MD', loc, 'any', 'code Newb'})
Wait(2000) Wait(2000)
local check2 = MySQL.query.await('SELECT * FROM dealers', {}) local check2 = MySQL.query.await('SELECT * FROM dealers', {})
return check2 return check2
else else
@@ -95,34 +94,29 @@ end)
local DeliveryItems = { local DeliveryItems = {
{ item = "weed_brick", minrep = 0, payout = {min = 10, max = 50}}, {item = "weed_brick", minrep = 0, payout = {min = 10, max = 50}},
{ item = "coke_brick", minrep = 0, payout = {min = 10, max = 50}}, {item = "coke_brick", minrep = 0, payout = {min = 10, max = 50}},
} }
lib.callback.register('md-drugs:server:GetDeliveryItem', function(data) lib.callback.register('md-drugs:server:GetDeliveryItem', function(data)
local src = source local src = source
local Player = getPlayer(src)
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, y = dloc[locnum].coords.y, z = dloc[locnum].coords.z , w = dloc[locnum].coords.w })
x = dloc[locnum].coords.x,
y = dloc[locnum].coords.y,
z = dloc[locnum].coords.z ,
w = dloc[locnum].coords.w
})
if not check[1] then 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 +124,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)
@@ -166,23 +160,18 @@ lib.addCommand("newdealer", {
local dealerName = args.name local dealerName = args.name
local pos = json.encode({x = coords.x, y = coords.y, z = coords.z}) local pos = json.encode({x = coords.x, y = coords.y, z = coords.z})
local result = MySQL.scalar.await('SELECT name FROM dealers WHERE name = ?', { dealerName }) local result = MySQL.scalar.await('SELECT name FROM dealers WHERE name = ?', { dealerName })
if result then if result then
return Notifys(source,"Already Exists", "error") return Notifys(source,"Already Exists", "error")
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,
coords = { coords = { x = coords.x, y = coords.y, z = coords.z, h = GetEntityHeading(ped) },
x = coords.x,
y = coords.y,
z = coords.z,
h = GetEntityHeading(ped)
},
} }
TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers) TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers)
end) end)
@@ -202,8 +191,8 @@ lib.addCommand("deletedealer", {
MySQL.query('DELETE FROM dealers WHERE name = ?', { dealerName }) MySQL.query('DELETE FROM dealers WHERE name = ?', { dealerName })
QBConfig.Dealers[dealerName] = nil QBConfig.Dealers[dealerName] = nil
TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers) TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers)
TriggerClientEvent('QBCore:Notify', source, "Dealer Deleted", "success") Notifys(source, "Dealer Deleted", "success")
else else
TriggerClientEvent('QBCore:Notify', source, "Who You Tryna Delete", "error") Notifys(source, "Who You Tryna Delete", "error")
end end
end) end)
+313 -139
View File
@@ -1,14 +1,25 @@
local QBCore = exports['qb-core']:GetCoreObject() local QBCore, ESX, qbx = {}, {}, nil
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
local invname = ''
------------------------------------------ logging stuff ------------------------------------------ logging stuff
local logs = false 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()
elseif Config.Framework == 'qbx' then
qbx = exports.qbx_core
end
CreateThread(function() CreateThread(function()
if logs then if logs then
@@ -24,17 +35,11 @@ end
end) end)
function Log(message, type) function Log(message, type)
if logs == false then return end if logs == false then return end
local buffer = { local buffer = { level = "info", message = message, resource = GetCurrentResourceName(),
level = "info", metadata = { drugs = type, playerid = source}
message = message,
resource = GetCurrentResourceName(),
metadata = {
drugs = type,
playerid = source
}
} }
SetTimeout(500, function() SetTimeout(500, function()
PerformHttpRequest(endpoint, function(status, _, _, response) PerformHttpRequest(endpoint, function(status, _, _, response)
if status ~= 200 then if status ~= 200 then
if type(response) == 'string' then if type(response) == 'string' then
@@ -43,29 +48,62 @@ if logs == false then return end
end end
end, 'POST', json.encode(buffer), headers) end, 'POST', json.encode(buffer), headers)
buffer = nil buffer = nil
end) end)
end end
---------------------------------------------------- inventory catcher
local invname = ''
CreateThread(function()
if GetResourceState('ps-inventory') == 'started' then
invname = 'ps-inventory'
elseif GetResourceState('qb-inventory') == 'started' then
invname = 'qb-inventory'
else
invname = 'inventory'
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
elseif Config.Framework == 'qbx' then
local Player = qbx:GetPlayer(source)
return Player
end
end end
function GetName(source) function getPlayerByCid(cid)
local Player = getPlayer(source) if Config.Framework == 'qb' then
return Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname local Player = QBCore.Functions.GetPlayerByCitizenId(cid)
return Player
elseif Config.Framework == 'esx' then
local Player = ESX.GetPlayerFromIdentifier(cid)
return Player
elseif Config.Framework == 'qbx' then
local Player = qbx:GetPlayerByCitizenId(cid)
return Player
end
end
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()
elseif Config.Framework == 'qbx' then
local Player = getPlayer(src)
return Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname
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()
elseif Config.Framework == 'qbx' then
local Player = getPlayer(src)
return Player.PlayerData.citizenid
end
end end
function GetCoords(source) function GetCoords(source)
@@ -78,7 +116,8 @@ function dist(source, coords)
local playerPed = GetPlayerPed(source) local playerPed = GetPlayerPed(source)
local pcoords = GetEntityCoords(playerPed) local pcoords = GetEntityCoords(playerPed)
local dist = #(pcoords - coords) local dist = #(pcoords - coords)
return dist
return dist
end end
function CheckDist(source, coords) function CheckDist(source, coords)
@@ -87,7 +126,7 @@ function CheckDist(source, coords)
local ok local ok
if #(pcoords - coords) < 4.0 then if #(pcoords - coords) < 4.0 then
return ok return ok
else else
DropPlayer(source, 'md-drugs: You Were A Total Of ' .. #(pcoords - coords) .. ' Too Far Away To Trigger This Event') DropPlayer(source, 'md-drugs: You Were A Total Of ' .. #(pcoords - coords) .. ' Too Far Away To Trigger This Event')
return false return false
end end
@@ -107,7 +146,7 @@ function Notifys(source, text, type)
end end
end end
function GetLabels(item) function GetLabels(item)
if inventory == 'qb' then if inventory == 'qb' then
return QBCore.Shared.Items[item].label return QBCore.Shared.Items[item].label
elseif inventory == 'ox' then elseif inventory == 'ox' then
@@ -117,7 +156,13 @@ 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)
elseif Config.Framework == 'qbx' then
qbx:CreateUseableItem(item, useFunction)
end
end end
function Itemcheck(source, item, amount) function Itemcheck(source, item, amount)
@@ -131,9 +176,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,13 +186,55 @@ 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)
if Player.Functions.RemoveItem(item, amount) then if Player.Functions.RemoveItem(item, amount) then
TriggerClientEvent(invname ..":client:ItemBox", source, QBCore.Shared.Items[item], "remove", amount) TriggerClientEvent(invname ..":client:ItemBox", source, QBCore.Shared.Items[item], "remove", amount)
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')
end end
elseif inventory == 'ox' then elseif inventory == 'ox' then
@@ -162,16 +249,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 +266,85 @@ 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
elseif Config.Framework == 'qbx' then
if qbx:AddMoney(source, type, 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
if type == 'bank' then
print('Does Not Support Bank Funds Removing From ESX Defaulted To Cash')
end
local Player = getPlayer(source)
if Player.getMoney() >= amount then
Player.removeMoney(amount)
return true
else
return false
end
elseif Config.Framework == 'qbx' then
if qbx:RemoveMoney(source, type, amount) then
return true
else
return false
end
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 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 sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {getCid(source)})
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
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
@@ -248,10 +352,10 @@ function GetAllRep(source)
end end
end end
function AddRep(source, type, amount) function AddRep(source, type, amount)
if not Config.TierSystem then return false end
if not amount then amount = 1 end if not amount then amount = 1 end
local Player = getPlayer(source) local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {getCid(source)})
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
local reps = json.decode(sql[1].drugrep) local reps = json.decode(sql[1].drugrep)
local update local update
local rep = '' local rep = ''
@@ -265,19 +369,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', {
@@ -290,17 +390,17 @@ lib.addCommand('addCornerSellingTOREP', {
local old = json.decode(v.drugrep) local old = json.decode(v.drugrep)
local get = old[1] or old local get = old[1] or old
table.insert(new, { table.insert(new, {
coke = get.coke, coke = get.coke,
lsd = get.lsd, lsd = get.lsd,
heroin = get.heroin, heroin = get.heroin,
dealerrep = get.dealerrep, dealerrep = get.dealerrep,
cornerselling = { cornerselling = {
price = QBConfig.SellLevel[1].price, price = QBConfig.SellLevel[1].price,
rep = 0, rep = 0,
label = QBConfig.SellLevel[1].label, label = QBConfig.SellLevel[1].label,
level = 1 level = 1
} }
}) })
local news = json.encode(new) local news = json.encode(new)
MySQL.query.await('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {news, v.cid}) MySQL.query.await('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {news, v.cid})
end end
@@ -314,39 +414,110 @@ end
function getCops() function getCops()
local amount = 0 local amount = 0
local players = QBCore.Functions.GetQBPlayers() if Config.Framework == 'qb' then
for k, v in pairs(players) do local players = QBCore.Functions.GetQBPlayers()
if v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then for k, v in pairs(players) do
amount = amount + 1 if v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then
end amount = amount + 1
end
end
return amount
elseif Config.Framework == 'esx' then
local players = ESX.GetPlayers()
for k, v in pairs(players) do
local xPlayer = ESX.GetPlayerFromId(v)
if xPlayer.job.name == 'police' and xPlayer.job.onduty then
amount = amount + 1
end
end
return amount
elseif Config.Framework == 'qbx' then
return qbx:GetDutyCountType('leo')
end
end
function getNear(src)
if Config.Framework == 'qb' then
local near = {}
local players = QBCore.Functions.GetPlayers()
for k, v in pairs (players) do
local targ = QBCore.Functions.GetPlayerByCitizenId(v.PlayerData.citizenid)
local tname = GetName(v.PlayerData.source)
local ped, tped = GetPlayerPed(src), GetPlayerPed(v.PlayerData.source)
local dist = #(GetEntityCoords(ped) - GetEntityCoords(tped))
if dist < 5.0 then
table.insert(near, {label = tname, value = targ.PlayerData.citizenid})
end
end
return near
elseif Config.Framework == 'esx' then
local near = {}
local players = ESX.GetPlayers()
for k, v in pairs (players) do
local targ = ESX.GetPlayerFromId(v)
local tname = GetName(v)
local ped, tped = GetPlayerPed(src), GetPlayerPed(v)
local dist = #(GetEntityCoords(ped) - GetEntityCoords(tped))
if dist < 5.0 then
table.insert(near, {label = tname, value = getCid(v)})
end
end
return near
elseif Config.Framework == 'qbx' then
local near = {}
local players = qbx:GetPlayers()
for k, v in pairs (players) do
local targ = qbx:GetPlayer(v)
local tname = GetName(v)
local ped, tped = GetPlayerPed(src), GetPlayerPed(v)
local dist = #(GetEntityCoords(ped) - GetEntityCoords(tped))
if dist < 5.0 then
table.insert(near, {label = tname, value = getCid(v)})
end
end
return near
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
else
return false
end end
return amount
end 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 return getCops()
local players = QBCore.Functions.GetQBPlayers()
for k, v in pairs(players) do
if v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then
amount = amount + 1
end
end
return amount
end) end)
lib.callback.register('md-drugs:server:GetRep', function(source, cb, args) lib.callback.register('md-drugs:server:GetRep', function(source, cb, args)
local src = source
local rep = GetAllRep(source) local rep = GetAllRep(source)
return rep return rep
end) end)
CreateThread(function() CreateThread(function()
if not GetResourceState('ox_lib'):find("start") then if GetResourceState('ps-inventory') == 'started' then
print('^1 ox_lib Is A Depndancy, Not An Optional ') invname = 'ps-inventory'
elseif GetResourceState('qb-inventory') == 'started' then
invname = 'qb-inventory'
else
invname = 'inventory'
end end
end)
CreateThread(function()
local url = "https://raw.githubusercontent.com/Mustachedom/md-drugs/main/version.txt" local url = "https://raw.githubusercontent.com/Mustachedom/md-drugs/main/version.txt"
local version = GetResourceMetadata('md-drugs', "version" ) local version = GetResourceMetadata('md-drugs', "version" )
PerformHttpRequest(url, function(err, text, headers) PerformHttpRequest(url, function(err, text, headers)
@@ -354,4 +525,7 @@ CreateThread(function()
print('^2 Your Version:' .. version .. ' | Current Version:' .. text .. '' ) print('^2 Your Version:' .. version .. ' | Current Version:' .. text .. '' )
end end
end, "GET", "", "") end, "GET", "", "")
if GetResourceState('ox_lib') ~= 'started' then
print('^1 ox_lib Is A Depndancy, Not An Optional ')
end
end) end)
+57 -73
View File
@@ -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
@@ -83,18 +83,18 @@ RegisterServerEvent('md-drugs:server:cutheroin', function(num)
if not checkLoc(source, 'cutheroinone', num) then return end if not checkLoc(source, 'cutheroinone', num) then return end
if not Itemcheck(src, 'bakingsoda', 1) then return end if not Itemcheck(src, 'bakingsoda', 1) then return end
if Config.TierSystem then if Config.TierSystem then
local rawh = Player.Functions.GetItemByName('heroin') local heroin = {
local rawh2 = Player.Functions.GetItemByName('heroinstagetwo') heroin = 'tier1',
local rawh3 = Player.Functions.GetItemByName('heroinstagethree') heroinstagetwo = 'tier2',
if rawh then heroinstagethree = 'tier3'
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end }
elseif rawh2 then for k, v in pairs (heroin) do
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier2') then return end if hasItem(src, k, 1) then
elseif rawh3 then if not GetRecipe(src, 'heroin', 'cutheroin', v) then return end
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier3') then return end return
else end
Notifys(src, Lang.Heroin.noheroin, "error")
end end
Notifys(src, Lang.Heroin.noheroin, "error")
else else
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end
end end
@@ -102,11 +102,9 @@ end)
RegisterServerEvent('md-drugs:server:getheroinlabkit', function() RegisterServerEvent('md-drugs:server:getheroinlabkit', function()
local src = source local src = source
local Player = getPlayer(src) if not checkLoc(src, 'singleSpot', 'buyheroinlabkit') then return end
if not checkLoc(source, 'singleSpot', 'buyheroinlabkit') then return end if hasItem(src, 'heroinlabkit', 1) then Notifys(src, Lang.Heroin.haskit, 'error') return end
local has = Player.Functions.GetItemByName('heroinlabkit') if removeMoney(src, 'cash', prices.heroinlabkitprice) then
if has then Notifys(src, Lang.Heroin.haskit, 'error') return end
if Player.Functions.RemoveMoney('cash', prices.heroinlabkitprice) then
AddItem(src, 'heroinlabkit', 1) AddItem(src, 'heroinlabkit', 1)
else else
Notifys(src, 'You Need '.. prices.heroinlabkitprice .. ' In Cash For This', 'error') Notifys(src, 'You Need '.. prices.heroinlabkitprice .. ' In Cash For This', 'error')
@@ -117,7 +115,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
@@ -126,10 +124,9 @@ end
RegisterServerEvent('md-drugs:server:getheroinlabkitback', function() RegisterServerEvent('md-drugs:server:getheroinlabkitback', function()
local src = source local src = source
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
@@ -139,14 +136,13 @@ end)
CUI('heroinlabkit', function(source, item) CUI('heroinlabkit', function(source, item)
local src = source local src = source
local Player = getPlayer(src)
if not Itemcheck(source, 'heroinlabkit', 1) then return end if not Itemcheck(source, 'heroinlabkit', 1) then return end
local placed, loc = lib.callback.await('md-drugs:client:setheroinlabkit', src) local placed, loc = lib.callback.await('md-drugs:client:setheroinlabkit', src)
if placed then if placed then
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)
}) })
@@ -156,67 +152,55 @@ end)
RegisterServerEvent('md-drugs:server:heatliquidheroin', function() RegisterServerEvent('md-drugs:server:heatliquidheroin', function()
local src = source local src = source
local Player = getPlayer(src)
if not hasHKit(src) then return end if not hasHKit(src) then return end
if not Itemcheck(source, 'emptyvial', 1) then return end if not Itemcheck(source, 'emptyvial', 1) then return end
if Config.TierSystem then if Config.TierSystem then
local cuth = Player.Functions.GetItemByName('heroincut') local heroin = {
local cuth2 = Player.Functions.GetItemByName('heroincutstagetwo') heroincut = 'tier1',
local cuth3 = Player.Functions.GetItemByName('heroincutstagethree') heroincutstagetwo = 'tier2',
if cuth then heroincutstagethree = 'tier3'
if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end }
elseif cuth2 then for k, v in pairs (heroin) do
if not GetRecipe(src, 'heroin', 'fillvial', 'tier2') then return end if hasItem(src, k, 1) then
elseif cuth3 then if not GetRecipe(src, 'heroin', 'fillvial', v) then return end
if not GetRecipe(src, 'heroin', 'fillvial', 'tier3') then return end return
else end
Notifys(src, 'no cut heroin', "error")
end end
Notifys(src, 'no cut heroin', "error")
else else
if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end
end end
end) end)
RegisterServerEvent('md-drugs:server:failheatingheroin', function() RegisterServerEvent('md-drugs:server:failheatingheroin', function()
local src = source local src = source
local Player = getPlayer(src) if not hasHKit(src) then return end
if not hasHKit(src) then return end local heroin = {'heroincut', 'heroincutstagetwo', 'heroincutstagethree'}
local cuth = Player.Functions.GetItemByName('heroincut') for k, v in pairs (heroin) do
local cuth2 = Player.Functions.GetItemByName('heroincutstagetwo') if hasItem(src, v, 1) then
local cuth3 = Player.Functions.GetItemByName('heroincutstagethree') RemoveItem(src, v, 1)
if cuth then Notifys(src, Lang.Heroin.fail, "error")
RemoveItem(src, 'heroincut', 1) return
Notifys(src,Lang.Heroin.fail, "error") end
elseif cuth2 then
RemoveItem(src, 'heroincutstagetwo', 1)
Notifys(src,Lang.Heroin.fail, "error")
elseif cuth3 then
RemoveItem(src, 'heroincutstagethree', 1)
Notifys(src,Lang.Heroin.fail, "error")
end end
end) end)
RegisterServerEvent('md-drugs:server:fillneedle', function(num) RegisterServerEvent('md-drugs:server:fillneedle', function(num)
local src = source local src = source
local Player = getPlayer(src)
if not checkLoc(source, 'fillneedle', num) then return end if not checkLoc(source, 'fillneedle', num) then return end
if not Itemcheck(src, 'needle', 1) then return end if not Itemcheck(src, 'needle', 1) then return end
if Config.TierSystem then if Config.TierSystem then
local heroin = getRep(src, 'heroin') local vials = {
local vh = Player.Functions.GetItemByName('heroinvial') heroinvial = 'tier1',
local vh2 = Player.Functions.GetItemByName('heroinvialstagetwo') heroinvialstagetwo = 'tier2',
local vh3 = Player.Functions.GetItemByName('heroinvialstagethree') heroinvialstagethree = 'tier3'
if vh then }
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier1') then return end for k, v in pairs (vials) do
AddRep(src, 'heroin') if hasItem(src, k, 1) then
elseif vh2 then if not GetRecipe(src, 'heroin', 'fillneedle', v) then return end
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier2') then return end AddRep(src, 'heroin')
AddRep(src, 'heroin') return
elseif vh3 then end
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier3') then return end
AddRep(src, 'heroin')
else
Notifys(src,Lang.Heroin.nofill, "error")
end end
else else
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier1') then return end if not GetRecipe(src, 'heroin', 'fillneedle', 'tier1') then return end
@@ -225,15 +209,15 @@ end)
RegisterServerEvent('md-drugs:server:failheroin', function() RegisterServerEvent('md-drugs:server:failheroin', function()
local src = source local src = source
local Player = getPlayer(src)
Log(GetName(src) ..' Sucks And Burned Their Heroin', 'heroin') Log(GetName(src) ..' Sucks And Burned Their Heroin', 'heroin')
if Config.TierSystem then if Config.TierSystem then
local vh = Player.Functions.GetItemByName('heroinvial') local heroin = {'heroinvial', 'heroinvialstagetwo', 'heroinvialstagethree'}
local vh2 = Player.Functions.GetItemByName('heroinvialstagetwo') for k, v in pairs (heroin) do
local vh3 = Player.Functions.GetItemByName('heroinvialstagethree') if hasItem(src, v, 1) then
if vh then RemoveItem(src, 'heroinvialstagethree', 1 ) RemoveItem(src, v, 1)
elseif vh2 then RemoveItem(src, 'heroinvialstagetwo', 1) Notifys(src, Lang.Heroin.fail, "error")
elseif vh3 then RemoveItem(src, 'heroinvial', 1) return
end
end end
else else
RemoveItem(src, 'heroinvial', 1) RemoveItem(src, 'heroinvial', 1)
-1
View File
@@ -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)
+5
View File
@@ -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
+24 -32
View File
@@ -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
@@ -22,13 +22,12 @@ end)
CUI('lsdlabkit', function(source, item) CUI('lsdlabkit', function(source, item)
local src = source local src = source
local Player = getPlayer(src)
local placed, loc = lib.callback.await('md-drugs:client:setlsdlabkit', src) local placed, loc = lib.callback.await('md-drugs:client:setlsdlabkit', src)
if placed then if placed then
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(src),
src = src, src = src,
loc = loc loc = loc
}) })
@@ -37,10 +36,8 @@ CUI('lsdlabkit', function(source, item)
end) end)
local function hasLabKit(source) local function hasLabKit(source)
local src = source
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
@@ -56,9 +53,8 @@ end)
RegisterServerEvent('md-drugs:server:getlabkitback', function() RegisterServerEvent('md-drugs:server:getlabkitback', function()
local src = source local src = source
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
@@ -104,19 +100,21 @@ if not Itemcheck(src, 'lsd_one_vial', 1) then return end
end end
else else
local randomchance = math.random(1,100) local randomchance = math.random(1,100)
if RemoveItem(src,'lsd_one_vial', 1) then local items = {
if randomchance <= 60 then {chance = 60, item = 'lsd_vial_two'},
AddItem(src,'lsd_vial_two', 1) {chance = 75, item = 'lsd_vial_three'},
elseif randomchance >= 61 and randomchance <= 75 then {chance = 85, item = 'lsd_vial_four'},
AddItem(src,'lsd_vial_three', 1) {chance = 93, item = 'lsd_vial_five'},
elseif randomchance >= 76 and randomchance <= 85 then {chance = 100, item = 'lsd_vial_six'}
AddItem(src,'lsd_vial_four', 1) }
elseif randomchance >= 86 and randomchance <= 93 then if RemoveItem(src, 'lsd_one_vial', 1) then
AddItem(src,'lsd_vial_five', 1) for k, v in ipairs(items) do
else if randomchance <= v.chance then
AddItem(src,'lsd_vial_six', 1) AddItem(src, v.item, 1)
break
end
end end
Log(GetName(src) ..' Refined Acid!', 'lsd') Log(GetName(src) .. ' Refined Acid!', 'lsd')
end end
end end
end) end)
@@ -125,26 +123,24 @@ RegisterServerEvent('md-drugs:server:failrefinequality', function()
local src = source local src = source
if not hasLabKit(src) then return end if not hasLabKit(src) then return end
if not Itemcheck(src, 'lsd_one_vial', 1) then return end if not Itemcheck(src, 'lsd_one_vial', 1) then return end
RemoveItem(src,'lsd_one_vial', 1) RemoveItem(src,'lsd_one_vial', 1)
end) end)
RegisterServerEvent('md-drugs:server:gettabpaper', function(num) RegisterServerEvent('md-drugs:server:gettabpaper', function(num)
local src = source local src = source
local Player = getPlayer(src)
if not checkLoc(src, 'gettabs', num) then return end if not checkLoc(src, 'gettabs', num) then return end
if Player.Functions.RemoveMoney('cash', prices.tabcost * 10) then if removeMoney(src, 'cash', prices.tabcost * 10) then
AddItem(src,'tab_paper', 10) AddItem(src,'tab_paper', 10)
else else
Notifys(Lang.lsd.broke, "error") Notifys(Lang.lsd.broke, "error")
end end
end) end)
RegisterServerEvent('md-drugs:server:getlabkit', function() RegisterServerEvent('md-drugs:server:getlabkit', function()
local src = source local src = source
local Player = getPlayer(src)
if not checkLoc(src,'singleSpot', 'buylsdlabkit') then return end if not checkLoc(src,'singleSpot', 'buylsdlabkit') then return end
if Player.Functions.RemoveMoney('cash', prices.lsdlabkitcost) then if removeMoney(src,'cash', prices.lsdlabkitcost) then
AddItem(src,'lsdlabkit', 1) AddItem(src,'lsdlabkit', 1)
else else
Notifys(src, Lang.lsd.broke, "error") Notifys(src, Lang.lsd.broke, "error")
@@ -169,9 +165,7 @@ RegisterServerEvent('md-drugs:server:maketabpaper', function()
sortTab(vialdata, 'vial') sortTab(vialdata, 'vial')
for k, v in pairs (vialdata) do for k, v in pairs (vialdata) do
if count >= 1 then break end if count >= 1 then break end
local check = Player.Functions.GetItemByName(v.vial) if hasItem(src, v.vial, 1) then
if check and check.amount >= 1 then
items = v.vial items = v.vial
recieve = v.sheet recieve = v.sheet
count = count + 1 count = count + 1
@@ -197,7 +191,6 @@ local sheets = {
for k, v in pairs (sheets) do for k, v in pairs (sheets) do
CUI(v.item, function(source) CUI(v.item, function(source)
local src = source local src = source
local Player = getPlayer(src)
local math = math.random(1,10) local math = math.random(1,10)
if RemoveItem(src, v.item, 1) then if RemoveItem(src, v.item, 1) then
AddItem(src, v.recieve, math) AddItem(src, v.recieve, math)
@@ -208,9 +201,8 @@ end
AddEventHandler('playerDropped', function() AddEventHandler('playerDropped', function()
local src = source local src = source
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
View File
@@ -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
View File
@@ -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
+4 -7
View File
@@ -1,4 +1,4 @@
QBCore = exports['qb-core']:GetCoreObject()
local prices = { local prices = {
payfortruck = 500, payfortruck = 500,
hotchance = 30, hotchance = 30,
@@ -6,8 +6,7 @@ local prices = {
} }
lib.callback.register('md-drugs:server:payfortruck', function() lib.callback.register('md-drugs:server:payfortruck', function()
local src = source local src = source
local Player = getPlayer(src) if removeMoney(src, 'cash', prices.payfortruck) or removeMoney(src, 'bank', prices.payfortruck) then
if Player.Functions.RemoveMoney('cash', prices.payfortruck) or Player.Functions.RemoveMoney('bank', prices.payfortruck) then
Log(GetName(src) .. ' Rented A Van For OxyRuns', 'oxy') Log(GetName(src) .. ' Rented A Van For OxyRuns', 'oxy')
return true return true
else else
@@ -19,7 +18,6 @@ end)
RegisterServerEvent('md-drugs:server:giveoxybox', function() RegisterServerEvent('md-drugs:server:giveoxybox', function()
local src = source local src = source
local Player = getPlayer(src)
local chance = math.random(1,100) local chance = math.random(1,100)
local cash = 200 local cash = 200
local itemchance = math.random(1,100) local itemchance = math.random(1,100)
@@ -30,10 +28,10 @@ RegisterServerEvent('md-drugs:server:giveoxybox', function()
local item = itemList[math.random(1, #itemList)] local item = itemList[math.random(1, #itemList)]
if chance <= prices.hotchance then if chance <= prices.hotchance then
Notifys(src, Lang.oxy.hot, "error") Notifys(src, Lang.oxy.hot, "error")
Player.Functions.AddMoney("cash", cash * 0.5) addMoney(src, "cash", cash * 0.5)
if itemchance <= prices.itemChance then if itemchance <= prices.itemChance then
AddItem(src, item.item, item.amount) AddItem(src, item.item, item.amount)
end end
else else
Notifys(Lang.oxy.next, "success") Notifys(Lang.oxy.next, "success")
TriggerClientEvent("md-drugs:client:getoxylocationroute", src) TriggerClientEvent("md-drugs:client:getoxylocationroute", src)
@@ -42,6 +40,5 @@ RegisterServerEvent('md-drugs:server:giveoxybox', function()
AddItem(src, item.item, item.amount) AddItem(src, item.item, item.amount)
end end
end end
end) end)
+43 -44
View File
@@ -1,36 +1,37 @@
local QBCore = exports['qb-core']:GetCoreObject()
local function GetJob(source) local function getAmbo(source)
local src = source if Config.Framework == 'qbcore' then
local Player = getPlayer(src) local Player = QBCore.Functions.GetPlayer(source)
if Player.PlayerData.job.type == 'ems' then if Player.PlayerData.job.type == 'ems' then
return true return true
else end
Notifys(src, 'You Must Be EMS To Do This', 'error') elseif Config.Framework == 'esx' then
return false local Player = ESX.GetPlayerFromId(source)
if Player.job.name == 'ambulance' then
return true
end
end
end
local function getSource(player)
if Config.Framework == 'qbcore' then
return player.PlayerData.source
elseif Config.Framework == 'esx' then
return player.source
end end
end end
CUI('prescription_pad', function(source, item) CUI('prescription_pad', function(source, item)
local src = source local src = source
local near = {} if getAmbo(src) then
if GetJob(src) then local near = getNear(src)
for k, v in pairs (QBCore.Functions.GetQBPlayers()) do
local targ = QBCore.Functions.GetPlayerByCitizenId(v.PlayerData.citizenid)
local tname = GetName(v.PlayerData.source)
local ped, tped = GetPlayerPed(src), GetPlayerPed(v.PlayerData.source)
local dist = #(GetEntityCoords(ped) - GetEntityCoords(tped))
if dist < 5.0 then
table.insert(near, {label = tname, value = targ.PlayerData.citizenid})
end
end
local options = { {label = 'Vicodin', value = 'vicodin_prescription'}, {label = 'Adderal', value = 'adderal_prescription'}, {label = 'Morphine', value = 'morphine_prescription'},{label = 'Xanax', value = 'xanax_prescription'}} local options = { {label = 'Vicodin', value = 'vicodin_prescription'}, {label = 'Adderal', value = 'adderal_prescription'}, {label = 'Morphine', value = 'morphine_prescription'},{label = 'Xanax', value = 'xanax_prescription'}}
local data = lib.callback.await('md-drugs:client:prescriptionpad', src, near, options) local data = lib.callback.await('md-drugs:client:prescriptionpad', src, near, options)
if type(data) == 'table' then if type(data) == 'table' then
local give = QBCore.Functions.GetPlayerByCitizenId(data.who) local give = getPlayerByCid(data.who)
for i = 1, #options do for i = 1, #options do
if data.what == options[i].value then if data.what == options[i].value then
AddItem(give.PlayerData.source, data.what, 1) AddItem(getSource(give), data.what, 1)
end end
end end
end end
@@ -39,36 +40,34 @@ end)
local pharmabottle = {'vicodinbottle', 'adderalbottle','morphinebottle','xanaxbottle'} local pharmabottle = {'vicodinbottle', 'adderalbottle','morphinebottle','xanaxbottle'}
for m, d in pairs (pharmabottle) do for m, d in pairs (pharmabottle) do
CUI(d, function(source, item) CUI(d, function(source, item)
local src = source local src = source
local Player = getPlayer(src) local check = lib.callback.await("md-drugs:client:unbottle", src)
local check = lib.callback.await("md-drugs:client:unbottle", src) if check then
if check then local get = {
local get = { ['vicodinbottle'] = 'vicodin',
['vicodinbottle'] = 'vicodin', ['adderalbottle'] = 'adderal',
['adderalbottle'] = 'adderal', ['morphinebottle'] = 'morphine',
['morphinebottle'] = 'morphine', ['xanaxbottle'] = 'xanax'
['xanaxbottle'] = 'xanax' }
} for k, v in pairs (get) do
for k, v in pairs (get) do if d == k then
if d == k then RemoveItem(src, d, 1)
RemoveItem(src, d, 1) AddItem(src, v, math.random(10,30))
AddItem(src, v, math.random(10,30)) Notifys(src,Lang.Pharma.unbottle, "success")
Notifys(src,Lang.Pharma.unbottle, "success") Log(GetName(src) .. ' Unbottled 30 Of ' .. v .. '!', 'pharma')
Log(GetName(src) .. ' Unbottled 30 Of ' .. v .. '!', 'pharma') end
end end
end end
end end)
end)
end end
RegisterServerEvent('md-drugs:server:fillprescription', function() RegisterServerEvent('md-drugs:server:fillprescription', function()
local src = source local src = source
local Player = getPlayer(src)
local pres = {vicodin_prescription = 'vicodinbottle', adderal_prescription = 'adderalbottle', morphine_prescription = 'morphinebottle', xanax_prescription = 'xanaxbottle'} local pres = {vicodin_prescription = 'vicodinbottle', adderal_prescription = 'adderalbottle', morphine_prescription = 'morphinebottle', xanax_prescription = 'xanaxbottle'}
for k, v in pairs (pres) do for k, v in pairs (pres) do
if Player.Functions.GetItemByName(k) then if hasItem(src, k, 1) then
RemoveItem(src, k, 1 ) RemoveItem(src, k, 1 )
AddItem(src,v, 1) AddItem(src,v, 1)
break break
end end
+4 -5
View File
@@ -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
View File
@@ -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
View File
@@ -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"},
+2 -13
View File
@@ -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"},
@@ -68,7 +67,6 @@ end)
RegisterServerEvent('md-drugs:server:dryoutweed', function() RegisterServerEvent('md-drugs:server:dryoutweed', function()
local src = source local src = source
local Player = getPlayer(src)
if RemoveItem(src,"wetcannabis", 1) then if RemoveItem(src,"wetcannabis", 1) then
AddItem(src,"drycannabis", 1) AddItem(src,"drycannabis", 1)
Log(GetName(source) .. ' Dried Weed', 'weed') Log(GetName(source) .. ' Dried Weed', 'weed')
@@ -91,24 +89,18 @@ end
RegisterServerEvent('md-drugs:server:MakeWeedItems', function(data) RegisterServerEvent('md-drugs:server:MakeWeedItems', function(data)
local src = source local src = source
local Player = getPlayer(src)
if not Player then return end
if not GetRecipe(src, data.recipe, data.table, data.item) then return end if not GetRecipe(src, data.recipe, data.table, data.item) then return end
end) end)
RegisterServerEvent('md-drugs:server:makeoil', function(data) RegisterServerEvent('md-drugs:server:makeoil', function(data)
local src = source local src = source
local Player = getPlayer(src)
if not Player then return end
if not GetRecipe(src, 'weed', 'oil', 'shatter') then return end if not GetRecipe(src, 'weed', 'oil', 'shatter') then return end
end) end)
CUI("dabrig", function(source, item) CUI("dabrig", function(source, item)
local src = source local src = source
local Player = getPlayer(src) if hasItem(src,"butanetorch",1) then
if Player.Functions.GetItemByName("butanetorch") then
if RemoveItem(src, "shatter", 1) then if RemoveItem(src, "shatter", 1) then
TriggerClientEvent("md-drugs:client:dodabs", src) TriggerClientEvent("md-drugs:client:dodabs", src)
end end
@@ -119,9 +111,7 @@ end)
CUI("weedgrinder", function(source, item) CUI("weedgrinder", function(source, item)
local src = source local src = source
local Player = getPlayer(src) if not hasItem(src, 'drycannabis',1) then Notifys(src, 'You Need Dried Cannabis', 'error') return end
local has = Player.Functions.GetItemByName("drycannabis")
if not has then Notifys(src, 'You Need Dried Cannabis', 'error') return end
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Grinding Weed') local check = lib.callback.await('md-drugs:client:uncuff', src, 'Grinding Weed')
if not check then return end if not check then return end
if RemoveItem(src, "drycannabis",1 ) then if RemoveItem(src, "drycannabis",1 ) then
@@ -131,7 +121,6 @@ end)
CUI("mdwoods", function(source, item) CUI("mdwoods", function(source, item)
local src = source local src = source
local Player = getPlayer(src)
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Breaking Blunt Open') local check = lib.callback.await('md-drugs:client:uncuff', src, 'Breaking Blunt Open')
if not check then return end if not check then return end
if RemoveItem(src, "mdwoods",1 ) then if RemoveItem(src, "mdwoods",1 ) then
+5 -6
View File
@@ -18,10 +18,9 @@ local Price = {
for k, v in pairs (burners) do for k, v in pairs (burners) do
CUI(k, function(source, item) CUI(k, function(source, item)
local src = source local src = source
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 +35,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,13 +52,13 @@ 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)
if git and git.amount >= 1 then if git and git.amount >= 1 then
RemoveItem(src, d, git.amount) RemoveItem(src, d, git.amount)
Player.Functions.AddMoney('cash', git.amount * payout) addMoney(src, 'cash', git.amount * payout)
end end
table.remove(active, k) table.remove(active, k)
end end
+91 -133
View File
@@ -1,19 +1,17 @@
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)
local src = source local src = source
if not checkLoc(src, 'isosafrole',num) then return end if not checkLoc(src, 'isosafrole',num) then return end
if AddItem(src, "isosafrole", 1) then if AddItem(src, "isosafrole", 1) then
end end
end) end)
RegisterServerEvent('md-drugs:server:stealmdp2p', function(num) RegisterServerEvent('md-drugs:server:stealmdp2p', function(num)
local src = source local src = source
local Player = getPlayer(src)
if not checkLoc(src, 'mdp2p',num) then return end if not checkLoc(src, 'mdp2p',num) then return end
if AddItem(src,"mdp2p", 1) then if AddItem(src,"mdp2p", 1) then
end end
end) end)
@@ -34,7 +32,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 +45,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 +60,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
@@ -72,51 +70,26 @@ local function pressout(source)
end end
RegisterServerEvent('md-drugs:server:makextc', function(data) RegisterServerEvent('md-drugs:server:makextc', function(data)
local src = source local src = source
local Player = getPlayer(src) if not Itemcheck(src, 'raw_xtc', 1) then return end
if not Itemcheck(src, 'raw_xtc', 1) then return end
if pressout(src) == 'none' then return end local pressType = pressout(src)
if pressout(src) == 'single' then if pressType == 'none' then return end
if data.color == 'white' then
if not GetRecipe(src, 'xtc', 'singlestack', 'white') then return end local validColors = {'white', 'red', 'orange', 'blue'}
elseif data.color == 'red' then local isValidColor = false
if not GetRecipe(src, 'xtc', 'singlestack', 'red') then return end
elseif data.color == 'orange' then for _, color in ipairs(validColors) do
if not GetRecipe(src, 'xtc', 'singlestack', 'orange') then return end if data.color == color then
elseif data.color == 'blue' then isValidColor = true
if not GetRecipe(src, 'xtc', 'singlestack', 'blue') then return end break
end end
elseif pressout(src) == 'dual' then end
if data.color == 'white' then
if not GetRecipe(src, 'xtc', 'dualstack', 'white') then return end if not isValidColor then return end
elseif data.color == 'red' then
if not GetRecipe(src, 'xtc', 'dualstack', 'red') then return end local stackType = pressType .. 'stack'
elseif data.color == 'orange' then if not GetRecipe(src, 'xtc', stackType, data.color) then return end
if not GetRecipe(src, 'xtc', 'dualstack', 'orange') then return end
elseif data.color == 'blue' then
if not GetRecipe(src, 'xtc', 'dualstack', 'blue') then return end
end
elseif pressout(src) == 'triple' then
if data.color == 'white' then
if not GetRecipe(src, 'xtc', 'triplestack', 'white') then return end
elseif data.color == 'red' then
if not GetRecipe(src, 'xtc', 'triplestack', 'red') then return end
elseif data.color == 'orange' then
if not GetRecipe(src, 'xtc', 'triplestack', 'orange') then return end
elseif data.color == 'blue' then
if not GetRecipe(src, 'xtc', 'triplestack', 'blue') then return end
end
elseif pressout(src) == 'quad' then
if data.color == 'white' then
if not GetRecipe(src, 'xtc', 'quadstack', 'white') then return end
elseif data.color == 'red' then
if not GetRecipe(src, 'xtc', 'quadstack', 'red') then return end
elseif data.color == 'orange' then
if not GetRecipe(src, 'xtc', 'quadstack', 'orange') then return end
elseif data.color == 'blue' then
if not GetRecipe(src, 'xtc', 'quadstack', 'blue') then return end
end
end
end) end)
RegisterServerEvent('md-drugs:server:buypress', function() RegisterServerEvent('md-drugs:server:buypress', function()
@@ -133,117 +106,102 @@ RegisterServerEvent('md-drugs:server:buypress', function()
RegisterServerEvent('md-drugs:server:upgradepress', function(data) RegisterServerEvent('md-drugs:server:upgradepress', function(data)
local src = source local src = source
if data == 'dual' then if not GetRecipe(src, 'xtc', 'press', data) then return end
if not GetRecipe(src, 'xtc', 'press', 'dual') then return end
elseif data == 'triple' then
if not GetRecipe(src, 'xtc', 'press', 'triple') then return end
elseif data == 'quad' then
if not GetRecipe(src, 'xtc', 'press', 'quad') then return end
else
Notifys(src, 'huh', 'error')
end
end) end)
------------- making powder ------------- making powder
RegisterServerEvent('md-drugs:server:makingrawxtc', function(num) RegisterServerEvent('md-drugs:server:makingrawxtc', function(num)
local src = source local src = source
local Player = getPlayer(src)
if not checkLoc(src, 'rawxtcloc',num) then return end if not checkLoc(src, 'rawxtcloc',num) then return end
if not GetRecipe(src, 'xtc', 'raw', 'raw_xtc') then return end if not GetRecipe(src, 'xtc', 'raw', 'raw_xtc') then return end
end) end)
RegisterServerEvent('md-drugs:server:stampwhite', function(num) RegisterServerEvent('md-drugs:server:stampwhite', function(num)
local src = source local src = source
local one = {'white_playboys', 'white_aliens', 'white_pl', 'white_trolls', 'white_cats'} local whitePills = {
local chance = math.random(#one) {item = 'white_xtc', stamped = {'white_playboys', 'white_aliens', 'white_pl', 'white_trolls', 'white_cats'}},
local two = {'white_playboys2', 'white_aliens2', 'white_pl2', 'white_trolls2', 'white_cats2'} {item = 'white_xtc2', stamped = {'white_playboys2', 'white_aliens2', 'white_pl2', 'white_trolls2', 'white_cats2'}},
local three = {'white_playboys3', 'white_aliens3', 'white_pl3', 'white_trolls3', 'white_cats3'} {item = 'white_xtc3', stamped = {'white_playboys3', 'white_aliens3', 'white_pl3', 'white_trolls3', 'white_cats3'}},
local four = {'white_playboys4', 'white_aliens4', 'white_pl4', 'white_trolls4', 'white_cats4'} {item = 'white_xtc4', stamped = {'white_playboys4', 'white_aliens4', 'white_pl4', 'white_trolls4', 'white_cats4'}}
if not checkLoc(src, 'stamp', num) then return end }
local chance = math.random(1, 5)
if RemoveItem(src, "white_xtc", 1) then if not checkLoc(src, 'stamp', num) then return end
AddItem(src, one[chance], 1) for k, v in ipairs(whitePills) do
elseif RemoveItem(src, "white_xtc2", 1) then if RemoveItem(src, v.item, 1) then
AddItem(src, two[chance], 1) AddItem(src, v.stamped[chance], 1)
elseif RemoveItem(src, "white_xtc3", 1) then return
AddItem(src, three[chance], 1) end
elseif RemoveItem(src, "white_xtc4", 1) then end
AddItem(src, four[chance], 1) Notifys('You Dont Have Unstamped White Pills', 'error')
else
Notifys('You Dont Have Unstamped White Pills', 'error')
end
end) end)
RegisterServerEvent('md-drugs:server:stampred', function(num) RegisterServerEvent('md-drugs:server:stampred', function(num)
local src = source local src = source
local one = {'red_playboys', 'red_aliens', 'red_pl', 'red_trolls', 'red_cats'}
local chance = math.random(#one)
local two = {'red_playboys2', 'red_aliens2', 'red_pl2', 'red_trolls2', 'red_cats2'}
local three = {'red_playboys3', 'red_aliens3', 'red_pl3', 'red_trolls3', 'red_cats3'}
local four = {'red_playboys4', 'red_aliens4', 'red_pl4', 'red_trolls4', 'red_cats4'}
if not checkLoc(src, 'stamp', num) then return end if not checkLoc(src, 'stamp', num) then return end
local redPills = {
if RemoveItem(src, "red_xtc", 1) then {item = 'red_xtc', stamped = {'red_playboys', 'red_aliens', 'red_pl', 'red_trolls', 'red_cats'}},
AddItem(src, one[chance], 1) {item = 'red_xtc2', stamped = {'red_playboys2', 'red_aliens2', 'red_pl2', 'red_trolls2', 'red_cats2'}},
elseif RemoveItem(src, "red_xtc2", 1) then {item = 'red_xtc3', stamped = {'red_playboys3', 'red_aliens3', 'red_pl3', 'red_trolls3', 'red_cats3'}},
AddItem(src, two[chance], 1) {item = 'red_xtc4', stamped = {'red_playboys4', 'red_aliens4', 'red_pl4', 'red_trolls4', 'red_cats4'}}
elseif RemoveItem(src, "red_xtc3", 1) then }
AddItem(src, three[chance], 1) local chance = math.random(1, 5)
elseif RemoveItem(src, "red_xtc4", 1) then
AddItem(src, four[chance], 1) if not checkLoc(src, 'stamp', num) then return end
else for k, v in ipairs(redPills) do
Notifys('You Dont Have Unstamped red Pills', 'error') if RemoveItem(src, v.item, 1) then
end AddItem(src, v.stamped[chance], 1)
return
end
end
Notifys('You Dont Have Unstamped Red Pills', 'error')
end) end)
RegisterServerEvent('md-drugs:server:stamporange', function(num) RegisterServerEvent('md-drugs:server:stamporange', function(num)
local src = source local src = source
local one = {'orange_playboys', 'orange_aliens', 'orange_pl', 'orange_trolls', 'orange_cats'} local orangePills = {
local two = {'orange_playboys2', 'orange_aliens2', 'orange_pl2', 'orange_trolls2', 'orange_cats2'} {item = 'orange_xtc', stamped = {'orange_playboys', 'orange_aliens', 'orange_pl', 'orange_trolls', 'orange_cats'}},
local three = {'orange_playboys3', 'orange_aliens3', 'orange_pl3', 'orange_trolls3', 'orange_cats3'} {item = 'orange_xtc2', stamped = {'orange_playboys2', 'orange_aliens2', 'orange_pl2', 'orange_trolls2', 'orange_cats2'}},
local four = {'orange_playboys4', 'orange_aliens4', 'orange_pl4', 'orange_trolls4', 'orange_cats4'} {item = 'orange_xtc3', stamped = {'orange_playboys3', 'orange_aliens3', 'orange_pl3', 'orange_trolls3', 'orange_cats3'}},
local chance = math.random(#one) {item = 'orange_xtc4', stamped = {'orange_playboys4', 'orange_aliens4', 'orange_pl4', 'orange_trolls4', 'orange_cats4'}}
if not checkLoc(src, 'stamp', num) then return end }
local chance = math.random(1, 5)
if RemoveItem(src, "orange_xtc", 1) then
AddItem(src, one[chance], 1) if not checkLoc(src, 'stamp', num) then return end
elseif RemoveItem(src, "orange_xtc2", 1) then for k, v in ipairs(orangePills) do
AddItem(src, two[chance], 1) if RemoveItem(src, v.item, 1) then
elseif RemoveItem(src, "orange_xtc3", 1) then AddItem(src, v.stamped[chance], 1)
AddItem(src, three[chance], 1) return
elseif RemoveItem(src, "orange_xtc4", 1) then end
AddItem(src, four[chance], 1) end
else Notifys('You Dont Have Unstamped Orange Pills', 'error')
Notifys('You Dont Have Unstamped orange Pills', 'error')
end
end) end)
RegisterServerEvent('md-drugs:server:stampblue', function(num) RegisterServerEvent('md-drugs:server:stampblue', function(num)
local src = source local src = source
local one = {'blue_playboys', 'blue_aliens', 'blue_pl', 'blue_trolls', 'blue_cats'}
local chance = math.random(#one) local bluePills = {
local two = {'blue_playboys2', 'blue_aliens2', 'blue_pl2', 'blue_trolls2', 'blue_cats2'} {item = 'blue_xtc', stamped = {'blue_playboys', 'blue_aliens', 'blue_pl', 'blue_trolls', 'blue_cats'}},
local three = {'blue_playboys3', 'blue_aliens3', 'blue_pl3', 'blue_trolls3', 'blue_cats3'} {item = 'blue_xtc2', stamped = {'blue_playboys2', 'blue_aliens2', 'blue_pl2', 'blue_trolls2', 'blue_cats2'}},
local four = {'blue_playboys4', 'blue_aliens4', 'blue_pl4', 'blue_trolls4', 'blue_cats4'} {item = 'blue_xtc3', stamped = {'blue_playboys3', 'blue_aliens3', 'blue_pl3', 'blue_trolls3', 'blue_cats3'}},
{item = 'blue_xtc4', stamped = {'blue_playboys4', 'blue_aliens4', 'blue_pl4', 'blue_trolls4', 'blue_cats4'}}
}
local chance = math.random(1, 5)
if not checkLoc(src, 'stamp', num) then return end if not checkLoc(src, 'stamp', num) then return end
if RemoveItem(src, "blue_xtc", 1) then for k, v in ipairs(bluePills) do
AddItem(src, one[chance], 1) if RemoveItem(src, v.item, 1) then
elseif RemoveItem(src, "blue_xtc2", 1) then AddItem(src, v.stamped[chance], 1)
AddItem(src, two[chance], 1) return
elseif RemoveItem(src, "blue_xtc3", 1) then end
AddItem(src, three[chance], 1) end
elseif RemoveItem(src, "blue_xtc4", 1) then Notifys('You Dont Have Unstamped Blue Pills', 'error')
AddItem(src, four[chance], 1)
else
Notifys('You Dont Have Unstamped blue Pills', 'error')
end
end) end)
AddEventHandler('playerDropped', function() AddEventHandler('playerDropped', function()
local src = source local src = source
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
+9 -1
View File
@@ -49,4 +49,12 @@ 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()
elseif Config.Framework == 'qbx' then
qbx = exports.qbx_core
end