made server table for presses, will do same for lab kits
This commit is contained in:
Mustache Dom committed 2024-11-22 01:35:25 -08:00
1 parent 6df0983273
commit c2fddd6144
11 files changed
+85 -173

No files matched your search

+24
View File
@@ -23,6 +23,30 @@ RegisterNetEvent("md-drugs:client:setpress", function(type)
end end
end) end)
lib.callback.register('md-drugs:client:setpress', function(type)
if xtcpress then
Notify(Lang.xtc.out, 'error')
return false
else
local coords, head = StartRay2()
xtcpress = true
progressbar('Setting Press On The Ground', 4000, 'uncuff')
local press = CreateObject("bkr_prop_coke_press_01aa", coords.x, coords.y, coords.z, true, false, false)
PlaceObjectOnGroundProperly(press)
Freeze(press, true, head)
local options = {
{ icon = "fas fa-eye", label = Lang.targets.xtc.make, distance = 2.0, action = function() TriggerEvent("md-drugs:client:XTCMenu", type) end,
canInteract = function() if xtcpress then return true end end
},
{icon = "fas fa-eye", label = Lang.targets.xtc.pick, action = function() TriggerEvent("md-drugs:client:GetPressBack", type, press) end, distance = 2.0,
canInteract = function() if xtcpress then return true end end
},
}
AddMultiModel(press, options, nil)
return true, GetEntityCoords(press)
end
end)
RegisterNetEvent("md-drugs:client:XTCMenu", function(type) RegisterNetEvent("md-drugs:client:XTCMenu", function(type)
local event = "md-drugs:client:MakeXTC" local event = "md-drugs:client:MakeXTC"
lib.registerContext({ lib.registerContext({
-4
View File
@@ -45,7 +45,6 @@ AddEventHandler("coke:pickupCane", function(loc)
TriggerClientEvent("coke:removeCane", -1, loc) TriggerClientEvent("coke:removeCane", -1, loc)
CaneCooldown(loc) CaneCooldown(loc)
AddItem(src, 'coca_leaf', 1) AddItem(src, 'coca_leaf', 1)
--Log(GetName(src) .. ' Picked A Coca Leaf With a distance of ' .. dist(src, Config.CocaPlant[loc].location) .. ' vectors', 'coke')
end end
end) end)
@@ -65,7 +64,6 @@ RegisterServerEvent('md-drugs:server:makepowder', function(num)
end end
end end
if not GetRecipe(src, 'cocaine', 'cokepowder', tier) then return end if not GetRecipe(src, 'cocaine', 'cokepowder', tier) then return end
Log(GetName(src) .. logMessage .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
end) end)
RegisterServerEvent('md-drugs:server:cutcokeone', function(num) RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
@@ -94,7 +92,6 @@ RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
if not GetRecipe(src, 'cocaine', 'cutcoke', tier) then return end if not GetRecipe(src, 'cocaine', 'cutcoke', tier) then return end
else else
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end
Log(GetName(src) .. ' Cut Coke', 'coke')
end end
end) end)
@@ -126,7 +123,6 @@ RegisterServerEvent('md-drugs:server:bagcoke', function(num)
AddRep(src, 'coke') AddRep(src, 'coke')
else else
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end
Log(GetName(src) .. ' Bagged Coke', 'coke')
end end
end) end)
-2
View File
@@ -16,7 +16,6 @@ RegisterServerEvent('md-drugs:server:makecrackone', function(num)
if Player.Functions.GetItemByName(v.item) then if Player.Functions.GetItemByName(v.item) then
tier = v.tier tier = v.tier
count = count + 1 count = count + 1
Log(GetName(src) .. v.log, 'crack')
end end
end end
end end
@@ -40,7 +39,6 @@ RegisterServerEvent('md-drugs:server:bagcrack', function(num)
if Player.Functions.GetItemByName(v.item) then if Player.Functions.GetItemByName(v.item) then
tier = v.tier tier = v.tier
count = count + 1 count = count + 1
Log(GetName(src) .. v.log, 'crack')
end end
end end
end end
+1 -8
View File
@@ -80,9 +80,6 @@ lib.addCommand("newdealer", {
if not Player then return end if not Player then return end
local dealerName = args.name local dealerName = args.name
local minTime = args.min
local maxTime = args.max
local time = json.encode({min = minTime, max = maxTime})
local pos = json.encode({x = coords.x, y = coords.y, z = coords.z}) local pos = json.encode({x = coords.x, y = coords.y, z = coords.z})
local result = MySQL.scalar.await('SELECT name FROM dealers WHERE name = ?', { dealerName }) local result = MySQL.scalar.await('SELECT name FROM dealers WHERE name = ?', { dealerName })
@@ -91,7 +88,7 @@ lib.addCommand("newdealer", {
end end
MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', { MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', {
dealerName, pos, time, Player.PlayerData.citizenid dealerName, pos, 'nil', Player.PlayerData.citizenid
}, function() }, function()
QBConfig.Dealers[dealerName] = { QBConfig.Dealers[dealerName] = {
name = dealerName, name = dealerName,
@@ -101,10 +98,6 @@ lib.addCommand("newdealer", {
z = coords.z, z = coords.z,
h = GetEntityHeading(ped) h = GetEntityHeading(ped)
}, },
time = {
min = minTime,
max = maxTime
},
} }
TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers) TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers)
end) end)
-32
View File
@@ -318,38 +318,6 @@ function sortTab(tbl, type)
end) end)
end end
function ChecknRemove(source, table)
local Player = getPlayer(source)
local hass = 0
local need = 0
for k, v in pairs (table) do
need = need + 1
if inventory == 'qb' then
local itemchecks = Player.Functions.GetItemByName(k)
if itemchecks and itemchecks.amount >= v then
hass = hass + 1
else
Notifys(source, 'You Need ' .. v .. ' Of ' .. GetLabels(k) .. ' To Do this', 'error')
end
elseif inventory == 'ox' then
local items = exports.ox_inventory:GetItem(source, k, nil, false)
if items.count >= v then
hass = hass + 1
else
Notifys(source, 'You Need ' .. v .. ' Of ' .. GetLabels(k) .. ' To Do This', 'error')
end
end
end
if hass == need then
for k, v in pairs (table) do
RemoveItem(source, k, v)
end
return true
else
return false
end
end
lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args) lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args)
local amount = 0 local amount = 0
local players = QBCore.Functions.GetQBPlayers() local players = QBCore.Functions.GetQBPlayers()
-20
View File
@@ -54,7 +54,6 @@ RegisterServerEvent("heroin:pickupCane", function(loc)
TriggerClientEvent("heroin:removeCane", -1, loc) TriggerClientEvent("heroin:removeCane", -1, loc)
heroinCooldown(loc) heroinCooldown(loc)
AddItem(source, 'poppyresin', 1) AddItem(source, 'poppyresin', 1)
Log(GetName(source) .. ' Picked A Poppies With a distance of ' .. dist(source, h[loc].location) .. ' vectors', 'heroin')
end end
end) end)
@@ -66,17 +65,13 @@ RegisterServerEvent('md-drugs:server:dryplant', function(num)
local heroin = getRep(src, 'heroin') local heroin = getRep(src, 'heroin')
if heroin <= Config.Tier1 then if heroin <= Config.Tier1 then
if not GetRecipe(src, 'heroin', 'dryheroin', 'tier1') then return end if not GetRecipe(src, 'heroin', 'dryheroin', 'tier1') then return end
Log(GetName(src) ..' Made Heroin Powder', 'heroin')
elseif heroin >= Config.Tier1 and heroin <= Config.Tier2 then elseif heroin >= Config.Tier1 and heroin <= Config.Tier2 then
if not GetRecipe(src, 'heroin', 'dryheroin', 'tier2') then return end if not GetRecipe(src, 'heroin', 'dryheroin', 'tier2') then return end
Log(GetName(src) ..' Made Heroin Powder Tier 2', 'heroin')
else else
if not GetRecipe(src, 'heroin', 'dryheroin', 'tier3') then return end if not GetRecipe(src, 'heroin', 'dryheroin', 'tier3') then return end
Log(GetName(src) ..' Made Heroin Powder Tier 3', 'heroin')
end end
else else
if not GetRecipe(src, 'heroin', 'dryheroin', 'tier1') then return end if not GetRecipe(src, 'heroin', 'dryheroin', 'tier1') then return end
Log(GetName(src) ..' Made Heroin Powder With a distance of', 'heroin')
end end
end) end)
@@ -92,19 +87,15 @@ RegisterServerEvent('md-drugs:server:cutheroin', function(num)
local rawh3 = Player.Functions.GetItemByName('heroinstagethree') local rawh3 = Player.Functions.GetItemByName('heroinstagethree')
if rawh then if rawh then
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end
Log(GetName(src) ..' Cut Heroin With a distance of', 'heroin')
elseif rawh2 then elseif rawh2 then
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier2') then return end if not GetRecipe(src, 'heroin', 'cutheroin', 'tier2') then return end
Log(GetName(src) ..' Cut Heroin Tier 2 With a distance of', 'heroin')
elseif rawh3 then elseif rawh3 then
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier3') then return end if not GetRecipe(src, 'heroin', 'cutheroin', 'tier3') then return end
Log(GetName(src) .. ' Cut Heroin Tier 3 With a distance of', 'heroin')
else else
Notifys(src, Lang.Heroin.noheroin, "error") Notifys(src, Lang.Heroin.noheroin, "error")
end end
else else
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end
Log(GetName(src) ..' Cut Heroin With a distance of', 'heroin')
end end
end) end)
@@ -114,7 +105,6 @@ RegisterServerEvent('md-drugs:server:getheroinlabkit', function()
if not checkLoc(source, 'singleSpot', 'buyheroinlabkit') then return end if not checkLoc(source, 'singleSpot', 'buyheroinlabkit') then return end
if Player.Functions.RemoveMoney('cash', prices.heroinlabkitprice) then if Player.Functions.RemoveMoney('cash', prices.heroinlabkitprice) then
AddItem(src, 'heroinlabkit', 1) AddItem(src, 'heroinlabkit', 1)
Log(GetName(src) ..' Bought A Heroin lab Kit', 'heroin')
else else
Notifys(src, 'You Need '.. prices.heroinlabkitprice .. ' In Cash For This', 'error') Notifys(src, 'You Need '.. prices.heroinlabkitprice .. ' In Cash For This', 'error')
end end
@@ -124,7 +114,6 @@ RegisterServerEvent('md-drugs:server:getheroinlabkitback', function()
local src = source local src = source
local Player = getPlayer(src) local Player = getPlayer(src)
if AddItem(src, "heroinlabkit", 1) then if AddItem(src, "heroinlabkit", 1) then
Log(GetName(src) ..' Picked Up Their Heroin Lab Kit Back At ' .. GetCoords(src) .. '!', 'heroin')
end end
end) end)
@@ -150,19 +139,15 @@ local Player = getPlayer(src)
local cuth3 = Player.Functions.GetItemByName('heroincutstagethree') local cuth3 = Player.Functions.GetItemByName('heroincutstagethree')
if cuth then if cuth then
if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end
Log(GetName(src) ..' Made A Vial Of Heroin', 'heroin')
elseif cuth2 then elseif cuth2 then
if not GetRecipe(src, 'heroin', 'fillvial', 'tier2') then return end if not GetRecipe(src, 'heroin', 'fillvial', 'tier2') then return end
Log(GetName(src) ..' Made A Vial Of Heroin Tier 2', 'heroin')
elseif cuth3 then elseif cuth3 then
if not GetRecipe(src, 'heroin', 'fillvial', 'tier3') then return end if not GetRecipe(src, 'heroin', 'fillvial', 'tier3') then return end
Log(GetName(src) ..' Made A Vial Of Heroin Tier 3', 'heroin')
else else
Notifys(src, 'no cut heroin', "error") Notifys(src, 'no cut heroin', "error")
end end
else else
if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end
Log(GetName(src) ..' Made A Vial Of Heroin', 'heroin')
end end
end) end)
@@ -172,7 +157,6 @@ local Player = getPlayer(src)
local cuth = Player.Functions.GetItemByName('heroincut') local cuth = Player.Functions.GetItemByName('heroincut')
local cuth2 = Player.Functions.GetItemByName('heroincutstagetwo') local cuth2 = Player.Functions.GetItemByName('heroincutstagetwo')
local cuth3 = Player.Functions.GetItemByName('heroincutstagethree') local cuth3 = Player.Functions.GetItemByName('heroincutstagethree')
Log(GetName(src) ..' Sucks And Burned Their Heroin', 'heroin')
if cuth then if cuth then
RemoveItem(src, 'heroincut', 1) RemoveItem(src, 'heroincut', 1)
Notifys(src,Lang.Heroin.fail, "error") Notifys(src,Lang.Heroin.fail, "error")
@@ -199,21 +183,17 @@ RegisterServerEvent('md-drugs:server:fillneedle', function(num)
if vh then if vh then
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier1') then return end if not GetRecipe(src, 'heroin', 'fillneedle', 'tier1') then return end
AddRep(src, 'heroin') AddRep(src, 'heroin')
Log(GetName(src) ..' Filled A Needle Of Heroin And Now Has A Rep Of ' .. heroin + 1 .. '!' , 'heroin')
elseif vh2 then elseif vh2 then
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier2') then return end if not GetRecipe(src, 'heroin', 'fillneedle', 'tier2') then return end
AddRep(src, 'heroin') AddRep(src, 'heroin')
Log(GetName(src) ..' Filled A Needle Of Heroin Tier 2 And Now Has A Rep Of ' .. heroin + 1 .. '!' , 'heroin')
elseif vh3 then elseif vh3 then
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier3') then return end if not GetRecipe(src, 'heroin', 'fillneedle', 'tier3') then return end
AddRep(src, 'heroin') AddRep(src, 'heroin')
Log(GetName(src) ..' Filled A Needle Of Heroin Tier 3 And Now Has A Rep Of ' .. heroin + 1 .. '!' , 'heroin')
else else
Notifys(src,Lang.Heroin.nofill, "error") 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
Log(GetName(src) ..' Filled A Needle Of Heroin!' , 'heroin')
end end
end) end)
+2
View File
@@ -123,8 +123,10 @@ function checkLoc(source, event, num)
end end
local dist = #(coord - loc) local dist = #(coord - loc)
if dist < 2.5 then if dist < 2.5 then
Log(GetName(source) .. ' Triggered the table ' .. event .. ' Within The Correct Distance', 'locations')
return true return true
else else
Log(GetName(source) .. ' Triggered the table ' .. event .. ' Not Within The Correct Distance', 'locations')
Notifys(source, 'You are not in the correct location', 'error') Notifys(source, 'You are not in the correct location', 'error')
return false return false
end end
+2 -8
View File
@@ -7,7 +7,6 @@ RegisterServerEvent('md-drugs:server:getlysergic', function(num)
local src = source local src = source
if not checkLoc(src, 'lysergicacid', num) then return end if not checkLoc(src, 'lysergicacid', num) then return end
if AddItem(src,'lysergic_acid', 2) then if AddItem(src,'lysergic_acid', 2) then
Log(GetName(src) ..' Got Lysergic acid!', 'lsd')
end end
end) end)
@@ -15,7 +14,6 @@ RegisterServerEvent('md-drugs:server:getdiethylamide', function(num)
local src = source local src = source
if not checkLoc(src, 'diethylamide', num) then return end if not checkLoc(src, 'diethylamide', num) then return end
if AddItem(src,'diethylamide', 2) then if AddItem(src,'diethylamide', 2) then
Log(GetName(src) ..' Got diethylamide!', 'lsd')
end end
end) end)
@@ -24,7 +22,6 @@ QBCore.Functions.CreateUseableItem('lsdlabkit', function(source, item)
local src = source local src = source
if TriggerClientEvent("md-drugs:client:setlsdlabkit", src) then if TriggerClientEvent("md-drugs:client:setlsdlabkit", src) then
RemoveItem(src, "lsdlabkit", 1) RemoveItem(src, "lsdlabkit", 1)
Log(GetName(src) ..' Placed Their LSD Lab Kit Back At ' .. GetCoords(src) .. '!', 'lsd')
end end
end) end)
@@ -33,7 +30,6 @@ lib.callback.register('md-drugs:server:removecleaningkit', function(source)
local src = source local src = source
if not Itemcheck(src, 'cleaningkit', 1) then return end if not Itemcheck(src, 'cleaningkit', 1) then return end
if RemoveItem(src,"cleaningkit", 1) then if RemoveItem(src,"cleaningkit", 1) then
Log(GetName(src) ..' Wiped Down Their LSD Lab Kit!' , 'lsd')
return true return true
end end
end) end)
@@ -48,12 +44,12 @@ end)
RegisterServerEvent('md-drugs:server:heatliquid', function() RegisterServerEvent('md-drugs:server:heatliquid', function()
local src = source local src = source
if not GetRecipe(src, 'lsd', 'vial', 'heat') then return end if not GetRecipe(src, 'lsd', 'vial', 'heat') then return end
Log(GetName(src) ..' Heated Basic LSD!', 'lsd')
end) end)
RegisterServerEvent('md-drugs:server:failheating', function() RegisterServerEvent('md-drugs:server:failheating', function()
local src = source local src = source
if not ChecknRemove(source, {lysergic_acid = 1, diethylamide = 1}) then return end RemoveItem(src, 'lysergic_acid', 1)
RemoveItem(src, 'diethylamide', 1)
Notifys(src,Lang.lsd.failed, "error") Notifys(src,Lang.lsd.failed, "error")
Log(GetName(src) ..' Failed Basic LSD Like An Idiot!', 'lsd') Log(GetName(src) ..' Failed Basic LSD Like An Idiot!', 'lsd')
end) end)
@@ -111,7 +107,6 @@ RegisterServerEvent('md-drugs:server:gettabpaper', function(num)
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 Player.Functions.RemoveMoney('cash', prices.tabcost * 10) then
AddItem(src,'tab_paper', 10) AddItem(src,'tab_paper', 10)
Log(GetName(src) ..' Bought Tab Paper!', 'lsd')
else else
Notifys(Lang.lsd.broke, "error") Notifys(Lang.lsd.broke, "error")
end end
@@ -123,7 +118,6 @@ RegisterServerEvent('md-drugs:server:getlabkit', function()
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 Player.Functions.RemoveMoney('cash', prices.lsdlabkitcost) then
AddItem(src,'lsdlabkit', 1) AddItem(src,'lsdlabkit', 1)
Log(GetName(src) ..' Bought A LSD Lab Kit!', 'lsd')
else else
Notifys(src, Lang.lsd.broke, "error") Notifys(src, Lang.lsd.broke, "error")
end end
-2
View File
@@ -45,7 +45,6 @@ RegisterNetEvent("Mescaline:pickupCane", function(loc)
TriggerClientEvent("Mescaline:removeCane", -1, loc) TriggerClientEvent("Mescaline:removeCane", -1, loc)
MescalineCooldown(loc) MescalineCooldown(loc)
AddItem(source,'cactusbulb', 1) AddItem(source,'cactusbulb', 1)
Log(GetName(source) .. ' Picked Cactus Bulbs With a distance of ' .. dist(source, m[loc].location) .. ' vectors', 'mescaline')
end end
end) end)
@@ -53,7 +52,6 @@ RegisterNetEvent("md-drugs:server:drymescaline", function()
local src = source local src = source
if not checkLoc(src, 'singleSpot', 'DryOut') then return end if not checkLoc(src, 'singleSpot', 'DryOut') then return end
if not GetRecipe(src, 'mescaline', 'dry', 'dried') then return end if not GetRecipe(src, 'mescaline', 'dry', 'dried') then return end
Log(GetName(source) .. ' Dried Mescaline', 'mescaline')
end) end)
QBCore.Functions.CreateUseableItem("driedmescaline", function(source, item) QBCore.Functions.CreateUseableItem("driedmescaline", function(source, item)
+2 -1
View File
@@ -155,8 +155,9 @@ function GetRecipe(source, type, method, tier)
end end
for k,v in pairs (recipe[type][method][tier].give) do for k,v in pairs (recipe[type][method][tier].give) do
AddItem(src, k, v) AddItem(src, k, v)
Log(GetName(src) .. ' Made ' .. GetLabels(k) .. '!', 'drugMaking')
end end
return true return true
else else
return false return false
+54 -96
View File
@@ -1,12 +1,12 @@
local QBCore = exports['qb-core']:GetCoreObject() local QBCore = exports['qb-core']:GetCoreObject()
-------------------- stealing ingridients -------------------- stealing ingridients
local activePresses = {}
RegisterServerEvent('md-drugs:server:stealisosafrole', function(num) RegisterServerEvent('md-drugs:server:stealisosafrole', function(num)
local src = source local src = source
local Player = getPlayer(src) local Player = getPlayer(src)
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
Log(GetName(source) .. ' Stole isosafrole with a distance of ' .. dist(source, Config.isosafrole[num]['loc']) .. ' vectors!', 'xtc') end
end
end) end)
RegisterServerEvent('md-drugs:server:stealmdp2p', function(num) RegisterServerEvent('md-drugs:server:stealmdp2p', function(num)
@@ -14,7 +14,6 @@ RegisterServerEvent('md-drugs:server:stealmdp2p', function(num)
local Player = getPlayer(src) 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
Log(GetName(source) .. ' Stole MDP2P with a distance of ' .. dist(source, Config.mdp2p[num]['loc']) .. ' vectors!', 'xtc')
end end
end) end)
@@ -28,9 +27,18 @@ for k, v in pairs (presses) do
QBCore.Functions.CreateUseableItem(v.item, function(source, item) QBCore.Functions.CreateUseableItem(v.item, function(source, item)
local src = source local src = source
local Player = getPlayer(src) local Player = getPlayer(src)
if TriggerClientEvent("md-drugs:client:setpress", src, v.data) then local check, loc = lib.callback.await('md-drugs:client:setpress', src, v.data)
RemoveItem(src, v.item, 1) if check then
Log(GetName(source) .. ' Placed A ' .. v.item .. ' At ' .. GetCoords(source) .. '!', 'xtc') if RemoveItem(src, v.item, 1) then
table.insert(activePresses, {
press = v.data,
get = v.item,
owner = GetName(src),
ownerid = Player.PlayerData.citizenid,
src = src,
loc = loc
})
end
end end
end) end)
end end
@@ -38,85 +46,75 @@ end
RegisterServerEvent('md-drugs:server:getpressback', function(type) RegisterServerEvent('md-drugs:server:getpressback', function(type)
local src = source local src = source
local Player = getPlayer(src) local Player = getPlayer(src)
if type == 'single' then for k, v in pairs (activePresses) do
if Player.Functions.GetItemByName('singlepress') then Notifys(src, 'You Already Have A Kit') return end if v.ownerid == Player.PlayerData.citizenid then
AddItem(src, 'singlepress', 1) if v.press == type then
Log(GetName(source) .. ' Picked Their Single Press At ' .. GetCoords(source) .. '!', 'xtc') table.remove(activePresses, k)
elseif type == 'dual' then AddItem(src, v.get, 1)
if Player.Functions.GetItemByName('dualpress') then Notifys(src, 'You Already Have A Kit') return end end
AddItem(src, 'dualpress', 1) end
Log(GetName(source) .. ' Picked Their Dual Press At ' .. GetCoords(source) .. '!', 'xtc') end
elseif type == 'triple' then
if Player.Functions.GetItemByName('triplepress') then Notifys(src, 'You Already Have A Kit') return end
AddItem(src, 'triplepress', 1)
Log(GetName(source) .. ' Picked Their Triple Press At ' .. GetCoords(source) .. '!', 'xtc')
elseif type == 'quad' then
if Player.Functions.GetItemByName('quadpress') then Notifys(src, 'You Already Have A Kit') return end
AddItem(src, 'quadpress', 1)
Log(GetName(source) .. ' Picked Their Quad Press At ' .. GetCoords(source) .. '!', 'xtc')
end
end) end)
local function pressout(source)
local src = source
local Player = getPlayer(src)
local ped = GetPlayerPed(src)
local coords = GetEntityCoords(ped)
for k, v in pairs (activePresses) do
if v.ownerid == Player.PlayerData.citizenid then
if #(coords - v.loc) < 3.0 then
return v.press
end
end
end
return 'none'
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) 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 data.data == 'single' then if pressout(src) == 'none' then return end
if pressout(src) == 'single' then
if data.color == 'white' then if data.color == 'white' then
if not GetRecipe(src, 'xtc', 'singlestack', 'white') then return end if not GetRecipe(src, 'xtc', 'singlestack', 'white') then return end
Log(GetName(source) .. ' Made A Single Stack White Pill!', 'xtc')
elseif data.color == 'red' then elseif data.color == 'red' then
if not GetRecipe(src, 'xtc', 'singlestack', 'red') then return end if not GetRecipe(src, 'xtc', 'singlestack', 'red') then return end
Log(GetName(source) .. ' Made A Single Stack Red Pill!', 'xtc')
elseif data.color == 'orange' then elseif data.color == 'orange' then
if not GetRecipe(src, 'xtc', 'singlestack', 'orange') then return end if not GetRecipe(src, 'xtc', 'singlestack', 'orange') then return end
Log(GetName(source) .. ' Made A Single Stack Orange Pill!', 'xtc')
elseif data.color == 'blue' then elseif data.color == 'blue' then
if not GetRecipe(src, 'xtc', 'singlestack', 'blue') then return end if not GetRecipe(src, 'xtc', 'singlestack', 'blue') then return end
Log(GetName(source) .. ' Made A Single Stack Blue Pill!', 'xtc')
end end
elseif data.data == 'dual' then elseif pressout(src) == 'dual' then
if data.color == 'white' then if data.color == 'white' then
if not GetRecipe(src, 'xtc', 'dualstack', 'white') then return end if not GetRecipe(src, 'xtc', 'dualstack', 'white') then return end
Log(GetName(source) .. ' Made A Dual Stack White Pill!', 'xtc')
elseif data.color == 'red' then elseif data.color == 'red' then
if not GetRecipe(src, 'xtc', 'dualstack', 'red') then return end if not GetRecipe(src, 'xtc', 'dualstack', 'red') then return end
Log(GetName(source) .. ' Made A Dual Stack Red Pill!', 'xtc')
elseif data.color == 'orange' then elseif data.color == 'orange' then
if not GetRecipe(src, 'xtc', 'dualstack', 'orange') then return end if not GetRecipe(src, 'xtc', 'dualstack', 'orange') then return end
Log(GetName(source) .. ' Made A Dual Stack Orange Pill!', 'xtc')
elseif data.color == 'blue' then elseif data.color == 'blue' then
if not GetRecipe(src, 'xtc', 'dualstack', 'blue') then return end if not GetRecipe(src, 'xtc', 'dualstack', 'blue') then return end
Log(GetName(source) .. ' Made A Dual Stack Blue Pill!', 'xtc')
end end
elseif data.data == 'triple' then elseif pressout(src) == 'triple' then
if data.color == 'white' then if data.color == 'white' then
if not GetRecipe(src, 'xtc', 'triplestack', 'white') then return end if not GetRecipe(src, 'xtc', 'triplestack', 'white') then return end
Log(GetName(source) .. ' Made A Triple Stack White Pill!', 'xtc')
elseif data.color == 'red' then elseif data.color == 'red' then
if not GetRecipe(src, 'xtc', 'triplestack', 'red') then return end if not GetRecipe(src, 'xtc', 'triplestack', 'red') then return end
Log(GetName(source) .. ' Made A Triple Stack Red Pill!', 'xtc')
elseif data.color == 'orange' then elseif data.color == 'orange' then
if not GetRecipe(src, 'xtc', 'triplestack', 'orange') then return end if not GetRecipe(src, 'xtc', 'triplestack', 'orange') then return end
Log(GetName(source) .. ' Made A Triple Stack Orange Pill!', 'xtc')
elseif data.color == 'blue' then elseif data.color == 'blue' then
if not GetRecipe(src, 'xtc', 'triplestack', 'blue') then return end if not GetRecipe(src, 'xtc', 'triplestack', 'blue') then return end
Log(GetName(source) .. ' Made A Triple Stack Blue Pill!', 'xtc')
end end
elseif data.data == 'quad' then elseif pressout(src) == 'quad' then
if data.color == 'white' then if data.color == 'white' then
if not GetRecipe(src, 'xtc', 'quadstack', 'white') then return end if not GetRecipe(src, 'xtc', 'quadstack', 'white') then return end
Log(GetName(source) .. ' Made A Quad Stack White Pill!', 'xtc')
elseif data.color == 'red' then elseif data.color == 'red' then
if not GetRecipe(src, 'xtc', 'quadstack', 'red') then return end if not GetRecipe(src, 'xtc', 'quadstack', 'red') then return end
Log(GetName(source) .. ' Made A Quad Stack Red Pill!', 'xtc')
elseif data.color == 'orange' then elseif data.color == 'orange' then
if not GetRecipe(src, 'xtc', 'quadstack', 'orange') then return end if not GetRecipe(src, 'xtc', 'quadstack', 'orange') then return end
Log(GetName(source) .. ' Made A Quad Stack Orange Pill!', 'xtc')
elseif data.color == 'blue' then elseif data.color == 'blue' then
if not GetRecipe(src, 'xtc', 'quadstack', 'blue') then return end if not GetRecipe(src, 'xtc', 'quadstack', 'blue') then return end
Log(GetName(source) .. ' Made A Quad Stack Blue Pill!', 'xtc')
end end
end end
end) end)
@@ -135,17 +133,12 @@ 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 CheckDist(source, Config.buypress) then return end
if data == 'dual' then if data == 'dual' then
if not GetRecipe(src, 'xtc', 'press', 'dual') then return end if not GetRecipe(src, 'xtc', 'press', 'dual') then return end
Log(GetName(source) .. ' Upgraded Press To Dual Press', 'xtc')
elseif data == 'triple' then elseif data == 'triple' then
if not GetRecipe(src, 'xtc', 'press', 'triple') then return end if not GetRecipe(src, 'xtc', 'press', 'triple') then return end
Log(GetName(source) .. ' Upgraded Press To Triple Press', 'xtc')
elseif data == 'quad' then elseif data == 'quad' then
if not GetRecipe(src, 'xtc', 'press', 'quad') then return end if not GetRecipe(src, 'xtc', 'press', 'quad') then return end
Log(GetName(source) .. ' Upgraded Press To Quad Press', 'xtc')
else else
Notifys(src, 'huh', 'error') Notifys(src, 'huh', 'error')
end end
@@ -157,34 +150,25 @@ RegisterServerEvent('md-drugs:server:makingrawxtc', function(num)
local Player = getPlayer(src) 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
Log(GetName(source) .. ' Made Raw XTC With A Distance Of ' .. dist(source, Config.rawxtcloc[num]['loc']) .. '!', 'xtc')
end) end)
RegisterServerEvent('md-drugs:server:stampwhite', function(num) RegisterServerEvent('md-drugs:server:stampwhite', function(num)
local src = source local src = source
local Player = getPlayer(src)
local one = {'white_playboys', 'white_aliens', 'white_pl', 'white_trolls', 'white_cats'} local one = {'white_playboys', 'white_aliens', 'white_pl', 'white_trolls', 'white_cats'}
local chance = math.random(#one) local chance = math.random(#one)
local two = {'white_playboys2', 'white_aliens2', 'white_pl2', 'white_trolls2', 'white_cats2'} local two = {'white_playboys2', 'white_aliens2', 'white_pl2', 'white_trolls2', 'white_cats2'}
local chance2 = math.random(#one)
local three = {'white_playboys3', 'white_aliens3', 'white_pl3', 'white_trolls3', 'white_cats3'} local three = {'white_playboys3', 'white_aliens3', 'white_pl3', 'white_trolls3', 'white_cats3'}
local chance3 = math.random(#one)
local four = {'white_playboys4', 'white_aliens4', 'white_pl4', 'white_trolls4', 'white_cats4'} local four = {'white_playboys4', 'white_aliens4', 'white_pl4', 'white_trolls4', 'white_cats4'}
local chance4 = math.random(#one)
if not checkLoc(src, 'stamp', num) then return end if not checkLoc(src, 'stamp', num) then return end
if RemoveItem(src, "white_xtc", 1) then if RemoveItem(src, "white_xtc", 1) then
AddItem(src, one[chance], 1) AddItem(src, one[chance], 1)
Log(GetName(source) .. ' Stamped A Single White Pill And Got ' .. one[chance] .. '!', 'xtc')
elseif RemoveItem(src, "white_xtc2", 1) then elseif RemoveItem(src, "white_xtc2", 1) then
AddItem(src, two[chance2], 1) AddItem(src, two[chance], 1)
Log(GetName(source) .. ' Stamped A Dual White Pill And Got ' .. two[chance2] .. '!', 'xtc')
elseif RemoveItem(src, "white_xtc3", 1) then elseif RemoveItem(src, "white_xtc3", 1) then
AddItem(src, three[chance3], 1) AddItem(src, three[chance], 1)
Log(GetName(source) .. ' Stamped A Triple White Pill And Got ' .. three[chance3] .. '!', 'xtc')
elseif RemoveItem(src, "white_xtc4", 1) then elseif RemoveItem(src, "white_xtc4", 1) then
AddItem(src, four[chance4], 1) AddItem(src, four[chance], 1)
Log(GetName(source) .. ' Stamped A Quad White Pill And Got ' .. four[chance4] .. '!', 'xtc')
else else
Notifys('You Dont Have Unstamped White Pills', 'error') Notifys('You Dont Have Unstamped White Pills', 'error')
end end
@@ -192,30 +176,21 @@ end)
RegisterServerEvent('md-drugs:server:stampred', function(num) RegisterServerEvent('md-drugs:server:stampred', function(num)
local src = source local src = source
local Player = getPlayer(src)
local one = {'red_playboys', 'red_aliens', 'red_pl', 'red_trolls', 'red_cats'} local one = {'red_playboys', 'red_aliens', 'red_pl', 'red_trolls', 'red_cats'}
local chance = math.random(#one) local chance = math.random(#one)
local two = {'red_playboys2', 'red_aliens2', 'red_pl2', 'red_trolls2', 'red_cats2'} local two = {'red_playboys2', 'red_aliens2', 'red_pl2', 'red_trolls2', 'red_cats2'}
local chance2 = math.random(#one)
local three = {'red_playboys3', 'red_aliens3', 'red_pl3', 'red_trolls3', 'red_cats3'} local three = {'red_playboys3', 'red_aliens3', 'red_pl3', 'red_trolls3', 'red_cats3'}
local chance3 = math.random(#one)
local four = {'red_playboys4', 'red_aliens4', 'red_pl4', 'red_trolls4', 'red_cats4'} local four = {'red_playboys4', 'red_aliens4', 'red_pl4', 'red_trolls4', 'red_cats4'}
local chance4 = math.random(#one)
local playerPed = GetPlayerPed(source)
if not checkLoc(src, 'stamp', num) then return end if not checkLoc(src, 'stamp', num) then return end
if RemoveItem(src, "red_xtc", 1) then if RemoveItem(src, "red_xtc", 1) then
AddItem(src, one[chance], 1) AddItem(src, one[chance], 1)
Log(GetName(source) .. ' Stamped A Single Red Pill And Got ' .. one[chance] .. '!', 'xtc')
elseif RemoveItem(src, "red_xtc2", 1) then elseif RemoveItem(src, "red_xtc2", 1) then
AddItem(src, two[chance2], 1) AddItem(src, two[chance], 1)
Log(GetName(source) .. ' Stamped A Dual Red Pill And Got ' .. two[chance2] .. '!', 'xtc')
elseif RemoveItem(src, "red_xtc3", 1) then elseif RemoveItem(src, "red_xtc3", 1) then
AddItem(src, three[chance3], 1) AddItem(src, three[chance], 1)
Log(GetName(source) .. ' Stamped A Triple Red Pill And Got ' .. three[chance3] .. '!', 'xtc')
elseif RemoveItem(src, "red_xtc4", 1) then elseif RemoveItem(src, "red_xtc4", 1) then
AddItem(src, four[chance4], 1) AddItem(src, four[chance], 1)
Log(GetName(source) .. ' Stamped A Quad Red Pill And Got ' .. four[chance4] .. '!', 'xtc')
else else
Notifys('You Dont Have Unstamped red Pills', 'error') Notifys('You Dont Have Unstamped red Pills', 'error')
end end
@@ -223,30 +198,21 @@ end)
RegisterServerEvent('md-drugs:server:stamporange', function(num) RegisterServerEvent('md-drugs:server:stamporange', function(num)
local src = source local src = source
local Player = getPlayer(src)
local one = {'orange_playboys', 'orange_aliens', 'orange_pl', 'orange_trolls', 'orange_cats'} local one = {'orange_playboys', 'orange_aliens', 'orange_pl', 'orange_trolls', 'orange_cats'}
local chance = math.random(#one)
local two = {'orange_playboys2', 'orange_aliens2', 'orange_pl2', 'orange_trolls2', 'orange_cats2'} local two = {'orange_playboys2', 'orange_aliens2', 'orange_pl2', 'orange_trolls2', 'orange_cats2'}
local chance2 = math.random(#one)
local three = {'orange_playboys3', 'orange_aliens3', 'orange_pl3', 'orange_trolls3', 'orange_cats3'} local three = {'orange_playboys3', 'orange_aliens3', 'orange_pl3', 'orange_trolls3', 'orange_cats3'}
local chance3 = math.random(#one)
local four = {'orange_playboys4', 'orange_aliens4', 'orange_pl4', 'orange_trolls4', 'orange_cats4'} local four = {'orange_playboys4', 'orange_aliens4', 'orange_pl4', 'orange_trolls4', 'orange_cats4'}
local chance4 = math.random(#one) local chance = math.random(#one)
local playerPed = GetPlayerPed(source)
if not checkLoc(src, 'stamp', num) then return end if not checkLoc(src, 'stamp', num) then return end
if RemoveItem(src, "orange_xtc", 1) then if RemoveItem(src, "orange_xtc", 1) then
AddItem(src, one[chance], 1) AddItem(src, one[chance], 1)
Log(GetName(source) .. ' Stamped A Single Orange Pill And Got ' .. one[chance] .. '!', 'xtc')
elseif RemoveItem(src, "orange_xtc2", 1) then elseif RemoveItem(src, "orange_xtc2", 1) then
AddItem(src, two[chance2], 1) AddItem(src, two[chance], 1)
Log(GetName(source) .. ' Stamped A Dual Orange Pill And Got ' .. two[chance2] .. '!', 'xtc')
elseif RemoveItem(src, "orange_xtc3", 1) then elseif RemoveItem(src, "orange_xtc3", 1) then
AddItem(src, three[chance3], 1) AddItem(src, three[chance], 1)
Log(GetName(source) .. ' Stamped A Triple Orange Pill And Got ' .. three[chance3] .. '!', 'xtc')
elseif RemoveItem(src, "orange_xtc4", 1) then elseif RemoveItem(src, "orange_xtc4", 1) then
AddItem(src, four[chance4], 1) AddItem(src, four[chance], 1)
Log(GetName(source) .. ' Stamped A Quad Orange Pill And Got ' .. four[chance4] .. '!', 'xtc')
else else
Notifys('You Dont Have Unstamped orange Pills', 'error') Notifys('You Dont Have Unstamped orange Pills', 'error')
end end
@@ -254,28 +220,20 @@ end)
RegisterServerEvent('md-drugs:server:stampblue', function(num) RegisterServerEvent('md-drugs:server:stampblue', function(num)
local src = source local src = source
local Player = getPlayer(src)
local one = {'blue_playboys', 'blue_aliens', 'blue_pl', 'blue_trolls', 'blue_cats'} local one = {'blue_playboys', 'blue_aliens', 'blue_pl', 'blue_trolls', 'blue_cats'}
local chance = math.random(#one) local chance = math.random(#one)
local two = {'blue_playboys2', 'blue_aliens2', 'blue_pl2', 'blue_trolls2', 'blue_cats2'} local two = {'blue_playboys2', 'blue_aliens2', 'blue_pl2', 'blue_trolls2', 'blue_cats2'}
local chance2 = math.random(#one)
local three = {'blue_playboys3', 'blue_aliens3', 'blue_pl3', 'blue_trolls3', 'blue_cats3'} local three = {'blue_playboys3', 'blue_aliens3', 'blue_pl3', 'blue_trolls3', 'blue_cats3'}
local chance3 = math.random(#one)
local four = {'blue_playboys4', 'blue_aliens4', 'blue_pl4', 'blue_trolls4', 'blue_cats4'} local four = {'blue_playboys4', 'blue_aliens4', 'blue_pl4', 'blue_trolls4', 'blue_cats4'}
local chance4 = math.random(#one)
local playerPed = GetPlayerPed(source)
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 if RemoveItem(src, "blue_xtc", 1) then
AddItem(src, one[chance], 1) AddItem(src, one[chance], 1)
elseif RemoveItem(src, "blue_xtc2", 1) then elseif RemoveItem(src, "blue_xtc2", 1) then
AddItem(src, two[chance2], 1) AddItem(src, two[chance], 1)
Log(GetName(source) .. ' Stamped A Dual Blue Pill And Got ' .. two[chance2] .. '!', 'xtc')
elseif RemoveItem(src, "blue_xtc3", 1) then elseif RemoveItem(src, "blue_xtc3", 1) then
AddItem(src, three[chance3], 1) AddItem(src, three[chance], 1)
Log(GetName(source) .. ' Stamped A Triple Blue Pill And Got ' .. three[chance3] .. '!', 'xtc')
elseif RemoveItem(src, "blue_xtc4", 1) then elseif RemoveItem(src, "blue_xtc4", 1) then
AddItem(src, four[chance4], 1) AddItem(src, four[chance], 1)
Log(GetName(source) .. ' Stamped A Quad Blue Pill And Got ' .. four[chance4] .. '!', 'xtc')
else else
Notifys('You Dont Have Unstamped blue Pills', 'error') Notifys('You Dont Have Unstamped blue Pills', 'error')
end end