- added timeout function. any event you trigger puts a 3 second hold on the rest of the script for that player to ensure no injectors can endlessly spam and get things. if triggered while on cooldown a console print happens

This commit is contained in:
Mustache Dom committed 2025-08-16 23:43:20 -07:00
1 parent af0efacfe9
commit d9fcb11930
17 files changed
+82 -57

No files matched your search

-1
View File
@@ -15,7 +15,6 @@ function EcstasyEffect()
if IsPedRunning(PlayerPedId()) then if IsPedRunning(PlayerPedId()) then
SetPedToRagdoll(PlayerPedId(), math.random(1000, 3000), math.random(1000, 3000), 3, 0, 0, 0) SetPedToRagdoll(PlayerPedId(), math.random(1000, 3000), math.random(1000, 3000), 3, 0, 0, 0)
end end
startStamina = 0 startStamina = 0
end end
+1 -1
View File
@@ -132,7 +132,7 @@ for k, v in pairs(locations.xtcpress) do
description = ps.lang('xtc.buySingle', d.cash), description = ps.lang('xtc.buySingle', d.cash),
action = function() action = function()
if not ps.progressbar(ps.lang('xtc.buyp'), 4000, 'uncuff') then return end if not ps.progressbar(ps.lang('xtc.buyp'), 4000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:buypress', m) TriggerServerEvent('md-drugs:server:buypress',k, m)
end, end,
} }
else else
+1
View File
@@ -9,6 +9,7 @@ Lang.Catches = {
itemNeeded = 'You Need %s', itemNeeded = 'You Need %s',
cooldown = 'Slow Down Speed Racer', cooldown = 'Slow Down Speed Racer',
invalidItem = 'This Item Is Not Sold Here', invalidItem = 'This Item Is Not Sold Here',
onCooldownWarn = '%s Attempted To Run Event %s \n while on cooldown'
} }
Lang.coke = { Lang.coke = {
+1 -1
View File
@@ -5,7 +5,7 @@ Lang.Catches = {
needItems = 'Aww... you don’t have all da items I need... 😢', needItems = 'Aww... you don’t have all da items I need... 😢',
notEnoughMoney = 'Oof, you’re too broke, sweetie 💸', notEnoughMoney = 'Oof, you’re too broke, sweetie 💸',
buySuccess = 'Yay! You bought %s %s for $%s! 💖', buySuccess = 'Yay! You bought %s %s for $%s! 💖',
itemMissings = 'You need:\n%s', itemMissings = 'You need:\n',
itemNeeded = 'You need %s... plz go get it! 🥺', itemNeeded = 'You need %s... plz go get it! 🥺',
cooldown = 'Silly baka, slow down! ⏳', cooldown = 'Silly baka, slow down! ⏳',
invalidItem = 'Eh? This item isn’t sold here, silly! 🙃', invalidItem = 'Eh? This item isn’t sold here, silly! 🙃',
+6 -2
View File
@@ -16,9 +16,10 @@ local cocaineRecipes = {
tier3 = {take = {loosecokestagethree = 1, empty_weed_bag = 1}, give = {cokebaggystagethree = 1}}, tier3 = {take = {loosecokestagethree = 1, empty_weed_bag = 1}, give = {cokebaggystagethree = 1}},
} }
} }
local cocaineLocations = { local cocaineLocations = {
MakePowder = { MakePowder = {
{loc = vector3(1086.20, -3195.30, -39.20), l = 1.0, w = 1.0, rot = 45.0, gang = "ballas"}, {loc = vector3(1086.20, -3195.30, -39.20), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
}, },
CuttingCoke = { CuttingCoke = {
{loc = vector3(1095.61, -3195.62, -39.13), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(-1.782227, 0.445068, -0.502701), rotation = vector3(0,0,0), gang = ""}, {loc = vector3(1095.61, -3195.62, -39.13), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(-1.782227, 0.445068, -0.502701), rotation = vector3(0,0,0), gang = ""},
@@ -39,8 +40,9 @@ end)
RegisterServerEvent('md-drugs:server:makepowder', function(num) RegisterServerEvent('md-drugs:server:makepowder', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:makepowder') then return end
if not ps.checkDistance(src, cocaineLocations.MakePowder[num].loc, 3.5) then if not ps.checkDistance(src, cocaineLocations.MakePowder[num].loc, 3.5) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') ps.warn(ps.lang('Catches.notIn', ps.getPlayerName(src)), 'md-drugs:server:makepowder')
return return
end end
local tier = 'tier1' local tier = 'tier1'
@@ -61,6 +63,7 @@ end)
RegisterServerEvent('md-drugs:server:cutcokeone', function(num) RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
local src = source local src = source
local tier = 'tier1' local tier = 'tier1'
if timeOut(src, 'md-drugs:server:cutcokeone') then return end
if not ps.checkDistance(src, cocaineLocations.CuttingCoke[num].loc, 2.5) then if not ps.checkDistance(src, cocaineLocations.CuttingCoke[num].loc, 2.5) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') ps.notify(src, ps.lang('Catches.notIn'), 'error')
return return
@@ -87,6 +90,7 @@ end)
RegisterServerEvent('md-drugs:server:bagcoke', function(num) RegisterServerEvent('md-drugs:server:bagcoke', function(num)
local src = source local src = source
local tier = 'tier1' local tier = 'tier1'
if timeOut(src, 'md-drugs:server:bagcoke') then return end
if not ps.checkDistance(src, cocaineLocations.BaggingCoke[num].loc, 2.5) then if not ps.checkDistance(src, cocaineLocations.BaggingCoke[num].loc, 2.5) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') ps.notify(src, ps.lang('Catches.notIn'), 'error')
return return
+5
View File
@@ -20,16 +20,20 @@ local CrackLocations = {
}, },
} }
ps.registerCallback('md-drugs:server:GetCrackLocations', function() ps.registerCallback('md-drugs:server:GetCrackLocations', function()
return CrackLocations return CrackLocations
end) end)
RegisterServerEvent('md-drugs:server:makecrackone', function(num) RegisterServerEvent('md-drugs:server:makecrackone', function(num)
local src = source local src = source
local tier = 'tier1' local tier = 'tier1'
if timeOut(src, 'md-drugs:server:makecrackone') then return end
if not ps.checkDistance(src, CrackLocations.makecrack[num].loc, 2.0) then if not ps.checkDistance(src, CrackLocations.makecrack[num].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') ps.notify(src, ps.lang('Catches.notIn'), 'error')
return return
end end
if Config.TierSystem then if Config.TierSystem then
local crackTiers = { local crackTiers = {
{item = 'loosecoke', tier = 'tier1'}, {item = 'loosecoke', tier = 'tier1'},
@@ -53,6 +57,7 @@ end)
RegisterServerEvent('md-drugs:server:bagcrack', function(num) RegisterServerEvent('md-drugs:server:bagcrack', function(num)
local src = source local src = source
local tier = 'tier1' local tier = 'tier1'
if timeOut(src, 'md-drugs:server:bagcrack') then return end
if not ps.checkDistance(src, CrackLocations.bagcrack[num].loc, 2.0) then if not ps.checkDistance(src, CrackLocations.bagcrack[num].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') ps.notify(src, ps.lang('Catches.notIn'), 'error')
return return
+19
View File
@@ -1,3 +1,22 @@
local timeOutPlayers = {}
local function timeOutThread(src)
CreateThread(function()
timeOutPlayers[ps.getIdentifier(src)] = true
Wait(3000)
timeOutPlayers[ps.getIdentifier(src)] = nil
end)
end
function timeOut(src, event)
if timeOutPlayers[ps.getIdentifier(src)] then
ps.warn(ps.lang('Catches.onCooldownWarn', ps.getPlayerName(src), event))
return true
end
timeOutThread(src)
return false
end
function verifyHas(source, items) function verifyHas(source, items)
local need = 0 local need = 0
local have = 0 local have = 0
+15 -4
View File
@@ -37,13 +37,14 @@ local heroinLocations = {
} }
} }
local prices = {
heroinlabkitprice = 10000
}
ps.registerCallback('md-drugs:server:GetHeroinLocations', function(source) ps.registerCallback('md-drugs:server:GetHeroinLocations', function(source)
return heroinLocations return heroinLocations
end) end)
local prices = {
heroinlabkitprice = 10000
}
ps.registerCallback('removeCleaningkit', function(source) ps.registerCallback('removeCleaningkit', function(source)
for k, v in pairs(heroinLabKits) do for k, v in pairs(heroinLabKits) do
@@ -57,6 +58,8 @@ end)
RegisterServerEvent('md-drugs:server:dryplant', function(num) RegisterServerEvent('md-drugs:server:dryplant', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:dryplant') then return end
if not ps.checkDistance(src, heroinLocations.dryplant[num].loc, 3.0) then if not ps.checkDistance(src, heroinLocations.dryplant[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') ps.notify(src, ps.lang('Catches.notIn'), 'error')
return return
@@ -81,6 +84,9 @@ end)
RegisterServerEvent('md-drugs:server:cutheroin', function(num) RegisterServerEvent('md-drugs:server:cutheroin', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:cutheroin') then return end
if not ps.checkDistance(src, heroinLocations.cutheroinone[num].loc, 3.0) then if not ps.checkDistance(src, heroinLocations.cutheroinone[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') ps.notify(src, ps.lang('Catches.notIn'), 'error')
return return
@@ -112,6 +118,7 @@ end)
RegisterServerEvent('md-drugs:server:getheroinlabkit', function(num) RegisterServerEvent('md-drugs:server:getheroinlabkit', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:getheroinlabkit') then return end
if not ps.checkDistance(src, heroinLocations.buyKit[num].loc, 3.0) then if not ps.checkDistance(src, heroinLocations.buyKit[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') ps.notify(src, ps.lang('Catches.notIn'), 'error')
return return
@@ -165,8 +172,12 @@ end)
RegisterServerEvent('md-drugs:server:heatliquidheroin', function() RegisterServerEvent('md-drugs:server:heatliquidheroin', function()
local src = source local src = source
if timeOut(src, 'md-drugs:server:heatliquidheroin') then return end
if not hasHKit(src) then return end if not hasHKit(src) then return end
if not ps.hasItem(src, 'emptyvial', 1) then return end if not ps.hasItem(src, 'emptyvial', 1) then return end
if Config.TierSystem then if Config.TierSystem then
local itemList = { local itemList = {
heroincut = 'tier1', heroincut = 'tier1',
@@ -212,6 +223,7 @@ end)
RegisterServerEvent('md-drugs:server:fillneedle', function(num) RegisterServerEvent('md-drugs:server:fillneedle', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:fillneedle') then return end
if not ps.checkDistance(src, heroinLocations.fillneedle[num].loc, 3.0) then if not ps.checkDistance(src, heroinLocations.fillneedle[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') ps.notify(src, ps.lang('Catches.notIn'), 'error')
return return
@@ -244,7 +256,6 @@ end)
RegisterServerEvent('md-drugs:server:failheroin', function() RegisterServerEvent('md-drugs:server:failheroin', function()
local src = source local src = source
--Log(ps.getPlayerName(src) ..' Sucks And Burned Their Heroin', 'heroin')
if Config.TierSystem then if Config.TierSystem then
local itemList = { local itemList = {
heroinvial = 1, heroinvial = 1,
+7 -14
View File
@@ -31,37 +31,25 @@ ps.registerCallback('md-drugs:server:GetLSDLocations', function(source)
return lsdLocations return lsdLocations
end) end)
local timedOut = {}
local function timeout(src, time)
timedOut[src] = true
CreateThread(function()
Wait(time)
timedOut[src] = nil
end)
end
local lsdTables = {} local lsdTables = {}
RegisterServerEvent('md-drugs:server:getlysergic', function(num) RegisterServerEvent('md-drugs:server:getlysergic', function(num)
local src = source local src = source
if timedOut[src] then return end if timeOut(src, 'md-drugs:server:getlysergic') then return end
if not ps.checkDistance(src, lsdLocations.lysergicacid[num].loc, 2.0) then if not ps.checkDistance(src, lsdLocations.lysergicacid[num].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") ps.notify(src, ps.lang('Catches.notIn'), "error")
return return
end end
timeout(src, 3000)
ps.addItem(src, 'lysergic_acid', 2) ps.addItem(src, 'lysergic_acid', 2)
end) end)
RegisterServerEvent('md-drugs:server:getdiethylamide', function(num) RegisterServerEvent('md-drugs:server:getdiethylamide', function(num)
local src = source local src = source
if timedOut[src] then return end if timeOut(src, 'md-drugs:server:getdiethylamide') then return end
if not ps.checkDistance(src, lsdLocations.diethylamide[num].loc, 2.0) then if not ps.checkDistance(src, lsdLocations.diethylamide[num].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") ps.notify(src, ps.lang('Catches.notIn'), "error")
return return
end end
timeout(src, 3000)
ps.addItem(src, 'diethylamide', 2) ps.addItem(src, 'diethylamide', 2)
end) end)
@@ -108,6 +96,7 @@ end)
RegisterServerEvent('md-drugs:server:heatliquid', function() RegisterServerEvent('md-drugs:server:heatliquid', function()
local src = source local src = source
if not hasLabKit(src) then return end if not hasLabKit(src) then return end
if timeOut(src, 'md-drugs:server:heatliquid') then return end
if not ps.craftItem(src, lsdRecipes['vial']['heat']) then if not ps.craftItem(src, lsdRecipes['vial']['heat']) then
verifyHas(src, lsdRecipes['vial']['heat'].take) verifyHas(src, lsdRecipes['vial']['heat'].take)
return return
@@ -126,6 +115,7 @@ end)
RegisterServerEvent('md-drugs:server:refinequalityacid', function() RegisterServerEvent('md-drugs:server:refinequalityacid', function()
local src = source local src = source
if not hasLabKit(src) then return end if not hasLabKit(src) then return end
if timeOut(src, 'md-drugs:server:refinequalityacid') then return end
if not ps.hasItem(src, 'lsd_one_vial', 1) then return end if not ps.hasItem(src, 'lsd_one_vial', 1) then return end
if Config.TierSystem then if Config.TierSystem then
local lsd = tonumber(getRep(src, 'lsd')) local lsd = tonumber(getRep(src, 'lsd'))
@@ -170,6 +160,7 @@ end)
RegisterServerEvent('md-drugs:server:gettabpaper', function(num) RegisterServerEvent('md-drugs:server:gettabpaper', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:gettabpaper') then return end
if not ps.checkDistance(src, lsdLocations.gettabs[num].loc, 3.0) then if not ps.checkDistance(src, lsdLocations.gettabs[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") ps.notify(src, ps.lang('Catches.notIn'), "error")
return return
@@ -183,6 +174,7 @@ end)
RegisterServerEvent('md-drugs:server:getlabkit', function(num) RegisterServerEvent('md-drugs:server:getlabkit', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:getlabkit') then return end
if ps.hasItem(src,'lsdlabkit', 1) then if ps.hasItem(src,'lsdlabkit', 1) then
return return
end end
@@ -199,6 +191,7 @@ end)
RegisterServerEvent('md-drugs:server:maketabpaper', function() RegisterServerEvent('md-drugs:server:maketabpaper', function()
local src = source local src = source
if timeOut(src, 'md-drugs:server:maketabpaper') then return end
if not hasLabKit(src) then return end if not hasLabKit(src) then return end
if not ps.hasItem(src,'tab_paper', 1) then return end if not ps.hasItem(src,'tab_paper', 1) then return end
local vialdata = { local vialdata = {
+1
View File
@@ -17,6 +17,7 @@ end)
RegisterNetEvent("md-drugs:server:drymescaline", function(num) RegisterNetEvent("md-drugs:server:drymescaline", function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:drymescaline') then return end
if not ps.checkDistance(src, mescalineLocation.DryOutMescaline[num].loc, 3.0) then if not ps.checkDistance(src, mescalineLocation.DryOutMescaline[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") ps.notify(src, ps.lang('Catches.notIn'), "error")
return return
+3 -2
View File
@@ -87,6 +87,7 @@ end)
RegisterServerEvent('md-drugs:server:getmeth', function(num) RegisterServerEvent('md-drugs:server:getmeth', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:getmeth') then return end
if not ps.checkDistance(src, methLocs.BagMeth[num].loc, 2.5) then if not ps.checkDistance(src, methLocs.BagMeth[num].loc, 2.5) then
ps.notify(src, ps.lang('Catches.notIn'), "error") ps.notify(src, ps.lang('Catches.notIn'), "error")
return return
@@ -103,7 +104,7 @@ RegisterServerEvent('md-drugs:server:geteph', function(num)
ps.notify(src, ps.lang('Catches.notIn'), "error") ps.notify(src, ps.lang('Catches.notIn'), "error")
return return
end end
if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.onCooldown'), "error") end if timeOut(src, 'md-drugs:server:geteph') then return end
ps.addItem(src, 'ephedrine', 1) ps.addItem(src, 'ephedrine', 1)
end) end)
@@ -113,7 +114,7 @@ RegisterServerEvent('md-drugs:server:getace', function(num)
ps.notify(src, ps.lang('Catches.notIn'), "error") ps.notify(src, ps.lang('Catches.notIn'), "error")
return return
end end
if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.onCooldown'), "error") end if timeOut(src, 'md-drugs:server:getace') then return end
ps.addItem(src, 'acetone', 1) ps.addItem(src, 'acetone', 1)
end) end)
+2
View File
@@ -28,6 +28,7 @@ local oxyLocs = {
ps.registerCallback('md-drugs:server:GetOxyLocs', function(source) ps.registerCallback('md-drugs:server:GetOxyLocs', function(source)
return oxyLocs return oxyLocs
end) end)
ps.registerCallback('md-drugs:server:payfortruck', function(source) ps.registerCallback('md-drugs:server:payfortruck', function(source)
local src = source local src = source
if ps.removeMoney(src, 'cash', prices.payfortruck) or ps.removeMoney(src, 'bank', prices.payfortruck) then if ps.removeMoney(src, 'cash', prices.payfortruck) or ps.removeMoney(src, 'bank', prices.payfortruck) then
@@ -43,6 +44,7 @@ end)
RegisterServerEvent('md-drugs:server:giveoxybox', function() RegisterServerEvent('md-drugs:server:giveoxybox', function()
local src = source local src = source
if timeOut(src, 'md-drugs:server:giveoxybox') then return end
if not onRoute[src] then if not onRoute[src] then
ps.notify(src, ps.lang('oxy.notOn'), "error") ps.notify(src, ps.lang('oxy.notOn'), "error")
return return
+1
View File
@@ -56,6 +56,7 @@ end
RegisterServerEvent('md-drugs:server:fillprescription', function(num) RegisterServerEvent('md-drugs:server:fillprescription', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:fillprescription') then return end
if not ps.checkDistance(src, pharmaLocations.FillPrescription[num].loc, 3.5) then if not ps.checkDistance(src, pharmaLocations.FillPrescription[num].loc, 3.5) then
return ps.notify(src, ps.lang('Catches.notIn'), "error") return ps.notify(src, ps.lang('Catches.notIn'), "error")
end end
+2 -5
View File
@@ -18,6 +18,7 @@ local function propsLabels(drugType)
return drugModels[drugType] return drugModels[drugType]
end end
end end
local plants = { local plants = {
cocaine = { cocaine = {
{ location = vector3(1474.25, -2643.87, 42.88), heading = 334.49, model = propsLabels('cocaine'), taken = false }, { location = vector3(1474.25, -2643.87, 42.88), heading = 334.49, model = propsLabels('cocaine'), taken = false },
@@ -123,7 +124,6 @@ local plantData = {
plants.cocaine[loc].taken = false plants.cocaine[loc].taken = false
GlobalState.CocaPlant = plants.cocaine GlobalState.CocaPlant = plants.cocaine
TriggerClientEvent('coke:respawnCane', -1, loc) TriggerClientEvent('coke:respawnCane', -1, loc)
--Log('Coca Plant Respawned At ' .. plants.cocaine[loc].location, 'coke')
end) end)
end, end,
allow = Config.Drugs.cocaine allow = Config.Drugs.cocaine
@@ -143,7 +143,6 @@ local plantData = {
plants.heroin[loc].taken = false plants.heroin[loc].taken = false
GlobalState.PoppyPlants = plants.heroin GlobalState.PoppyPlants = plants.heroin
TriggerClientEvent('heroin:respawnCane', -1, loc) TriggerClientEvent('heroin:respawnCane', -1, loc)
--Log('Heroin Plant Respawned At ' .. plants.heroin[loc].location, 'heroin')
end) end)
end, end,
allow = Config.Drugs.heroin allow = Config.Drugs.heroin
@@ -163,7 +162,6 @@ local plantData = {
plants.mescaline[loc].taken = false plants.mescaline[loc].taken = false
GlobalState.Mescaline = plants.mescaline GlobalState.Mescaline = plants.mescaline
TriggerClientEvent('Mescaline:respawnCane', -1, loc) TriggerClientEvent('Mescaline:respawnCane', -1, loc)
--Log('Mescaline Plant Respawned At ' .. plants.mescaline[loc].location, 'mescaline')
end) end)
end, end,
allow = Config.Drugs.mescaline allow = Config.Drugs.mescaline
@@ -183,7 +181,6 @@ local plantData = {
plants.shrooms[loc].taken = false plants.shrooms[loc].taken = false
GlobalState.shrooms = plants.shrooms GlobalState.shrooms = plants.shrooms
TriggerClientEvent('shrooms:respawnCane', -1, loc) TriggerClientEvent('shrooms:respawnCane', -1, loc)
--Log('Shroom Respawned At ' .. plants.shrooms[loc].location, 'shrooms')
end) end)
end, end,
allow = Config.Drugs.shrooms allow = Config.Drugs.shrooms
@@ -203,7 +200,6 @@ local plantData = {
plants.weed[loc].taken = false plants.weed[loc].taken = false
GlobalState.WeedPlant = plants.weed GlobalState.WeedPlant = plants.weed
TriggerClientEvent('weed:respawnCane', -1, loc) TriggerClientEvent('weed:respawnCane', -1, loc)
--Log('Weed Plant Respawned At ' .. plants.weed[loc].location, 'weed')
end) end)
end, end,
allow = Config.Drugs.weed allow = Config.Drugs.weed
@@ -215,6 +211,7 @@ for k, v in pairs (plantData) do
v.globalState() v.globalState()
RegisterNetEvent(v.label ..":pickupCane", function(loc) RegisterNetEvent(v.label ..":pickupCane", function(loc)
local src = source local src = source
if timeOut(src, v.label .. ":pickupCane") then return end
if ps.checkDistance(src, v.plants[loc].location, 5.0) then if ps.checkDistance(src, v.plants[loc].location, 5.0) then
if not v.plants[loc].taken then if not v.plants[loc].taken then
v.plants[loc].taken = true v.plants[loc].taken = true
+3 -1
View File
@@ -75,6 +75,7 @@ end)
RegisterServerEvent('md-drugs:server:dryoutweed', function() RegisterServerEvent('md-drugs:server:dryoutweed', function()
local src = source local src = source
if timeOut(src, 'md-drugs:server:dryoutweed') then return end
if ps.removeItem(src,"wetcannabis", 1) then if ps.removeItem(src,"wetcannabis", 1) then
ps.addItem(src,"drycannabis", 1) ps.addItem(src,"drycannabis", 1)
else else
@@ -96,6 +97,7 @@ end
RegisterServerEvent('md-drugs:server:MakeWeedItems', function(data) RegisterServerEvent('md-drugs:server:MakeWeedItems', function(data)
local src = source local src = source
if timeOut(src, 'md-drugs:server:MakeWeedItems') then return end
if not ps.craftItem(src, weed[data.table][data.item]) then if not ps.craftItem(src, weed[data.table][data.item]) then
verifyHas(src, weed[data.table][data.item].take) verifyHas(src, weed[data.table][data.item].take)
return return
@@ -126,7 +128,7 @@ end)
ps.createUseable("mdwoods", function(source, item) ps.createUseable("mdwoods", function(source, item)
local src = source local src = source
local check = ps.callback('md-drugs:client:uncuff', src, ps.lang('weed.crackBlunt')) local check = ps.callback('md-drugs:client:uncuff', src, ps.lang('weed.crackBlunt'))
if not check then return end if not check then return end
if ps.removeItem(src, "mdwoods",1 ) then if ps.removeItem(src, "mdwoods",1 ) then
ps.addItem(src, "bluntwrap", 5) ps.addItem(src, "bluntwrap", 5)
+14 -25
View File
@@ -78,15 +78,6 @@ local function craft(source, tbl, item)
end end
local activePresses = {} local activePresses = {}
local timeout = {}
local function timeOut(src)
CreateThread(function()
timeout[ps.getIdentifier(src)] = true
Wait(3000)
timeout[ps.getIdentifier(src)] = nil
end)
end
RegisterServerEvent('md-drugs:server:stealisosafrole', function(num) RegisterServerEvent('md-drugs:server:stealisosafrole', function(num)
local src = source local src = source
@@ -94,11 +85,7 @@ RegisterServerEvent('md-drugs:server:stealisosafrole', function(num)
ps.notify(src, ps.lang('Checks.notIn'), "error") ps.notify(src, ps.lang('Checks.notIn'), "error")
return return
end end
if timeout[ps.getIdentifier(src)] then if timeOut(src, 'md-drugs:server:stealisosafrole') then return end
ps.notify(src, ps.lang('Catches.cooldown'), 'error')
return
end
timeOut(src)
ps.addItem(src, "isosafrole", 1) ps.addItem(src, "isosafrole", 1)
end) end)
@@ -108,11 +95,7 @@ RegisterServerEvent('md-drugs:server:stealmdp2p', function(num)
ps.notify(src, ps.lang('Checks.notIn'), "error") ps.notify(src, ps.lang('Checks.notIn'), "error")
return return
end end
if timeout[ps.getIdentifier(src)] then if timeOut(src, 'md-drugs:server:stealmdp2p') then return end
ps.notify(src, ps.lang('Catches.cooldown'), 'error')
return
end
timeOut(src)
ps.addItem(src, "mdp2p", 1) ps.addItem(src, "mdp2p", 1)
end) end)
@@ -146,6 +129,7 @@ RegisterServerEvent('md-drugs:server:getpressback', function()
local src = source local src = source
if not activePresses[ps.getIdentifier(src)] then return end if not activePresses[ps.getIdentifier(src)] then return end
local press = activePresses[ps.getIdentifier(src)] local press = activePresses[ps.getIdentifier(src)]
if not ps.checkDistance(src, press.loc, 2.0) then return end
ps.addItem(src, press.get, 1) ps.addItem(src, press.get, 1)
activePresses[ps.getIdentifier(src)] = nil activePresses[ps.getIdentifier(src)] = nil
end) end)
@@ -156,11 +140,18 @@ RegisterServerEvent('md-drugs:server:makextc', function(data)
ps.notify(src, ps.lang('xtc.noPressOut'), 'error') ps.notify(src, ps.lang('xtc.noPressOut'), 'error')
return return
end end
if timeOut(src, 'md-drugs:server:makextc') then return end
if not ps.checkDistance(src, activePresses[ps.getIdentifier(src)].loc, 2.0) then return end
craft(src, RecipeList[activePresses[ps.getIdentifier(src)].press][data], data) craft(src, RecipeList[activePresses[ps.getIdentifier(src)].press][data], data)
end) end)
RegisterServerEvent('md-drugs:server:buypress', function() RegisterServerEvent('md-drugs:server:buypress', function(loc, item)
local src = source local src = source
if not ps.checkDistance(src, xtcLocations.xtcpress[loc].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error")
return
end
if timeOut(src, 'md-drugs:server:buypress') then return end
if ps.removeMoney(src,"cash", RecipeList.presses['singlepress'].cash) then if ps.removeMoney(src,"cash", RecipeList.presses['singlepress'].cash) then
ps.addItem(src, "singlepress", 1) ps.addItem(src, "singlepress", 1)
else else
@@ -170,6 +161,7 @@ end)
RegisterServerEvent('md-drugs:server:upgradepress', function(data) RegisterServerEvent('md-drugs:server:upgradepress', function(data)
local src = source local src = source
if timeOut(src, 'md-drugs:server:upgradepress') then return end
if not ps.checkDistance(src, xtcLocations.xtcpress[data].loc, 2.0) then if not ps.checkDistance(src, xtcLocations.xtcpress[data].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") ps.notify(src, ps.lang('Catches.notIn'), "error")
return return
@@ -187,11 +179,7 @@ RegisterServerEvent('md-drugs:server:makingrawxtc', function(num)
ps.notify(src, ps.lang('Checks.notIn'), "error") ps.notify(src, ps.lang('Checks.notIn'), "error")
return return
end end
if timeout[ps.getIdentifier(src)] then if timeOut(src, 'md-drugs:server:makingrawxtc') then return end
ps.notify(src, ps.lang('Catches.cooldown'), 'error')
return
end
timeOut(src)
if not ps.craftItem(src, RecipeList.raw.raw_xtc) then return end if not ps.craftItem(src, RecipeList.raw.raw_xtc) then return end
end) end)
@@ -211,6 +199,7 @@ end
RegisterServerEvent('md-drugs:server:stamp', function(num, color) RegisterServerEvent('md-drugs:server:stamp', function(num, color)
local src = source local src = source
if not ps.checkDistance(src, xtcLocations.stamp[num].loc, 3.0) then return end if not ps.checkDistance(src, xtcLocations.stamp[num].loc, 3.0) then return end
if timeOut(src, 'md-drugs:server:stamp') then return end
local item = getColor(color) local item = getColor(color)
local colors = { local colors = {
white = 'white_xtc', white = 'white_xtc',
+1 -1
View File
@@ -1,6 +1,6 @@
Config = {} --Ignore. Config = {} --Ignore.
ps = exports.ps_lib:init() ps = exports.ps_lib:init()
ps.loadLangs("uwu") ps.loadLangs("en")
Config.respawnTime = 100 -- Seconds Config.respawnTime = 100 -- Seconds
Config.Fuel = "LegacyFuel" -- type the name of script you use i.e. ps-fuel, cdn-fuel, LegacyFuel, ox_fuel Config.Fuel = "LegacyFuel" -- type the name of script you use i.e. ps-fuel, cdn-fuel, LegacyFuel, ox_fuel