update fix most of the script
This commit is contained in:
1 parent
36131995d4
commit
f06778c345
12 files changed
+287
-303
No files matched your search
+20
-2
@@ -64,8 +64,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)
|
||||||
@@ -655,6 +655,24 @@ 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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
LoadModel('prop_plant_01b')
|
LoadModel('prop_plant_01b')
|
||||||
LoadModel('prop_plant_01a')
|
LoadModel('prop_plant_01a')
|
||||||
|
|||||||
+1
-1
@@ -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
@@ -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)
|
||||||
|
|
||||||
@@ -201,8 +201,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)
|
||||||
+47
-2
@@ -74,6 +74,16 @@ function getPlayer(source)
|
|||||||
end
|
end
|
||||||
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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function GetName(source)
|
function GetName(source)
|
||||||
local src = source
|
local src = source
|
||||||
if Config.Framework == 'qb' then
|
if Config.Framework == 'qb' then
|
||||||
@@ -279,10 +289,16 @@ function removeMoney(source, type, amount)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
elseif Config.Framework == 'esx' then
|
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)
|
local Player = getPlayer(source)
|
||||||
Player.removeMoney(amount)
|
if Player.getMoney() >= amount then
|
||||||
print(Player.removeMoney(amount))
|
Player.removeMoney(amount)
|
||||||
return true
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function handleFresh(source)
|
local function handleFresh(source)
|
||||||
@@ -393,6 +409,35 @@ function getCops()
|
|||||||
return amount
|
return amount
|
||||||
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
|
||||||
|
end
|
||||||
|
end
|
||||||
function handleCornersell(source, item, amount, price)
|
function handleCornersell(source, item, amount, price)
|
||||||
if RemoveItem(source, item, amount) then
|
if RemoveItem(source, item, amount) then
|
||||||
if inventory == 'qb' then
|
if inventory == 'qb' then
|
||||||
|
|||||||
+52
-68
@@ -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')
|
||||||
@@ -126,7 +124,6 @@ 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 == getCid(source) then
|
if v.ownerid == getCid(source) then
|
||||||
@@ -139,7 +136,6 @@ 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
|
||||||
@@ -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)
|
||||||
|
|||||||
+20
-28
@@ -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 = getCid(source),
|
ownerid = getCid(src),
|
||||||
src = src,
|
src = src,
|
||||||
loc = loc
|
loc = loc
|
||||||
})
|
})
|
||||||
@@ -37,8 +36,6 @@ 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 == getCid(source) then
|
if v.ownerid == getCid(source) then
|
||||||
return true
|
return true
|
||||||
@@ -56,7 +53,6 @@ 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 == getCid(source) then
|
if v.ownerid == getCid(source) then
|
||||||
table.remove(lsdTables, k)
|
table.remove(lsdTables, k)
|
||||||
@@ -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,7 +201,6 @@ 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 == getCid(source) then
|
if v.ownerid == getCid(source) then
|
||||||
table.remove(lsdTables, k)
|
table.remove(lsdTables, k)
|
||||||
|
|||||||
+3
-6
@@ -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
-43
@@ -1,35 +1,37 @@
|
|||||||
|
|
||||||
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
|
||||||
@@ -38,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
|
||||||
|
|||||||
+2
-12
@@ -67,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')
|
||||||
@@ -90,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
|
||||||
@@ -118,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
|
||||||
@@ -130,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
|
||||||
|
|||||||
@@ -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 == GetCid(source) 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 = GetCid(source),
|
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 == GetCid(source) 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 == GetCid(source) 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
|
||||||
|
|||||||
+90
-132
@@ -4,16 +4,14 @@ 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 = GetCid(source),
|
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 == GetCid(source) 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 == GetCid(source) 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 == GetCid(source) 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
|
||||||
|
|||||||
Reference in new issue
Block a user