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 642 additions and 503 deletions

No files matched your search

+2 -1
View File
@@ -1,7 +1,8 @@
{
"Lua.diagnostics.disable": [
"missing-parameter",
"param-type-mismatch"
"param-type-mismatch",
"lowercase-global"
],
"Lua.diagnostics.globals": [
"lib",
+53 -8
View File
@@ -1,4 +1,3 @@
local QBCore = exports['qb-core']:GetCoreObject()
local progressbartype = Config.progressbartype
local minigametype = Config.minigametype
@@ -6,11 +5,33 @@ local notifytype = Config.Notify
local dispatch = Config.Dispatch
function getJobType()
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
function getJobName()
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
function progressbar(text, time, anim)
@@ -249,9 +270,9 @@ function makeMenu(name, rep)
end
if allow then
menu[#menu + 1] = {
icon = GetImage(v.name),
description = '$'.. v.price,
title = GetLabel(v.name),
icon = GetImage(v.name) or 'missing Item',
description = '$'.. v.price or 'Missing Item',
title = GetLabel(v.name) or 'Missing Item',
onSelect = function()
local settext = "Cost: $"..v.price
local dialog = exports.ox_lib:inputDialog(v.name .."!", {
@@ -395,7 +416,6 @@ function tele(coords)
DoScreenFadeIn(500)
end
function AddBoxZoneSingle(name, loc, data)
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},
@@ -460,7 +480,7 @@ function AddBoxZoneMulti(name, table, data)
label = data.label,
data = k,
canInteract = data.canInteract or function()
if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
if getGang() == v.gang or v.gang == 1 then return true end end
}
},
distance = 2.5
@@ -476,7 +496,7 @@ function AddBoxZoneMulti(name, table, data)
data = k,
distance = 2.5,
canInteract = data.canInteract or function()
if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
if getGang() == v.gang or v.gang == 1 then return true end end
}
}, })
elseif Config.Target == 'interact' then
@@ -494,7 +514,7 @@ function AddBoxZoneMulti(name, table, data)
label = data.label or "fa-solid fa-eye",
data = k,
canInteract = data.canInteract or function()
if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
if getGang() == v.gang or v.gang == 1 then return true end end
},
}
})
@@ -641,6 +661,31 @@ function StartRay2()
until run == false
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()
LoadModel('prop_plant_01b')
LoadModel('prop_plant_01a')
+1 -1
View File
@@ -1,13 +1,13 @@
local carryPackage = nil
RegisterNetEvent("md-drugs:client:GetOxyCar", function()
print("oxy")
lib.requestModel("burrito3", Config.RequestModelTime)
local paid = lib.callback.await('md-drugs:server:payfortruck', false)
if not paid then return end
local loca = lib.callback.await('md-drugs:server:getLocs', false)
local loc = loca.singleSpot.truckspawn
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))
Notify(Lang.oxy.truck, 'success')
TriggerEvent("md-drugs:client:getoxylocationroute")
+2 -1
View File
@@ -1,6 +1,6 @@
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?',{
{type = 'select', label = 'Player Name', options = data},
{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
return true
end)
-1
View File
@@ -36,7 +36,6 @@ RegisterNetEvent("weed:init", function()
lib.requestModel('prop_weed_01', 1000)
if not v.taken then
WeedPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z-3.5, false, true, true)
print(WeedPlant[k])
Freeze(WeedPlant[k],true, v.heading)
AddSingleModel(WeedPlant[k], {icon = "fas fa-hand",label = Lang.targets.weed.pick, action = function() pick(k) end}, k)
end
+2
View File
@@ -4,7 +4,9 @@ description "drugs by mustache dom"
fx_version "cerulean"
game "gta5"
version '3.9.0'
client_scripts {
--'@qbx_core/modules/playerdata.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` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cid` varchar(50) NOT NULL,
+10 -23
View File
@@ -65,71 +65,58 @@ end)
RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
local src = source
local Player = getPlayer(src)
local count = 0
if Config.FancyCokeAnims then
if not checkLoc(src, 'singleSpot', 'cutcoke') then return end
else
if not checkLoc(src, 'CuttingCoke', num) then return end
end
local tier = 'tier1'
if Config.TierSystem then
local tier = ''
local cokeTiers = {
{item = 'coke', tier = 'tier1', log = ' Cut Coke'},
{item = 'cokestagetwo', tier = 'tier2', log = ' Cut Coke tier 2'},
{item = 'cokestagethree', tier = 'tier3', log = ' Cut Coke tier 3'}
}
for _, v in ipairs(cokeTiers) do
if count >= 1 then break end
if Player.Functions.GetItemByName(v.item) then
if hasItem(src, v.item, 1) then
tier = v.tier
count = count + 1
break
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)
RegisterServerEvent('md-drugs:server:bagcoke', function(num)
local src = source
local Player = getPlayer(src)
local count = 0
local tier = ''
if Config.FancyCokeAnims then
if not checkLoc(src, 'singleSpot', 'bagcokepowder') then return end
else
if not checkLoc(src, 'BaggingCoke', num) then return end
end
local tier = 'tier1'
if Config.TierSystem then
local coke = getRep(src, 'coke')
local cokeTiers = {
{item = 'loosecoke', tier = 'tier1', log = ' Bagged Coke'},
{item = 'loosecokestagetwo', tier = 'tier2', log = ' Bagged Coke tier 2'},
{item = 'loosecokestagethree', tier = 'tier3', log = ' Bagged Coke tier 3'}
}
for _, v in ipairs(cokeTiers) do
if Player.Functions.GetItemByName(v.item) then
if count >= 1 then break end
count = count + 1
if hasItem(src, v.item, 1) then
tier = v.tier
break
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
AddRep(src, 'coke', 1)
end)
local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3}
for k, v in pairs (cokecut) do
CUI(k, function(source, item)
local src = source
local Player = getPlayer(src)
if not Player.Functions.GetItemByName('bakingsoda') then Notifys(src, 'You Need Baking Soda For this', 'error') return end
if Player.Functions.GetItemByName(item.name) then
if hasItem(src, k, 1) then
if not Itemcheck(src, 'bakingsoda', 1) then return end
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting It Further')
if not check then return end
+43 -9
View File
@@ -1,4 +1,4 @@
local QBCore = exports['qb-core']:GetCoreObject()
--[[
effect options
alien
@@ -158,24 +158,58 @@ for k, v in pairs(Consume) do
end
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
local Player = getPlayer(source)
local hunger, thirst = Player.PlayerData.metadata.hunger, Player.PlayerData.metadata.thirst
local source = source
local hunger, thirst, stress, armor
if Config.Framework == "qb" then
local Player = QBCore.Functions.GetPlayer(source)
hunger = Player.PlayerData.metadata["hunger"]
thirst = Player.PlayerData.metadata["thirst"]
stress = Player.PlayerData.metadata["stress"]
armor = Player.PlayerData.metadata["armor"]
if stat == "thirst" then
local value = thirst + statval
local value = math.min(thirst + statval, 100)
Player.Functions.SetMetaData('thirst', value)
TriggerClientEvent('hud:client:UpdateNeeds', source, hunger, value)
elseif stat == "hunger" then
local value = hunger + statval
local value = math.min(hunger + statval, 100)
Player.Functions.SetMetaData('hunger', value)
TriggerClientEvent('hud:client:UpdateNeeds', source, value, thirst)
elseif stat == "stress" then
local value = Player.PlayerData.metadata.stress + statval
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 = Player.PlayerData.metadata.armor + statval
local value = math.min(armor + statval, 100)
Player.Functions.SetMetaData('armor', value)
TriggerEvent('hospital:server:SetArmor', value)
TriggerClientEvent('hud:client:UpdateStress', source, Player.PlayerData.metadata.armor, value)
else
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)
+28 -50
View File
@@ -1,4 +1,4 @@
local QBCore = exports['qb-core']:GetCoreObject()
local DrugDeals = {}
local Drugs = {
["weed_white-widow"] = {rep = 1,min = 15, max = 24 },
@@ -125,70 +125,53 @@ lib.callback.register('md-drugs:server:cornerselling:getAvailableDrugs', functio
local Player = getPlayer(source)
local rep = getRep(source, 'cornerselling')
if not Player then return nil end
local type = 0
for k, v in pairs(Drugs) do
local item = Player.Functions.GetItemByName(k)
if item and type == 0 then
type = type + 1
Log(GetName(source) .. ' Allowed To Sell ' .. item.name .. '!' , 'cornerselling')
local amount = math.random(1,item.amount)
if amount >= 15 then amount = 15 end
local price = math.random(Drugs[k]['min'], Drugs[k]['max']) * amount
local result = math.floor(price * rep.price)
table.insert(DrugDeals, {item = item.name, amount = amount, price = result, cid = Player.PlayerData.citizenid, ped = ped})
return {item = item.name, amount = amount, price = result, ped = ped}
local item = getItemCount(source, k)
if item >= 1 then
if item > 15 then item = 15 end
local amount = math.random(1, item)
local price = (math.random(Drugs[k]['min'], Drugs[k]['max']) * amount) * rep.price
DrugDeals[getCid(source)] = {item = k, amount = amount, price = price, ped = ped}
Log(GetName(source) .. ' Allowed To Sell ' .. k .. '!' , 'cornerselling')
return DrugDeals[getCid(source)]
end
end
if type == 0 then
return {item = 'nothing', amount = 0, price = 0, ped = ped}
end
end)
lib.callback.register('md-drugs:server:hasDrugs', function(source)
local Player = getPlayer(source)
for k, v in pairs(Drugs) do
local item = Player.Functions.GetItemByName(k)
if item then
if hasItem(source, k, 1) then
return true
end
end
return false
end)
RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price)
local src = source
local Player = getPlayer(src)
local function csCheck(src, item, amount, price)
local isIn = false
for k, v in pairs (Drugs) do
if item == k then
isIn = true
end
end
if not isIn then return end
for k, v in pairs (DrugDeals) do
if v.cid == Player.PlayerData.citizenid then
if v.item == item then
if v.amount == amount then
if v.price == price then
if RemoveItem(src, item, amount) then
if QBConfig.MarkedBills then
local info = {
worth = price
}
Player.Functions.AddItem('markedbills', 1, false, info )
elseif QBConfig.CustomDirtyMoney == true then
AddItem(src, QBConfig.CustomDirtyMoneyitem, price)
else
Player.Functions.AddMoney('cash', price)
if not isIn then return false end
if DrugDeals[getCid(src)] then
if DrugDeals[getCid(src)].item == item and DrugDeals[getCid(src)].amount == amount and DrugDeals[getCid(src)].price == price then
return true
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(GetName(src) .. ' Sold ' .. amount .. ' Of ' .. item .. ' For A Price Of ' .. price .. '!' , 'cornerselling')
table.remove(DrugDeals, k)
end
end
end
end
end
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)
@@ -198,18 +181,13 @@ lib.addCommand('cornersell', {
},
}, function(source, args, raw)
local src = source
local Player = getPlayer(src)
Log(GetName(source) .. ' Used Command cornersell!' , 'cornerselling')
TriggerClientEvent('md-drugs:client:cornerselling', src)
end)
RegisterServerEvent('md-drugs:server:cornerselling:stop', function()
local src = source
local Player = getPlayer(src)
for k, v in pairs (DrugDeals) do
if v.cid == Player.PlayerData.citizenid then
TriggerClientEvent('md-drugs:client:cornerselling:remove', src, DrugDeals[k].ped)
table.remove(DrugDeals, k)
end
if DrugDeals[getCid(src)] then
DrugDeals[getCid(src)] = nil
end
end)
+7 -13
View File
@@ -1,9 +1,7 @@
local QBCore = exports['qb-core']:GetCoreObject()
RegisterServerEvent('md-drugs:server:makecrackone', function(num)
local src = source
local Player = getPlayer(src)
local count,type, tier = 0, 'cookcrack', 'tier1'
local type, tier ='cookcrack', 'tier1'
if not checkLoc(src, 'makecrack', num) then return end
if Config.TierSystem then
local crackTiers = {
@@ -12,10 +10,9 @@ RegisterServerEvent('md-drugs:server:makecrackone', function(num)
{item = 'loosecokestagethree', tier = 'tier3', log = ' Cut Crack tier 3'}
}
for _, v in ipairs(crackTiers) do
if count >= 1 then break end
if Player.Functions.GetItemByName(v.item) then
if hasItem(src, v.item, 1) then
tier = v.tier
count = count + 1
break
end
end
end
@@ -25,8 +22,7 @@ end)
RegisterServerEvent('md-drugs:server:bagcrack', function(num)
local src = source
local Player = getPlayer(src)
local count,type, tier = 0, 'bagcrack', 'tier1'
local type, tier = 'bagcrack', 'tier1'
if not checkLoc(src, 'bagcrack', num) then return end
if Config.TierSystem then
local crackTiers = {
@@ -35,10 +31,9 @@ RegisterServerEvent('md-drugs:server:bagcrack', function(num)
{item = 'crackrockstagethree', tier = 'tier3', log = ' Bagged Crack tier 3'}
}
for _, v in ipairs(crackTiers) do
if count >= 1 then break end
if Player.Functions.GetItemByName(v.item) then
if hasItem(src, v.item, 1) then
tier = v.tier
count = count + 1
break
end
end
end
@@ -49,8 +44,7 @@ local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3}
for k, v in pairs (cokecut) do
CUI(k, function(source, item)
local src = source
local Player = getPlayer(src)
if Player.Functions.GetItemByName(item.name) then
if hasItem(src, k, 1) then
if not Itemcheck(src, 'bakingsoda', 1) then return end
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting Crack Rock Further')
if not check then return end
+14 -25
View File
@@ -1,4 +1,3 @@
local QBCore = exports['qb-core']:GetCoreObject()
local dloc = {
{coords = vector4(282.48, -1814.32, 27.23, 145.11)},
@@ -101,28 +100,23 @@ local DeliveryItems = {
lib.callback.register('md-drugs:server:GetDeliveryItem', function(data)
local src = source
local Player = getPlayer(src)
local itemnum = math.random(1, #DeliveryItems)
local item = DeliveryItems[itemnum].item
local amount = math.random(1,4)
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {getCid(src)})
local locnum = math.random(1, #dloc)
local coord = json.encode({
x = dloc[locnum].coords.x,
y = dloc[locnum].coords.y,
z = dloc[locnum].coords.z ,
w = dloc[locnum].coords.w
})
local coord = json.encode({ x = dloc[locnum].coords.x, y = dloc[locnum].coords.y, z = dloc[locnum].coords.z , w = dloc[locnum].coords.w })
if not check[1] then
MySQL.insert('INSERT INTO deliveriesdealer SET cid = ?, itemdata = ?, timestart = ?, maxtime = ?, location = ?',
{Player.PlayerData.citizenid, json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
AddItem(Player.PlayerData.source, item, amount)
{getCid(src), json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
AddItem(src, item, amount)
return true, item, amount, coord
else
local time = os.time()
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
if timeout > 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) Notifys(src, 'You Failed To Make It In Time!', 'error' ) return false end
if timeout > 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {getCid(src)}) Notifys(src, 'You Failed To Make It In Time!', 'error' ) return false end
Notifys(src,'You Already Have A Delivery To Make', 'error' ) return false, item, amount, coord
end
end)
@@ -130,23 +124,23 @@ end)
RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount)
local src = source
local Player = getPlayer(src)
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {getCid(src)})
if not check[1] then return end
local time = os.time()
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
local itemData = json.decode(check[1].itemdata)
if timeout >= 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) Notifys(source, 'You Failed To Make It In Time!', 'error' ) return end
if timeout >= 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {getCid(src)}) Notifys(source, 'You Failed To Make It In Time!', 'error' ) return end
if item ~= itemData.item then return end
if amount ~= itemData.amount then return end
if RemoveItem(src, item, amount) then
for k, v in pairs (DeliveryItems) do
if v.item == item then
local income = math.random(v.payout.min, v.payout.max)
Player.Functions.AddMoney('cash', income)
addMoney(src, 'cash', income)
AddRep(src, 'dealerrep')
end
end
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {getCid(src)})
end
end)
@@ -173,16 +167,11 @@ lib.addCommand("newdealer", {
end
MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', {
dealerName, pos, 'nil', Player.PlayerData.citizenid
dealerName, pos, 'nil', getCid(source)
}, function()
QBConfig.Dealers[dealerName] = {
name = dealerName,
coords = {
x = coords.x,
y = coords.y,
z = coords.z,
h = GetEntityHeading(ped)
},
coords = { x = coords.x, y = coords.y, z = coords.z, h = GetEntityHeading(ped) },
}
TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers)
end)
@@ -202,8 +191,8 @@ lib.addCommand("deletedealer", {
MySQL.query('DELETE FROM dealers WHERE name = ?', { dealerName })
QBConfig.Dealers[dealerName] = nil
TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers)
TriggerClientEvent('QBCore:Notify', source, "Dealer Deleted", "success")
Notifys(source, "Dealer Deleted", "success")
else
TriggerClientEvent('QBCore:Notify', source, "Who You Tryna Delete", "error")
Notifys(source, "Who You Tryna Delete", "error")
end
end)
+269 -95
View File
@@ -1,6 +1,8 @@
local QBCore = exports['qb-core']:GetCoreObject()
local QBCore, ESX, qbx = {}, {}, nil
local notify = Config.Notify -- qb or ox
local inventory = Config.Inventory -- qb or ox
local invname = ''
------------------------------------------ logging stuff
local logs = false
local logapi = GetConvar("fivemerrLogs", "")
@@ -10,6 +12,15 @@ local headers = {
['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()
if logs then
print'^2 Logs Enabled for md-drugs'
@@ -25,14 +36,8 @@ end)
function Log(message, type)
if logs == false then return end
local buffer = {
level = "info",
message = message,
resource = GetCurrentResourceName(),
metadata = {
drugs = type,
playerid = source
}
local buffer = { level = "info", message = message, resource = GetCurrentResourceName(),
metadata = { drugs = type, playerid = source}
}
SetTimeout(500, function()
PerformHttpRequest(endpoint, function(status, _, _, response)
@@ -45,27 +50,60 @@ if logs == false then return end
buffer = nil
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
function getPlayer(source)
local src = source
if Config.Framework == 'qb' then
local Player = QBCore.Functions.GetPlayer(src)
return Player
elseif Config.Framework == 'esx' then
local Player = ESX.GetPlayerFromId(src)
return Player
elseif Config.Framework == 'qbx' then
local Player = qbx:GetPlayer(source)
return Player
end
end
function getPlayerByCid(cid)
if Config.Framework == 'qb' then
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 Player = getPlayer(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
function GetCoords(source)
@@ -78,6 +116,7 @@ function dist(source, coords)
local playerPed = GetPlayerPed(source)
local pcoords = GetEntityCoords(playerPed)
local dist = #(pcoords - coords)
return dist
end
@@ -117,7 +156,13 @@ function GetLabels(item)
end
function CUI(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
function Itemcheck(source, item, amount)
@@ -141,6 +186,48 @@ function Itemcheck(source, item, amount)
end
end
function hasItem(source, item, amount)
if inventory == 'qb' then
local Player = getPlayer(source)
local itemchecks = Player.Functions.GetItemByName(item)
if itemchecks and itemchecks.amount >= amount then
return true
else
return false
end
elseif inventory == 'ox' then
local items = exports.ox_inventory:GetItem(source, item, nil, false)
if items == nil then return false end
if items.count >= amount then
return true
else
return false
end
end
end
function getItemCount(source, item)
if inventory == 'qb' then
local Player = getPlayer(source)
local itemchecks = Player.Functions.GetItemByName(item)
if itemchecks then
return itemchecks.amount
else
return false
end
elseif inventory == 'ox' then
local items = exports.ox_inventory:GetItem(source, item, nil, false)
if items == nil then
print('You are missing ' .. item)
return 0
end
if items.count >= 1 then
return items.count
else
return 0
end
end
end
function RemoveItem(source, item, amount)
if inventory == 'qb' then
local Player = getPlayer(source)
@@ -170,8 +257,6 @@ function AddItem(source, item, amount)
return false
end
else
local carry = exports.ox_inventory:CanCarryItem(source, item, amount)
if not carry then Notifys(source, 'You Cant Carry that Much Weight!', 'error') return false end
if exports.ox_inventory:AddItem(source, item, amount) then
return true
else
@@ -181,66 +266,85 @@ function AddItem(source, item, amount)
end
end
function getRep(source, type)
function addMoney(source, type, amount)
if Config.Framework == 'qb' then
local Player = getPlayer(source)
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
if not sql[1] then
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 removeMoney(source, type, amount)
if Config.Framework == 'qb' then
local Player = getPlayer(source)
if Player.Functions.RemoveMoney(type, amount) then
return true
else
return false
end
elseif Config.Framework == 'esx' then
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 = Player.PlayerData.metadata.coke or 0,
lsd = Player.PlayerData.metadata.lsd or 0,
heroin = Player.PlayerData.metadata.heroin or 0,
dealerrep = Player.PlayerData.metadata.dealerrep or 0,
cornerselling = {
price = QBConfig.SellLevel[1].price,
rep = 0,
label = QBConfig.SellLevel[1].label,
level = 1
}
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 = ?', {Player.PlayerData.citizenid, table, GetName(source)})
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
local new = handleFresh(source)
return new[type]
else
local reps = json.decode(sql[1].drugrep)
local rep = ''
if reps.coke == nil then rep = reps[1] else rep = reps end
if type == 'coke' then
return rep.coke
elseif type == 'heroin' then
return rep.heroin
elseif type == 'lsd' then
return rep.lsd
elseif type == 'dealerrep' then
return rep.dealerrep
elseif type == 'cornerselling' then
return rep.cornerselling
else
print('^1 Error: No Valid Drug Rep Option Chosen')
end
return false
return rep[type]
end
end
function GetAllRep(source)
local Player = getPlayer(source)
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {getCid(source)})
if not sql[1] then
local table = json.encode({
coke = Player.PlayerData.metadata.coke or 0,
lsd = Player.PlayerData.metadata.lsd or 0,
heroin = Player.PlayerData.metadata.heroin or 0,
dealerrep = Player.PlayerData.metadata.dealerrep or 0,
cornerselling = {
price = QBConfig.SellLevel[1].price,
rep = 0,
label = QBConfig.SellLevel[1].label,
level = 1
}
})
MySQL.insert('INSERT INTO drugrep SET cid = ?, drugrep = ?, name = ?', {Player.PlayerData.citizenid, table, GetName(source)})
Wait(1000)
return json.decode(table)
local new = handleFresh(source)
return new
else
local rep = json.decode(sql[1].drugrep)
if rep.coke == nil then return rep[1] end
@@ -249,9 +353,9 @@ function GetAllRep(source)
end
function AddRep(source, type, amount)
if not Config.TierSystem then return false end
if not amount then amount = 1 end
local Player = getPlayer(source)
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {getCid(source)})
local reps = json.decode(sql[1].drugrep)
local update
local rep = ''
@@ -266,18 +370,14 @@ function AddRep(source, type, amount)
end
end
end
elseif type == 'coke' then
update = json.encode({coke = rep.coke + amount, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = rep.cornerselling})
elseif type == 'heroin' then
update = json.encode({coke = rep.coke, heroin = rep.heroin + amount, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = rep.cornerselling})
elseif type == 'lsd' then
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd +amount , dealerrep = rep.dealerrep, cornerselling = rep.cornerselling})
elseif type == 'dealerrep' then
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep + amount, cornerselling = rep.cornerselling})
end
if update == '' then return false end
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, Player.PlayerData.citizenid})
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, getCid(source)})
return true
else
rep[type] = rep[type] + amount
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {json.encode(rep), getCid(source)})
return true
end
end
lib.addCommand('addCornerSellingTOREP', {
@@ -314,6 +414,7 @@ end
function getCops()
local amount = 0
if Config.Framework == 'qb' then
local players = QBCore.Functions.GetQBPlayers()
for k, v in pairs(players) do
if v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then
@@ -321,32 +422,102 @@ function getCops()
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
lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args)
local amount = 0
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
return getCops()
end)
lib.callback.register('md-drugs:server:GetRep', function(source, cb, args)
local src = source
local rep = GetAllRep(source)
return rep
end)
CreateThread(function()
if not GetResourceState('ox_lib'):find("start") then
print('^1 ox_lib Is A Depndancy, Not An Optional ')
if GetResourceState('ps-inventory') == 'started' then
invname = 'ps-inventory'
elseif GetResourceState('qb-inventory') == 'started' then
invname = 'qb-inventory'
else
invname = 'inventory'
end
end)
CreateThread(function()
local url = "https://raw.githubusercontent.com/Mustachedom/md-drugs/main/version.txt"
local version = GetResourceMetadata('md-drugs', "version" )
PerformHttpRequest(url, function(err, text, headers)
@@ -354,4 +525,7 @@ CreateThread(function()
print('^2 Your Version:' .. version .. ' | Current Version:' .. text .. '' )
end
end, "GET", "", "")
if GetResourceState('ox_lib') ~= 'started' then
print('^1 ox_lib Is A Depndancy, Not An Optional ')
end
end)
+53 -69
View File
@@ -1,4 +1,4 @@
local QBCore = exports['qb-core']:GetCoreObject()
local prices = {
heroinlabkitprice = 10000
}
@@ -40,7 +40,7 @@ end
lib.callback.register('removeCleaningkit', function(source)
local Player = getPlayer(source)
for k, v in pairs(heroinLabKits) do
if v.ownerid == Player.PlayerData.citizenid then
if v.ownerid == getCid(source) then
RemoveItem(source, 'cleaningkit', 1)
return true
end
@@ -83,18 +83,18 @@ RegisterServerEvent('md-drugs:server:cutheroin', function(num)
if not checkLoc(source, 'cutheroinone', num) then return end
if not Itemcheck(src, 'bakingsoda', 1) then return end
if Config.TierSystem then
local rawh = Player.Functions.GetItemByName('heroin')
local rawh2 = Player.Functions.GetItemByName('heroinstagetwo')
local rawh3 = Player.Functions.GetItemByName('heroinstagethree')
if rawh then
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end
elseif rawh2 then
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier2') then return end
elseif rawh3 then
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier3') then return end
else
Notifys(src, Lang.Heroin.noheroin, "error")
local heroin = {
heroin = 'tier1',
heroinstagetwo = 'tier2',
heroinstagethree = 'tier3'
}
for k, v in pairs (heroin) do
if hasItem(src, k, 1) then
if not GetRecipe(src, 'heroin', 'cutheroin', v) then return end
return
end
end
Notifys(src, Lang.Heroin.noheroin, "error")
else
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end
end
@@ -102,11 +102,9 @@ end)
RegisterServerEvent('md-drugs:server:getheroinlabkit', function()
local src = source
local Player = getPlayer(src)
if not checkLoc(source, 'singleSpot', 'buyheroinlabkit') then return end
local has = Player.Functions.GetItemByName('heroinlabkit')
if has then Notifys(src, Lang.Heroin.haskit, 'error') return end
if Player.Functions.RemoveMoney('cash', prices.heroinlabkitprice) then
if not checkLoc(src, 'singleSpot', 'buyheroinlabkit') then return end
if hasItem(src, 'heroinlabkit', 1) then Notifys(src, Lang.Heroin.haskit, 'error') return end
if removeMoney(src, 'cash', prices.heroinlabkitprice) then
AddItem(src, 'heroinlabkit', 1)
else
Notifys(src, 'You Need '.. prices.heroinlabkitprice .. ' In Cash For This', 'error')
@@ -117,7 +115,7 @@ local function hasHKit(src)
local src = source
local Player = getPlayer(src)
for k, v in pairs(heroinLabKits) do
if v.ownerid == Player.PlayerData.citizenid then
if v.ownerid == getCid(source) then
return true
end
end
@@ -126,10 +124,9 @@ end
RegisterServerEvent('md-drugs:server:getheroinlabkitback', function()
local src = source
local Player = getPlayer(src)
if not hasHKit(src) then return end
for k, v in pairs (heroinLabKits) do
if v.ownerid == Player.PlayerData.citizenid then
if v.ownerid == getCid(source) then
table.remove(heroinLabKits, k)
AddItem(src, 'heroinlabkit', 1)
end
@@ -139,14 +136,13 @@ end)
CUI('heroinlabkit', function(source, item)
local src = source
local Player = getPlayer(src)
if not Itemcheck(source, 'heroinlabkit', 1) then return end
local placed, loc = lib.callback.await('md-drugs:client:setheroinlabkit', src)
if placed then
RemoveItem(src, 'heroinlabkit', 1)
table.insert(heroinLabKits, {
src = src,
ownerid = Player.PlayerData.citizenid,
ownerid = getCid(source),
coords = loc,
name = GetName(src)
})
@@ -156,22 +152,21 @@ end)
RegisterServerEvent('md-drugs:server:heatliquidheroin', function()
local src = source
local Player = getPlayer(src)
if not hasHKit(src) then return end
if not Itemcheck(source, 'emptyvial', 1) then return end
if Config.TierSystem then
local cuth = Player.Functions.GetItemByName('heroincut')
local cuth2 = Player.Functions.GetItemByName('heroincutstagetwo')
local cuth3 = Player.Functions.GetItemByName('heroincutstagethree')
if cuth then
if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end
elseif cuth2 then
if not GetRecipe(src, 'heroin', 'fillvial', 'tier2') then return end
elseif cuth3 then
if not GetRecipe(src, 'heroin', 'fillvial', 'tier3') then return end
else
Notifys(src, 'no cut heroin', "error")
local heroin = {
heroincut = 'tier1',
heroincutstagetwo = 'tier2',
heroincutstagethree = 'tier3'
}
for k, v in pairs (heroin) do
if hasItem(src, k, 1) then
if not GetRecipe(src, 'heroin', 'fillvial', v) then return end
return
end
end
Notifys(src, 'no cut heroin', "error")
else
if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end
end
@@ -179,44 +174,33 @@ end)
RegisterServerEvent('md-drugs:server:failheatingheroin', function()
local src = source
local Player = getPlayer(src)
if not hasHKit(src) then return end
local cuth = Player.Functions.GetItemByName('heroincut')
local cuth2 = Player.Functions.GetItemByName('heroincutstagetwo')
local cuth3 = Player.Functions.GetItemByName('heroincutstagethree')
if cuth then
RemoveItem(src, 'heroincut', 1)
Notifys(src,Lang.Heroin.fail, "error")
elseif cuth2 then
RemoveItem(src, 'heroincutstagetwo', 1)
Notifys(src,Lang.Heroin.fail, "error")
elseif cuth3 then
RemoveItem(src, 'heroincutstagethree', 1)
local heroin = {'heroincut', 'heroincutstagetwo', 'heroincutstagethree'}
for k, v in pairs (heroin) do
if hasItem(src, v, 1) then
RemoveItem(src, v, 1)
Notifys(src, Lang.Heroin.fail, "error")
return
end
end
end)
RegisterServerEvent('md-drugs:server:fillneedle', function(num)
local src = source
local Player = getPlayer(src)
if not checkLoc(source, 'fillneedle', num) then return end
if not Itemcheck(src, 'needle', 1) then return end
if Config.TierSystem then
local heroin = getRep(src, 'heroin')
local vh = Player.Functions.GetItemByName('heroinvial')
local vh2 = Player.Functions.GetItemByName('heroinvialstagetwo')
local vh3 = Player.Functions.GetItemByName('heroinvialstagethree')
if vh then
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier1') then return end
local vials = {
heroinvial = 'tier1',
heroinvialstagetwo = 'tier2',
heroinvialstagethree = 'tier3'
}
for k, v in pairs (vials) do
if hasItem(src, k, 1) then
if not GetRecipe(src, 'heroin', 'fillneedle', v) then return end
AddRep(src, 'heroin')
elseif vh2 then
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier2') then return end
AddRep(src, 'heroin')
elseif vh3 then
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier3') then return end
AddRep(src, 'heroin')
else
Notifys(src,Lang.Heroin.nofill, "error")
return
end
end
else
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier1') then return end
@@ -225,15 +209,15 @@ end)
RegisterServerEvent('md-drugs:server:failheroin', function()
local src = source
local Player = getPlayer(src)
Log(GetName(src) ..' Sucks And Burned Their Heroin', 'heroin')
if Config.TierSystem then
local vh = Player.Functions.GetItemByName('heroinvial')
local vh2 = Player.Functions.GetItemByName('heroinvialstagetwo')
local vh3 = Player.Functions.GetItemByName('heroinvialstagethree')
if vh then RemoveItem(src, 'heroinvialstagethree', 1 )
elseif vh2 then RemoveItem(src, 'heroinvialstagetwo', 1)
elseif vh3 then RemoveItem(src, 'heroinvial', 1)
local heroin = {'heroinvial', 'heroinvialstagetwo', 'heroinvialstagethree'}
for k, v in pairs (heroin) do
if hasItem(src, v, 1) then
RemoveItem(src, v, 1)
Notifys(src, Lang.Heroin.fail, "error")
return
end
end
else
RemoveItem(src, 'heroinvial', 1)
-1
View File
@@ -1,4 +1,3 @@
local QBCore = exports['qb-core']:GetCoreObject()
RegisterServerEvent('md-drugs:server:givelean', function()
local chance = math.random(1,100)
+5
View File
@@ -112,6 +112,10 @@ local Target = {
}
function checkLoc(source, event, num)
print('Checking Location')
print('Event: ' .. event)
print('Num: ' .. num)
local ped = source
local pos = GetPlayerPed(ped)
local coord = GetEntityCoords(pos)
@@ -123,6 +127,7 @@ function checkLoc(source, event, num)
end
local dist = #(coord - loc)
if dist < 2.5 then
print(GetName(source) .. ' Triggered the table ' .. event .. ' Within The Correct Distance')
Log(GetName(source) .. ' Triggered the table ' .. event .. ' Within The Correct Distance', 'locations')
return true
else
+20 -28
View File
@@ -1,4 +1,4 @@
local QBCore = exports['qb-core']:GetCoreObject()
local prices = {
tabcost = 100, -- price per piece of tab paper event does 10 at a time
lsdlabkitcost = 10000 -- price of the lsd lab kit
@@ -22,13 +22,12 @@ end)
CUI('lsdlabkit', function(source, item)
local src = source
local Player = getPlayer(src)
local placed, loc = lib.callback.await('md-drugs:client:setlsdlabkit', src)
if placed then
if RemoveItem(src, 'lsdlabkit', 1) then
table.insert(lsdTables, {
owner = GetName(src),
ownerid = Player.PlayerData.citizenid,
ownerid = getCid(src),
src = src,
loc = loc
})
@@ -37,10 +36,8 @@ CUI('lsdlabkit', function(source, item)
end)
local function hasLabKit(source)
local src = source
local Player = getPlayer(src)
for k, v in pairs (lsdTables) do
if v.ownerid == Player.PlayerData.citizenid then
if v.ownerid == getCid(source) then
return true
end
end
@@ -56,9 +53,8 @@ end)
RegisterServerEvent('md-drugs:server:getlabkitback', function()
local src = source
local Player = getPlayer(src)
for k, v in pairs (lsdTables) do
if v.ownerid == Player.PlayerData.citizenid then
if v.ownerid == getCid(source) then
table.remove(lsdTables, k)
AddItem(src, 'lsdlabkit', 1)
end
@@ -104,17 +100,19 @@ if not Itemcheck(src, 'lsd_one_vial', 1) then return end
end
else
local randomchance = math.random(1,100)
local items = {
{chance = 60, item = 'lsd_vial_two'},
{chance = 75, item = 'lsd_vial_three'},
{chance = 85, item = 'lsd_vial_four'},
{chance = 93, item = 'lsd_vial_five'},
{chance = 100, item = 'lsd_vial_six'}
}
if RemoveItem(src, 'lsd_one_vial', 1) then
if randomchance <= 60 then
AddItem(src,'lsd_vial_two', 1)
elseif randomchance >= 61 and randomchance <= 75 then
AddItem(src,'lsd_vial_three', 1)
elseif randomchance >= 76 and randomchance <= 85 then
AddItem(src,'lsd_vial_four', 1)
elseif randomchance >= 86 and randomchance <= 93 then
AddItem(src,'lsd_vial_five', 1)
else
AddItem(src,'lsd_vial_six', 1)
for k, v in ipairs(items) do
if randomchance <= v.chance then
AddItem(src, v.item, 1)
break
end
end
Log(GetName(src) .. ' Refined Acid!', 'lsd')
end
@@ -131,9 +129,8 @@ end)
RegisterServerEvent('md-drugs:server:gettabpaper', function(num)
local src = source
local Player = getPlayer(src)
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)
else
Notifys(Lang.lsd.broke, "error")
@@ -142,9 +139,8 @@ end)
RegisterServerEvent('md-drugs:server:getlabkit', function()
local src = source
local Player = getPlayer(src)
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)
else
Notifys(src, Lang.lsd.broke, "error")
@@ -169,9 +165,7 @@ RegisterServerEvent('md-drugs:server:maketabpaper', function()
sortTab(vialdata, 'vial')
for k, v in pairs (vialdata) do
if count >= 1 then break end
local check = Player.Functions.GetItemByName(v.vial)
if check and check.amount >= 1 then
if hasItem(src, v.vial, 1) then
items = v.vial
recieve = v.sheet
count = count + 1
@@ -197,7 +191,6 @@ local sheets = {
for k, v in pairs (sheets) do
CUI(v.item, function(source)
local src = source
local Player = getPlayer(src)
local math = math.random(1,10)
if RemoveItem(src, v.item, 1) then
AddItem(src, v.recieve, math)
@@ -208,9 +201,8 @@ end
AddEventHandler('playerDropped', function()
local src = source
local Player = getPlayer(src)
for k, v in pairs (lsdTables) do
if v.ownerid == Player.PlayerData.citizenid then
if v.ownerid == getCid(source) then
table.remove(lsdTables, k)
AddItem(src, 'lsdlabkit', 1)
end
-1
View File
@@ -1,4 +1,3 @@
local QBCore = exports['qb-core']:GetCoreObject()
local m = {
{ location = vector3(2598.73, 4207.89, 41.02), heading = 334.49, model = "prop_cactus_03"},
-1
View File
@@ -1,4 +1,3 @@
local QBCore = exports['qb-core']:GetCoreObject()
RegisterServerEvent('md-drugs:server:startcook', function()
local src = source
+3 -6
View File
@@ -1,4 +1,4 @@
QBCore = exports['qb-core']:GetCoreObject()
local prices = {
payfortruck = 500,
hotchance = 30,
@@ -6,8 +6,7 @@ local prices = {
}
lib.callback.register('md-drugs:server:payfortruck', function()
local src = source
local Player = getPlayer(src)
if Player.Functions.RemoveMoney('cash', prices.payfortruck) or Player.Functions.RemoveMoney('bank', prices.payfortruck) then
if removeMoney(src, 'cash', prices.payfortruck) or removeMoney(src, 'bank', prices.payfortruck) then
Log(GetName(src) .. ' Rented A Van For OxyRuns', 'oxy')
return true
else
@@ -19,7 +18,6 @@ end)
RegisterServerEvent('md-drugs:server:giveoxybox', function()
local src = source
local Player = getPlayer(src)
local chance = math.random(1,100)
local cash = 200
local itemchance = math.random(1,100)
@@ -30,7 +28,7 @@ RegisterServerEvent('md-drugs:server:giveoxybox', function()
local item = itemList[math.random(1, #itemList)]
if chance <= prices.hotchance then
Notifys(src, Lang.oxy.hot, "error")
Player.Functions.AddMoney("cash", cash * 0.5)
addMoney(src, "cash", cash * 0.5)
if itemchance <= prices.itemChance then
AddItem(src, item.item, item.amount)
end
@@ -42,6 +40,5 @@ RegisterServerEvent('md-drugs:server:giveoxybox', function()
AddItem(src, item.item, item.amount)
end
end
end)
+22 -23
View File
@@ -1,36 +1,37 @@
local QBCore = exports['qb-core']:GetCoreObject()
local function GetJob(source)
local src = source
local Player = getPlayer(src)
local function getAmbo(source)
if Config.Framework == 'qbcore' then
local Player = QBCore.Functions.GetPlayer(source)
if Player.PlayerData.job.type == 'ems' then
return true
else
Notifys(src, 'You Must Be EMS To Do This', 'error')
return false
end
elseif Config.Framework == 'esx' then
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
CUI('prescription_pad', function(source, item)
local src = source
local near = {}
if GetJob(src) then
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
if getAmbo(src) then
local near = getNear(src)
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)
if type(data) == 'table' then
local give = QBCore.Functions.GetPlayerByCitizenId(data.who)
local give = getPlayerByCid(data.who)
for i = 1, #options do
if data.what == options[i].value then
AddItem(give.PlayerData.source, data.what, 1)
AddItem(getSource(give), data.what, 1)
end
end
end
@@ -41,7 +42,6 @@ local pharmabottle = {'vicodinbottle', 'adderalbottle','morphinebottle','xanaxbo
for m, d in pairs (pharmabottle) do
CUI(d, function(source, item)
local src = source
local Player = getPlayer(src)
local check = lib.callback.await("md-drugs:client:unbottle", src)
if check then
local get = {
@@ -64,10 +64,9 @@ end
RegisterServerEvent('md-drugs:server:fillprescription', function()
local src = source
local Player = getPlayer(src)
local pres = {vicodin_prescription = 'vicodinbottle', adderal_prescription = 'adderalbottle', morphine_prescription = 'morphinebottle', xanax_prescription = 'xanaxbottle'}
for k, v in pairs (pres) do
if Player.Functions.GetItemByName(k) then
if hasItem(src, k, 1) then
RemoveItem(src, k, 1 )
AddItem(src,v, 1)
break
+2 -3
View File
@@ -1,4 +1,3 @@
local QBCore = exports['qb-core']:GetCoreObject()
local recipe = {
cocaine = {
@@ -141,8 +140,8 @@ function GetRecipe(source, type, method, tier)
local has = 0
local need = 0
for k, v in pairs (recipe[type][method][tier].take) do
local item = Player.Functions.GetItemByName(k)
if item and item.amount >= v then
local item = hasItem(src, k, v)
if item == true then
has = has + 1
else
Notifys(src, ' You Need ' .. v .. ' Of ' .. GetLabels(k) .. ' To Do This', 'error')
+3 -3
View File
@@ -1,4 +1,3 @@
local QBCore = exports['qb-core']:GetCoreObject()
local stores = {
travel = {
@@ -67,11 +66,12 @@ lib.callback.register('md-drugs:server:menu', function(source, data)
end)
RegisterServerEvent("md-drugs:server:purchaseGoods", function(amount, money, item, price,table,num)
local src = source local Player = getPlayer(src)
local src = source
local Player = getPlayer(src)
for i = 1, #table do
if table[i].name == item then
if not table[i].price == price then return end
if Player.Functions.RemoveMoney(tostring(money), tonumber(table[i].price) * tonumber(amount)) then
if removeMoney(src, tostring(money), tonumber(table[i].price) * tonumber(amount)) then
AddItem(src, item, amount)
Log(GetName(src) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant')
end
-1
View File
@@ -1,4 +1,3 @@
local QBCore = exports['qb-core']:GetCoreObject()
local s = {
{ location = vector3(2185.14, 5183.81, 57.48), heading = 334.49, model = "mushroom"},
+2 -13
View File
@@ -1,5 +1,4 @@
local QBCore = exports['qb-core']:GetCoreObject()
local weedPlant = {
{ location = vector3(1049.63, -3202.12, -36.75), heading = 334.49, model = "prop_weed_01"},
{ location = vector3(1050.85, -3202.15, -36.75), heading = 329.56, model = "prop_weed_01"},
@@ -68,7 +67,6 @@ end)
RegisterServerEvent('md-drugs:server:dryoutweed', function()
local src = source
local Player = getPlayer(src)
if RemoveItem(src,"wetcannabis", 1) then
AddItem(src,"drycannabis", 1)
Log(GetName(source) .. ' Dried Weed', 'weed')
@@ -91,24 +89,18 @@ end
RegisterServerEvent('md-drugs:server:MakeWeedItems', function(data)
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
end)
RegisterServerEvent('md-drugs:server:makeoil', function(data)
local src = source
local Player = getPlayer(src)
if not Player then return end
if not GetRecipe(src, 'weed', 'oil', 'shatter') then return end
end)
CUI("dabrig", function(source, item)
local src = source
local Player = getPlayer(src)
if Player.Functions.GetItemByName("butanetorch") then
if hasItem(src,"butanetorch",1) then
if RemoveItem(src, "shatter", 1) then
TriggerClientEvent("md-drugs:client:dodabs", src)
end
@@ -119,9 +111,7 @@ end)
CUI("weedgrinder", function(source, item)
local src = source
local Player = getPlayer(src)
local has = Player.Functions.GetItemByName("drycannabis")
if not has then Notifys(src, 'You Need Dried Cannabis', 'error') return end
if not hasItem(src, 'drycannabis',1) then Notifys(src, 'You Need Dried Cannabis', 'error') return end
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Grinding Weed')
if not check then return end
if RemoveItem(src, "drycannabis",1 ) then
@@ -131,7 +121,6 @@ end)
CUI("mdwoods", function(source, item)
local src = source
local Player = getPlayer(src)
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Breaking Blunt Open')
if not check then return end
if RemoveItem(src, "mdwoods",1 ) then
+5 -6
View File
@@ -18,10 +18,9 @@ local Price = {
for k, v in pairs (burners) do
CUI(k, function(source, item)
local src = source
local Player = getPlayer(src)
if getCops() < Config.PoliceCount then return Notifys(src, Lang.Wholesale.na, 'error') end
for m, d in pairs (active) do
if d.cid == Player.PlayerData.citizenid then
if d.cid == getCid(source) then
return Notifys(src, Lang.Wholesale.al, 'error' )
end
end
@@ -36,12 +35,12 @@ for k, v in pairs (burners) do
src = src,
item = k,
location = getRandW(src),
cid = Player.PlayerData.citizenid,
cid = getCid(source),
type = v,
price = Price[tab]
})
for m, d in pairs (active) do
if d.cid == Player.PlayerData.citizenid then
if d.cid == getCid(source) then
TriggerClientEvent("md-drugs:client:GetLocation", src, active[m])
end
end
@@ -53,13 +52,13 @@ RegisterNetEvent('md-drugs:server:SuccessSale', function(data)
local src = source
local Player = getPlayer(src)
for k, v in pairs (active) do
if v.cid == Player.PlayerData.citizenid then
if v.cid == getCid(source) then
local payout = math.random(v.price.min, v.price.max)
for m, d in pairs (v.type) do
local git = Player.Functions.GetItemByName(d)
if git and git.amount >= 1 then
RemoveItem(src, d, git.amount)
Player.Functions.AddMoney('cash', git.amount * payout)
addMoney(src, 'cash', git.amount * payout)
end
table.remove(active, k)
end
+79 -121
View File
@@ -1,17 +1,15 @@
local QBCore = exports['qb-core']:GetCoreObject()
-------------------- stealing ingridients
local activePresses = {}
RegisterServerEvent('md-drugs:server:stealisosafrole', function(num)
local src = source
if not checkLoc(src, 'isosafrole',num) then return end
if AddItem(src, "isosafrole", 1) then
end
end)
RegisterServerEvent('md-drugs:server:stealmdp2p', function(num)
local src = source
local Player = getPlayer(src)
if not checkLoc(src, 'mdp2p',num) then return end
if AddItem(src,"mdp2p", 1) then
end
@@ -34,7 +32,7 @@ local check, loc = lib.callback.await('md-drugs:client:setpress', src, v.data)
press = v.data,
get = v.item,
owner = GetName(src),
ownerid = Player.PlayerData.citizenid,
ownerid = getCid(source),
src = src,
loc = loc
})
@@ -47,7 +45,7 @@ RegisterServerEvent('md-drugs:server:getpressback', function(type)
local src = source
local Player = getPlayer(src)
for k, v in pairs (activePresses) do
if v.ownerid == Player.PlayerData.citizenid then
if v.ownerid == getCid(source) then
if v.press == type then
table.remove(activePresses, k)
AddItem(src, v.get, 1)
@@ -62,7 +60,7 @@ local function pressout(source)
local ped = GetPlayerPed(src)
local coords = GetEntityCoords(ped)
for k, v in pairs (activePresses) do
if v.ownerid == Player.PlayerData.citizenid then
if v.ownerid == getCid(source) then
if #(coords - v.loc) < 3.0 then
return v.press
end
@@ -73,50 +71,25 @@ end
RegisterServerEvent('md-drugs:server:makextc', function(data)
local src = source
local Player = getPlayer(src)
if not Itemcheck(src, 'raw_xtc', 1) then return end
if pressout(src) == 'none' then return end
if pressout(src) == 'single' then
if data.color == 'white' then
if not GetRecipe(src, 'xtc', 'singlestack', 'white') then return end
elseif data.color == 'red' then
if not GetRecipe(src, 'xtc', 'singlestack', 'red') then return end
elseif data.color == 'orange' then
if not GetRecipe(src, 'xtc', 'singlestack', 'orange') then return end
elseif data.color == 'blue' then
if not GetRecipe(src, 'xtc', 'singlestack', 'blue') then return end
end
elseif pressout(src) == 'dual' then
if data.color == 'white' then
if not GetRecipe(src, 'xtc', 'dualstack', 'white') then return end
elseif data.color == 'red' then
if not GetRecipe(src, 'xtc', 'dualstack', 'red') then return end
elseif data.color == 'orange' then
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
local pressType = pressout(src)
if pressType == 'none' then return end
local validColors = {'white', 'red', 'orange', 'blue'}
local isValidColor = false
for _, color in ipairs(validColors) do
if data.color == color then
isValidColor = true
break
end
end
if not isValidColor then return end
local stackType = pressType .. 'stack'
if not GetRecipe(src, 'xtc', stackType, data.color) then return end
end)
RegisterServerEvent('md-drugs:server:buypress', function()
@@ -133,117 +106,102 @@ RegisterServerEvent('md-drugs:server:buypress', function()
RegisterServerEvent('md-drugs:server:upgradepress', function(data)
local src = source
if data == 'dual' then
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
if not GetRecipe(src, 'xtc', 'press', data) then return end
end)
------------- making powder
RegisterServerEvent('md-drugs:server:makingrawxtc', function(num)
local src = source
local Player = getPlayer(src)
if not checkLoc(src, 'rawxtcloc',num) then return end
if not GetRecipe(src, 'xtc', 'raw', 'raw_xtc') then return end
end)
RegisterServerEvent('md-drugs:server:stampwhite', function(num)
local src = source
local one = {'white_playboys', 'white_aliens', 'white_pl', 'white_trolls', 'white_cats'}
local chance = math.random(#one)
local two = {'white_playboys2', 'white_aliens2', 'white_pl2', 'white_trolls2', 'white_cats2'}
local three = {'white_playboys3', 'white_aliens3', 'white_pl3', 'white_trolls3', 'white_cats3'}
local four = {'white_playboys4', 'white_aliens4', 'white_pl4', 'white_trolls4', 'white_cats4'}
if not checkLoc(src, 'stamp', num) then return end
local whitePills = {
{item = 'white_xtc', stamped = {'white_playboys', 'white_aliens', 'white_pl', 'white_trolls', 'white_cats'}},
{item = 'white_xtc2', stamped = {'white_playboys2', 'white_aliens2', 'white_pl2', 'white_trolls2', 'white_cats2'}},
{item = 'white_xtc3', stamped = {'white_playboys3', 'white_aliens3', 'white_pl3', 'white_trolls3', 'white_cats3'}},
{item = 'white_xtc4', stamped = {'white_playboys4', 'white_aliens4', 'white_pl4', 'white_trolls4', 'white_cats4'}}
}
local chance = math.random(1, 5)
if RemoveItem(src, "white_xtc", 1) then
AddItem(src, one[chance], 1)
elseif RemoveItem(src, "white_xtc2", 1) then
AddItem(src, two[chance], 1)
elseif RemoveItem(src, "white_xtc3", 1) then
AddItem(src, three[chance], 1)
elseif RemoveItem(src, "white_xtc4", 1) then
AddItem(src, four[chance], 1)
else
Notifys('You Dont Have Unstamped White Pills', 'error')
if not checkLoc(src, 'stamp', num) then return end
for k, v in ipairs(whitePills) do
if RemoveItem(src, v.item, 1) then
AddItem(src, v.stamped[chance], 1)
return
end
end
Notifys('You Dont Have Unstamped White Pills', 'error')
end)
RegisterServerEvent('md-drugs:server:stampred', function(num)
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
local redPills = {
{item = 'red_xtc', stamped = {'red_playboys', 'red_aliens', 'red_pl', 'red_trolls', 'red_cats'}},
{item = 'red_xtc2', stamped = {'red_playboys2', 'red_aliens2', 'red_pl2', 'red_trolls2', 'red_cats2'}},
{item = 'red_xtc3', stamped = {'red_playboys3', 'red_aliens3', 'red_pl3', 'red_trolls3', 'red_cats3'}},
{item = 'red_xtc4', stamped = {'red_playboys4', 'red_aliens4', 'red_pl4', 'red_trolls4', 'red_cats4'}}
}
local chance = math.random(1, 5)
if RemoveItem(src, "red_xtc", 1) then
AddItem(src, one[chance], 1)
elseif RemoveItem(src, "red_xtc2", 1) then
AddItem(src, two[chance], 1)
elseif RemoveItem(src, "red_xtc3", 1) then
AddItem(src, three[chance], 1)
elseif RemoveItem(src, "red_xtc4", 1) then
AddItem(src, four[chance], 1)
else
Notifys('You Dont Have Unstamped red Pills', 'error')
if not checkLoc(src, 'stamp', num) then return end
for k, v in ipairs(redPills) do
if RemoveItem(src, v.item, 1) then
AddItem(src, v.stamped[chance], 1)
return
end
end
Notifys('You Dont Have Unstamped Red Pills', 'error')
end)
RegisterServerEvent('md-drugs:server:stamporange', function(num)
local src = source
local one = {'orange_playboys', 'orange_aliens', 'orange_pl', 'orange_trolls', 'orange_cats'}
local two = {'orange_playboys2', 'orange_aliens2', 'orange_pl2', 'orange_trolls2', 'orange_cats2'}
local three = {'orange_playboys3', 'orange_aliens3', 'orange_pl3', 'orange_trolls3', 'orange_cats3'}
local four = {'orange_playboys4', 'orange_aliens4', 'orange_pl4', 'orange_trolls4', 'orange_cats4'}
local chance = math.random(#one)
if not checkLoc(src, 'stamp', num) then return end
local orangePills = {
{item = 'orange_xtc', stamped = {'orange_playboys', 'orange_aliens', 'orange_pl', 'orange_trolls', 'orange_cats'}},
{item = 'orange_xtc2', stamped = {'orange_playboys2', 'orange_aliens2', 'orange_pl2', 'orange_trolls2', 'orange_cats2'}},
{item = 'orange_xtc3', stamped = {'orange_playboys3', 'orange_aliens3', 'orange_pl3', 'orange_trolls3', 'orange_cats3'}},
{item = 'orange_xtc4', stamped = {'orange_playboys4', 'orange_aliens4', 'orange_pl4', 'orange_trolls4', 'orange_cats4'}}
}
local chance = math.random(1, 5)
if RemoveItem(src, "orange_xtc", 1) then
AddItem(src, one[chance], 1)
elseif RemoveItem(src, "orange_xtc2", 1) then
AddItem(src, two[chance], 1)
elseif RemoveItem(src, "orange_xtc3", 1) then
AddItem(src, three[chance], 1)
elseif RemoveItem(src, "orange_xtc4", 1) then
AddItem(src, four[chance], 1)
else
Notifys('You Dont Have Unstamped orange Pills', 'error')
if not checkLoc(src, 'stamp', num) then return end
for k, v in ipairs(orangePills) do
if RemoveItem(src, v.item, 1) then
AddItem(src, v.stamped[chance], 1)
return
end
end
Notifys('You Dont Have Unstamped Orange Pills', 'error')
end)
RegisterServerEvent('md-drugs:server:stampblue', function(num)
local src = source
local one = {'blue_playboys', 'blue_aliens', 'blue_pl', 'blue_trolls', 'blue_cats'}
local chance = math.random(#one)
local two = {'blue_playboys2', 'blue_aliens2', 'blue_pl2', 'blue_trolls2', 'blue_cats2'}
local three = {'blue_playboys3', 'blue_aliens3', 'blue_pl3', 'blue_trolls3', 'blue_cats3'}
local four = {'blue_playboys4', 'blue_aliens4', 'blue_pl4', 'blue_trolls4', 'blue_cats4'}
local bluePills = {
{item = 'blue_xtc', stamped = {'blue_playboys', 'blue_aliens', 'blue_pl', 'blue_trolls', 'blue_cats'}},
{item = 'blue_xtc2', stamped = {'blue_playboys2', 'blue_aliens2', 'blue_pl2', 'blue_trolls2', 'blue_cats2'}},
{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 RemoveItem(src, "blue_xtc", 1) then
AddItem(src, one[chance], 1)
elseif RemoveItem(src, "blue_xtc2", 1) then
AddItem(src, two[chance], 1)
elseif RemoveItem(src, "blue_xtc3", 1) then
AddItem(src, three[chance], 1)
elseif RemoveItem(src, "blue_xtc4", 1) then
AddItem(src, four[chance], 1)
else
Notifys('You Dont Have Unstamped blue Pills', 'error')
for k, v in ipairs(bluePills) do
if RemoveItem(src, v.item, 1) then
AddItem(src, v.stamped[chance], 1)
return
end
end
Notifys('You Dont Have Unstamped Blue Pills', 'error')
end)
AddEventHandler('playerDropped', function()
local src = source
local Player = getPlayer(src)
for k, v in pairs (activePresses) do
if v.ownerid == Player.PlayerData.citizenid then
if v.ownerid == getCid(source) then
table.remove(activePresses, k)
AddItem(src, v.get, 1)
end
+8
View File
@@ -50,3 +50,11 @@ Config.minigametype = 'ox' -- look above for options or choose none if you dont
-------- Woah Where did like all the locations go?
--- 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