- holy fuck a lot
This commit is contained in:
1 parent
94c6458037
commit
2fd900ec22
33 files changed
+680
-910
No files matched your search
+60
-19
@@ -1,27 +1,68 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local onRun = {}
|
||||
|
||||
local function setTimeout(identifier)
|
||||
if onRun[identifier] then
|
||||
CreateThread(function()
|
||||
Wait(10 * 60 * 1000)
|
||||
onRun[identifier] = nil
|
||||
end)
|
||||
end
|
||||
end
|
||||
RegisterServerEvent('md-drugs:server:givelean', function()
|
||||
local chance = math.random(1,100)
|
||||
local src = source
|
||||
local amount = math.random(1,5)
|
||||
if chance <= 50 then
|
||||
if AddItem(source, 'mdlean', amount) then
|
||||
Notifys(Lang.Lean.lean, "success")
|
||||
Log(GetName(source) .. ' Got ' .. amount .. ' Of Lean' , 'lean')
|
||||
end
|
||||
if not onRun[ps.getIdentifier(src)] then return ps.notify(src, Lang.lean.err, "error") end
|
||||
onRun[ps.getIdentifier(src)] = onRun[ps.getIdentifier(src)] + 1
|
||||
if math.random(1,100) <= 50 then
|
||||
ps.addItem(src, "mdlean", amount)
|
||||
else
|
||||
if AddItem(source, 'mdreddextro', amount) then
|
||||
Notifys(Lang.Lean.dextro, "success")
|
||||
Log(GetName(source) .. ' Got ' .. amount .. ' Of Red Dextro' , 'lean')
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
CUI('leancup', function(source, item)
|
||||
if Itemcheck(source, 'leancup', 1) then
|
||||
TriggerClientEvent('md-drugs:client:leancraft', source)
|
||||
ps.addItem(src, "mdreddextro", amount)
|
||||
end
|
||||
if onRun[ps.getIdentifier(src)] >= 4 then
|
||||
onRun[ps.getIdentifier(src)] = nil
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:finishcup', function(data)
|
||||
if not GetRecipe(source, 'lean','cups', data.item) then return end
|
||||
exports.ps_lib:registerCrafter({
|
||||
loc = GlobalState.MDDrugsLocs.MakeLean,
|
||||
recipes = {
|
||||
cupoflean = {
|
||||
amount = 1,
|
||||
time = 5000,
|
||||
anim = 'uncuff',
|
||||
recipe = {
|
||||
leancup = 1,
|
||||
mdlean = 1,
|
||||
sprunk = 1
|
||||
}
|
||||
},
|
||||
cupofdextro = {
|
||||
amount = 1,
|
||||
time = 5000,
|
||||
anim = 'uncuff',
|
||||
recipe = {
|
||||
leancup = 1,
|
||||
mdreddextro = 1,
|
||||
sprunk = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
targetData = {
|
||||
size = {height = 1.0, width = 1.0, length = 1.0, rotation = 180.0},
|
||||
label = 'Make Lean',
|
||||
icon = 'fa-solid fa-mug-saucer',
|
||||
},
|
||||
})
|
||||
|
||||
ps.registerCallback('md-drugs:server:RegisterLean', function(source)
|
||||
local identifier = ps.getIdentifier(source)
|
||||
if not identifier then return false end
|
||||
if onRun[identifier] then
|
||||
return false
|
||||
else
|
||||
onRun[identifier] = 0
|
||||
setTimeout(identifier)
|
||||
return true
|
||||
end
|
||||
end)
|
||||
Reference in new issue
Block a user