update
made server table for presses, will do same for lab kits
This commit is contained in:
1 parent
6df0983273
commit
c2fddd6144
11 files changed
+82
-170
No files matched your search
@@ -23,6 +23,30 @@ RegisterNetEvent("md-drugs:client:setpress", function(type)
|
||||
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)
|
||||
local event = "md-drugs:client:MakeXTC"
|
||||
lib.registerContext({
|
||||
|
||||
@@ -45,7 +45,6 @@ AddEventHandler("coke:pickupCane", function(loc)
|
||||
TriggerClientEvent("coke:removeCane", -1, loc)
|
||||
CaneCooldown(loc)
|
||||
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)
|
||||
|
||||
@@ -65,7 +64,6 @@ RegisterServerEvent('md-drugs:server:makepowder', function(num)
|
||||
end
|
||||
end
|
||||
if not GetRecipe(src, 'cocaine', 'cokepowder', tier) then return end
|
||||
Log(GetName(src) .. logMessage .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
|
||||
end)
|
||||
|
||||
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
|
||||
else
|
||||
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end
|
||||
Log(GetName(src) .. ' Cut Coke', 'coke')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -126,7 +123,6 @@ RegisterServerEvent('md-drugs:server:bagcoke', function(num)
|
||||
AddRep(src, 'coke')
|
||||
else
|
||||
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end
|
||||
Log(GetName(src) .. ' Bagged Coke', 'coke')
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ RegisterServerEvent('md-drugs:server:makecrackone', function(num)
|
||||
if Player.Functions.GetItemByName(v.item) then
|
||||
tier = v.tier
|
||||
count = count + 1
|
||||
Log(GetName(src) .. v.log, 'crack')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -40,7 +39,6 @@ RegisterServerEvent('md-drugs:server:bagcrack', function(num)
|
||||
if Player.Functions.GetItemByName(v.item) then
|
||||
tier = v.tier
|
||||
count = count + 1
|
||||
Log(GetName(src) .. v.log, 'crack')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -80,9 +80,6 @@ lib.addCommand("newdealer", {
|
||||
if not Player then return end
|
||||
|
||||
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 result = MySQL.scalar.await('SELECT name FROM dealers WHERE name = ?', { dealerName })
|
||||
@@ -91,7 +88,7 @@ lib.addCommand("newdealer", {
|
||||
end
|
||||
|
||||
MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', {
|
||||
dealerName, pos, time, Player.PlayerData.citizenid
|
||||
dealerName, pos, 'nil', Player.PlayerData.citizenid
|
||||
}, function()
|
||||
QBConfig.Dealers[dealerName] = {
|
||||
name = dealerName,
|
||||
@@ -101,10 +98,6 @@ lib.addCommand("newdealer", {
|
||||
z = coords.z,
|
||||
h = GetEntityHeading(ped)
|
||||
},
|
||||
time = {
|
||||
min = minTime,
|
||||
max = maxTime
|
||||
},
|
||||
}
|
||||
TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers)
|
||||
end)
|
||||
|
||||
@@ -318,38 +318,6 @@ function sortTab(tbl, type)
|
||||
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)
|
||||
local amount = 0
|
||||
local players = QBCore.Functions.GetQBPlayers()
|
||||
|
||||
@@ -54,7 +54,6 @@ RegisterServerEvent("heroin:pickupCane", function(loc)
|
||||
TriggerClientEvent("heroin:removeCane", -1, loc)
|
||||
heroinCooldown(loc)
|
||||
AddItem(source, 'poppyresin', 1)
|
||||
Log(GetName(source) .. ' Picked A Poppies With a distance of ' .. dist(source, h[loc].location) .. ' vectors', 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -66,17 +65,13 @@ RegisterServerEvent('md-drugs:server:dryplant', function(num)
|
||||
local heroin = getRep(src, 'heroin')
|
||||
if heroin <= Config.Tier1 then
|
||||
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
|
||||
if not GetRecipe(src, 'heroin', 'dryheroin', 'tier2') then return end
|
||||
Log(GetName(src) ..' Made Heroin Powder Tier 2', 'heroin')
|
||||
else
|
||||
if not GetRecipe(src, 'heroin', 'dryheroin', 'tier3') then return end
|
||||
Log(GetName(src) ..' Made Heroin Powder Tier 3', 'heroin')
|
||||
end
|
||||
else
|
||||
if not GetRecipe(src, 'heroin', 'dryheroin', 'tier1') then return end
|
||||
Log(GetName(src) ..' Made Heroin Powder With a distance of', 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -92,19 +87,15 @@ RegisterServerEvent('md-drugs:server:cutheroin', function(num)
|
||||
local rawh3 = Player.Functions.GetItemByName('heroinstagethree')
|
||||
if rawh then
|
||||
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end
|
||||
Log(GetName(src) ..' Cut Heroin With a distance of', 'heroin')
|
||||
elseif rawh2 then
|
||||
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
|
||||
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier3') then return end
|
||||
Log(GetName(src) .. ' Cut Heroin Tier 3 With a distance of', 'heroin')
|
||||
else
|
||||
Notifys(src, Lang.Heroin.noheroin, "error")
|
||||
end
|
||||
else
|
||||
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end
|
||||
Log(GetName(src) ..' Cut Heroin With a distance of', 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -114,7 +105,6 @@ RegisterServerEvent('md-drugs:server:getheroinlabkit', function()
|
||||
if not checkLoc(source, 'singleSpot', 'buyheroinlabkit') then return end
|
||||
if Player.Functions.RemoveMoney('cash', prices.heroinlabkitprice) then
|
||||
AddItem(src, 'heroinlabkit', 1)
|
||||
Log(GetName(src) ..' Bought A Heroin lab Kit', 'heroin')
|
||||
else
|
||||
Notifys(src, 'You Need '.. prices.heroinlabkitprice .. ' In Cash For This', 'error')
|
||||
end
|
||||
@@ -124,7 +114,6 @@ RegisterServerEvent('md-drugs:server:getheroinlabkitback', function()
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if AddItem(src, "heroinlabkit", 1) then
|
||||
Log(GetName(src) ..' Picked Up Their Heroin Lab Kit Back At ' .. GetCoords(src) .. '!', 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -150,19 +139,15 @@ local Player = getPlayer(src)
|
||||
local cuth3 = Player.Functions.GetItemByName('heroincutstagethree')
|
||||
if cuth then
|
||||
if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end
|
||||
Log(GetName(src) ..' Made A Vial Of Heroin', 'heroin')
|
||||
elseif cuth2 then
|
||||
if not GetRecipe(src, 'heroin', 'fillvial', 'tier2') then return end
|
||||
Log(GetName(src) ..' Made A Vial Of Heroin Tier 2', 'heroin')
|
||||
elseif cuth3 then
|
||||
if not GetRecipe(src, 'heroin', 'fillvial', 'tier3') then return end
|
||||
Log(GetName(src) ..' Made A Vial Of Heroin Tier 3', 'heroin')
|
||||
else
|
||||
Notifys(src, 'no cut heroin', "error")
|
||||
end
|
||||
else
|
||||
if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end
|
||||
Log(GetName(src) ..' Made A Vial Of Heroin', 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -172,7 +157,6 @@ local Player = getPlayer(src)
|
||||
local cuth = Player.Functions.GetItemByName('heroincut')
|
||||
local cuth2 = Player.Functions.GetItemByName('heroincutstagetwo')
|
||||
local cuth3 = Player.Functions.GetItemByName('heroincutstagethree')
|
||||
Log(GetName(src) ..' Sucks And Burned Their Heroin', 'heroin')
|
||||
if cuth then
|
||||
RemoveItem(src, 'heroincut', 1)
|
||||
Notifys(src,Lang.Heroin.fail, "error")
|
||||
@@ -199,21 +183,17 @@ RegisterServerEvent('md-drugs:server:fillneedle', function(num)
|
||||
if vh then
|
||||
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier1') then return end
|
||||
AddRep(src, 'heroin')
|
||||
Log(GetName(src) ..' Filled A Needle Of Heroin And Now Has A Rep Of ' .. heroin + 1 .. '!' , 'heroin')
|
||||
elseif vh2 then
|
||||
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier2') then return end
|
||||
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
|
||||
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier3') then return end
|
||||
AddRep(src, 'heroin')
|
||||
Log(GetName(src) ..' Filled A Needle Of Heroin Tier 3 And Now Has A Rep Of ' .. heroin + 1 .. '!' , 'heroin')
|
||||
else
|
||||
Notifys(src,Lang.Heroin.nofill, "error")
|
||||
end
|
||||
else
|
||||
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier1') then return end
|
||||
Log(GetName(src) ..' Filled A Needle Of Heroin!' , 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -123,8 +123,10 @@ function checkLoc(source, event, num)
|
||||
end
|
||||
local dist = #(coord - loc)
|
||||
if dist < 2.5 then
|
||||
Log(GetName(source) .. ' Triggered the table ' .. event .. ' Within The Correct Distance', 'locations')
|
||||
return true
|
||||
else
|
||||
Log(GetName(source) .. ' Triggered the table ' .. event .. ' Not Within The Correct Distance', 'locations')
|
||||
Notifys(source, 'You are not in the correct location', 'error')
|
||||
return false
|
||||
end
|
||||
|
||||
+2
-8
@@ -7,7 +7,6 @@ RegisterServerEvent('md-drugs:server:getlysergic', function(num)
|
||||
local src = source
|
||||
if not checkLoc(src, 'lysergicacid', num) then return end
|
||||
if AddItem(src,'lysergic_acid', 2) then
|
||||
Log(GetName(src) ..' Got Lysergic acid!', 'lsd')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -15,7 +14,6 @@ RegisterServerEvent('md-drugs:server:getdiethylamide', function(num)
|
||||
local src = source
|
||||
if not checkLoc(src, 'diethylamide', num) then return end
|
||||
if AddItem(src,'diethylamide', 2) then
|
||||
Log(GetName(src) ..' Got diethylamide!', 'lsd')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -24,7 +22,6 @@ QBCore.Functions.CreateUseableItem('lsdlabkit', function(source, item)
|
||||
local src = source
|
||||
if TriggerClientEvent("md-drugs:client:setlsdlabkit", src) then
|
||||
RemoveItem(src, "lsdlabkit", 1)
|
||||
Log(GetName(src) ..' Placed Their LSD Lab Kit Back At ' .. GetCoords(src) .. '!', 'lsd')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -33,7 +30,6 @@ lib.callback.register('md-drugs:server:removecleaningkit', function(source)
|
||||
local src = source
|
||||
if not Itemcheck(src, 'cleaningkit', 1) then return end
|
||||
if RemoveItem(src,"cleaningkit", 1) then
|
||||
Log(GetName(src) ..' Wiped Down Their LSD Lab Kit!' , 'lsd')
|
||||
return true
|
||||
end
|
||||
end)
|
||||
@@ -48,12 +44,12 @@ end)
|
||||
RegisterServerEvent('md-drugs:server:heatliquid', function()
|
||||
local src = source
|
||||
if not GetRecipe(src, 'lsd', 'vial', 'heat') then return end
|
||||
Log(GetName(src) ..' Heated Basic LSD!', 'lsd')
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:failheating', function()
|
||||
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")
|
||||
Log(GetName(src) ..' Failed Basic LSD Like An Idiot!', 'lsd')
|
||||
end)
|
||||
@@ -111,7 +107,6 @@ RegisterServerEvent('md-drugs:server:gettabpaper', function(num)
|
||||
if not checkLoc(src, 'gettabs', num) then return end
|
||||
if Player.Functions.RemoveMoney('cash', prices.tabcost * 10) then
|
||||
AddItem(src,'tab_paper', 10)
|
||||
Log(GetName(src) ..' Bought Tab Paper!', 'lsd')
|
||||
else
|
||||
Notifys(Lang.lsd.broke, "error")
|
||||
end
|
||||
@@ -123,7 +118,6 @@ RegisterServerEvent('md-drugs:server:getlabkit', function()
|
||||
if not checkLoc(src,'singleSpot', 'buylsdlabkit') then return end
|
||||
if Player.Functions.RemoveMoney('cash', prices.lsdlabkitcost) then
|
||||
AddItem(src,'lsdlabkit', 1)
|
||||
Log(GetName(src) ..' Bought A LSD Lab Kit!', 'lsd')
|
||||
else
|
||||
Notifys(src, Lang.lsd.broke, "error")
|
||||
end
|
||||
|
||||
@@ -45,7 +45,6 @@ RegisterNetEvent("Mescaline:pickupCane", function(loc)
|
||||
TriggerClientEvent("Mescaline:removeCane", -1, loc)
|
||||
MescalineCooldown(loc)
|
||||
AddItem(source,'cactusbulb', 1)
|
||||
Log(GetName(source) .. ' Picked Cactus Bulbs With a distance of ' .. dist(source, m[loc].location) .. ' vectors', 'mescaline')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -53,7 +52,6 @@ RegisterNetEvent("md-drugs:server:drymescaline", function()
|
||||
local src = source
|
||||
if not checkLoc(src, 'singleSpot', 'DryOut') then return end
|
||||
if not GetRecipe(src, 'mescaline', 'dry', 'dried') then return end
|
||||
Log(GetName(source) .. ' Dried Mescaline', 'mescaline')
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateUseableItem("driedmescaline", function(source, item)
|
||||
|
||||
@@ -155,6 +155,7 @@ function GetRecipe(source, type, method, tier)
|
||||
end
|
||||
for k,v in pairs (recipe[type][method][tier].give) do
|
||||
AddItem(src, k, v)
|
||||
Log(GetName(src) .. ' Made ' .. GetLabels(k) .. '!', 'drugMaking')
|
||||
end
|
||||
|
||||
return true
|
||||
|
||||
+52
-94
@@ -1,11 +1,11 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
-------------------- stealing ingridients
|
||||
local activePresses = {}
|
||||
RegisterServerEvent('md-drugs:server:stealisosafrole', function(num)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if not checkLoc(src, 'isosafrole',num) then return end
|
||||
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)
|
||||
|
||||
@@ -14,7 +14,6 @@ RegisterServerEvent('md-drugs:server:stealmdp2p', function(num)
|
||||
local Player = getPlayer(src)
|
||||
if not checkLoc(src, 'mdp2p',num) then return end
|
||||
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)
|
||||
|
||||
@@ -28,9 +27,18 @@ for k, v in pairs (presses) do
|
||||
QBCore.Functions.CreateUseableItem(v.item, function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if TriggerClientEvent("md-drugs:client:setpress", src, v.data) then
|
||||
RemoveItem(src, v.item, 1)
|
||||
Log(GetName(source) .. ' Placed A ' .. v.item .. ' At ' .. GetCoords(source) .. '!', 'xtc')
|
||||
local check, loc = lib.callback.await('md-drugs:client:setpress', src, v.data)
|
||||
if check then
|
||||
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
|
||||
@@ -38,85 +46,75 @@ end
|
||||
RegisterServerEvent('md-drugs:server:getpressback', function(type)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if type == 'single' then
|
||||
if Player.Functions.GetItemByName('singlepress') then Notifys(src, 'You Already Have A Kit') return end
|
||||
AddItem(src, 'singlepress', 1)
|
||||
Log(GetName(source) .. ' Picked Their Single Press At ' .. GetCoords(source) .. '!', 'xtc')
|
||||
elseif type == 'dual' then
|
||||
if Player.Functions.GetItemByName('dualpress') then Notifys(src, 'You Already Have A Kit') return end
|
||||
AddItem(src, 'dualpress', 1)
|
||||
Log(GetName(source) .. ' Picked Their Dual Press At ' .. GetCoords(source) .. '!', 'xtc')
|
||||
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')
|
||||
for k, v in pairs (activePresses) do
|
||||
if v.ownerid == Player.PlayerData.citizenid then
|
||||
if v.press == type then
|
||||
table.remove(activePresses, k)
|
||||
AddItem(src, v.get, 1)
|
||||
end
|
||||
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)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
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 not GetRecipe(src, 'xtc', 'singlestack', 'white') then return end
|
||||
Log(GetName(source) .. ' Made A Single Stack White Pill!', 'xtc')
|
||||
elseif data.color == 'red' then
|
||||
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
|
||||
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
|
||||
if not GetRecipe(src, 'xtc', 'singlestack', 'blue') then return end
|
||||
Log(GetName(source) .. ' Made A Single Stack Blue Pill!', 'xtc')
|
||||
end
|
||||
elseif data.data == 'dual' then
|
||||
elseif pressout(src) == 'dual' then
|
||||
if data.color == 'white' then
|
||||
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
|
||||
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
|
||||
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
|
||||
if not GetRecipe(src, 'xtc', 'dualstack', 'blue') then return end
|
||||
Log(GetName(source) .. ' Made A Dual Stack Blue Pill!', 'xtc')
|
||||
end
|
||||
elseif data.data == 'triple' then
|
||||
elseif pressout(src) == 'triple' then
|
||||
if data.color == 'white' then
|
||||
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
|
||||
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
|
||||
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
|
||||
if not GetRecipe(src, 'xtc', 'triplestack', 'blue') then return end
|
||||
Log(GetName(source) .. ' Made A Triple Stack Blue Pill!', 'xtc')
|
||||
end
|
||||
elseif data.data == 'quad' then
|
||||
elseif pressout(src) == 'quad' then
|
||||
if data.color == 'white' then
|
||||
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
|
||||
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
|
||||
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
|
||||
if not GetRecipe(src, 'xtc', 'quadstack', 'blue') then return end
|
||||
Log(GetName(source) .. ' Made A Quad Stack Blue Pill!', 'xtc')
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -135,17 +133,12 @@ RegisterServerEvent('md-drugs:server:buypress', function()
|
||||
|
||||
RegisterServerEvent('md-drugs:server:upgradepress', function(data)
|
||||
local src = source
|
||||
|
||||
if CheckDist(source, Config.buypress) then return end
|
||||
if data == 'dual' then
|
||||
if not GetRecipe(src, 'xtc', 'press', 'dual') then return end
|
||||
Log(GetName(source) .. ' Upgraded Press To Dual Press', 'xtc')
|
||||
elseif data == 'triple' then
|
||||
if not GetRecipe(src, 'xtc', 'press', 'triple') then return end
|
||||
Log(GetName(source) .. ' Upgraded Press To Triple Press', 'xtc')
|
||||
elseif data == 'quad' then
|
||||
if not GetRecipe(src, 'xtc', 'press', 'quad') then return end
|
||||
Log(GetName(source) .. ' Upgraded Press To Quad Press', 'xtc')
|
||||
else
|
||||
Notifys(src, 'huh', 'error')
|
||||
end
|
||||
@@ -157,34 +150,25 @@ RegisterServerEvent('md-drugs:server:makingrawxtc', function(num)
|
||||
local Player = getPlayer(src)
|
||||
if not checkLoc(src, 'rawxtcloc',num) 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)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:stampwhite', function(num)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
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 chance2 = math.random(#one)
|
||||
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 chance4 = math.random(#one)
|
||||
if not checkLoc(src, 'stamp', num) then return end
|
||||
|
||||
if RemoveItem(src, "white_xtc", 1) then
|
||||
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
|
||||
AddItem(src, two[chance2], 1)
|
||||
Log(GetName(source) .. ' Stamped A Dual White Pill And Got ' .. two[chance2] .. '!', 'xtc')
|
||||
AddItem(src, two[chance], 1)
|
||||
elseif RemoveItem(src, "white_xtc3", 1) then
|
||||
AddItem(src, three[chance3], 1)
|
||||
Log(GetName(source) .. ' Stamped A Triple White Pill And Got ' .. three[chance3] .. '!', 'xtc')
|
||||
AddItem(src, three[chance], 1)
|
||||
elseif RemoveItem(src, "white_xtc4", 1) then
|
||||
AddItem(src, four[chance4], 1)
|
||||
Log(GetName(source) .. ' Stamped A Quad White Pill And Got ' .. four[chance4] .. '!', 'xtc')
|
||||
AddItem(src, four[chance], 1)
|
||||
else
|
||||
Notifys('You Dont Have Unstamped White Pills', 'error')
|
||||
end
|
||||
@@ -192,30 +176,21 @@ end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:stampred', function(num)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
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 chance2 = math.random(#one)
|
||||
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 chance4 = math.random(#one)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if not checkLoc(src, 'stamp', num) then return end
|
||||
|
||||
if RemoveItem(src, "red_xtc", 1) then
|
||||
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
|
||||
AddItem(src, two[chance2], 1)
|
||||
Log(GetName(source) .. ' Stamped A Dual Red Pill And Got ' .. two[chance2] .. '!', 'xtc')
|
||||
AddItem(src, two[chance], 1)
|
||||
elseif RemoveItem(src, "red_xtc3", 1) then
|
||||
AddItem(src, three[chance3], 1)
|
||||
Log(GetName(source) .. ' Stamped A Triple Red Pill And Got ' .. three[chance3] .. '!', 'xtc')
|
||||
AddItem(src, three[chance], 1)
|
||||
elseif RemoveItem(src, "red_xtc4", 1) then
|
||||
AddItem(src, four[chance4], 1)
|
||||
Log(GetName(source) .. ' Stamped A Quad Red Pill And Got ' .. four[chance4] .. '!', 'xtc')
|
||||
AddItem(src, four[chance], 1)
|
||||
else
|
||||
Notifys('You Dont Have Unstamped red Pills', 'error')
|
||||
end
|
||||
@@ -223,30 +198,21 @@ end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:stamporange', function(num)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
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 chance2 = math.random(#one)
|
||||
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 chance4 = math.random(#one)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
local chance = math.random(#one)
|
||||
if not checkLoc(src, 'stamp', num) then return end
|
||||
|
||||
if RemoveItem(src, "orange_xtc", 1) then
|
||||
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
|
||||
AddItem(src, two[chance2], 1)
|
||||
Log(GetName(source) .. ' Stamped A Dual Orange Pill And Got ' .. two[chance2] .. '!', 'xtc')
|
||||
AddItem(src, two[chance], 1)
|
||||
elseif RemoveItem(src, "orange_xtc3", 1) then
|
||||
AddItem(src, three[chance3], 1)
|
||||
Log(GetName(source) .. ' Stamped A Triple Orange Pill And Got ' .. three[chance3] .. '!', 'xtc')
|
||||
AddItem(src, three[chance], 1)
|
||||
elseif RemoveItem(src, "orange_xtc4", 1) then
|
||||
AddItem(src, four[chance4], 1)
|
||||
Log(GetName(source) .. ' Stamped A Quad Orange Pill And Got ' .. four[chance4] .. '!', 'xtc')
|
||||
AddItem(src, four[chance], 1)
|
||||
else
|
||||
Notifys('You Dont Have Unstamped orange Pills', 'error')
|
||||
end
|
||||
@@ -254,28 +220,20 @@ end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:stampblue', function(num)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
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 chance2 = math.random(#one)
|
||||
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 chance4 = math.random(#one)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
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[chance2], 1)
|
||||
Log(GetName(source) .. ' Stamped A Dual Blue Pill And Got ' .. two[chance2] .. '!', 'xtc')
|
||||
AddItem(src, two[chance], 1)
|
||||
elseif RemoveItem(src, "blue_xtc3", 1) then
|
||||
AddItem(src, three[chance3], 1)
|
||||
Log(GetName(source) .. ' Stamped A Triple Blue Pill And Got ' .. three[chance3] .. '!', 'xtc')
|
||||
AddItem(src, three[chance], 1)
|
||||
elseif RemoveItem(src, "blue_xtc4", 1) then
|
||||
AddItem(src, four[chance4], 1)
|
||||
Log(GetName(source) .. ' Stamped A Quad Blue Pill And Got ' .. four[chance4] .. '!', 'xtc')
|
||||
AddItem(src, four[chance], 1)
|
||||
else
|
||||
Notifys('You Dont Have Unstamped blue Pills', 'error')
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user