From 48d5c6928a074af67a91af67585aae70c9a75ef2 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Sun, 21 Jul 2024 21:45:06 -0700 Subject: [PATCH] Add files via upload --- server/functions.lua | 37 ++++++++++++++++++++++++++++++++++--- server/weed.lua | 12 ++++++++---- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/server/functions.lua b/server/functions.lua index 235af19..688e938 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -53,12 +53,13 @@ end end) function Notifys(text, type) + local src = source if notify == 'qb' then - TriggerClientEvent("QBCore:Notify", source, text, type) + TriggerClientEvent("QBCore:Notify", src, text, type) elseif notify == 'ox' then - lib.notify(source, { title = text, type = type}) + lib.notify(src, { title = text, type = type}) elseif notify == 'okok' then - TriggerClientEvent('okokNotify:Alert', source, '', text, 4000, type, false) + TriggerClientEvent('okokNotify:Alert', src, '', text, 4000, type, false) else print"dude, it literally tells you what to put in the config" end @@ -119,6 +120,36 @@ function AddItem(item, amount) end end +function Notifysu(text, type, source) + + if notify == 'qb' then + TriggerClientEvent("QBCore:Notify", source, text, type) + elseif notify == 'ox' then + lib.notify(source, { title = text, type = type}) + elseif notify == 'okok' then + TriggerClientEvent('okokNotify:Alert', source, '', text, 4000, type, false) + else + print"dude, it literally tells you what to put in the config" + end +end + +function RemoveItemu( item, amount, source) + local Player = QBCore.Functions.GetPlayer(source) + if Player.Functions.RemoveItem(item, amount) then TriggerClientEvent(invname ..":client:ItemBox", source, QBCore.Shared.Items[item], "remove", amount) return true + else + Notifysu('You Need ' .. amount .. ' Of ' .. QBCore.Shared.Items[item].label .. ' To Do This', 'error', source) + end +end + +function AddItemu(item, amount, source) + local Player = QBCore.Functions.GetPlayer(source) + if Player.Functions.AddItem(item, amount) then TriggerClientEvent(invname ..":client:ItemBox", source, QBCore.Shared.Items[item], "add", amount) return true + else + print('you sucks') + end +end + + lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args) local amount = 0 local players = QBCore.Functions.GetQBPlayers() diff --git a/server/weed.lua b/server/weed.lua index f4919b1..5854cd6 100644 --- a/server/weed.lua +++ b/server/weed.lua @@ -229,7 +229,7 @@ QBCore.Functions.CreateUseableItem("leanbluntwrap", function(source, item) local src = source local Player = QBCore.Functions.GetPlayer(src) local keef = Player.Functions.GetItemByName("grindedweed") - + if keef and keef.amount > 0 then if Player.Functions.RemoveItem('grindedweed', 1) then TriggerClientEvent("md-drugs:client:rollanim", src) @@ -259,7 +259,7 @@ local keef = Player.Functions.GetItemByName("grindedweed") TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['dextrobluntwrap'], "remove", 1) end else - + Notifysu('You Need Keef', 'error', src) end end) @@ -268,12 +268,13 @@ local src = source local Player = QBCore.Functions.GetPlayer(src) if Player.Functions.GetItemByName("butanetorch") then - if Player.Functions.RemoveItem("shatter", 1) then - TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["shatter"], "remove", 1) + if RemoveItemu("shatter", 1, src) then + Notifysu('test', 'success', src) TriggerClientEvent("md-drugs:client:dodabs", src) end end end) + QBCore.Functions.CreateUseableItem("bluntwrap", function(source, item) local src = source local Player = QBCore.Functions.GetPlayer(src) @@ -283,10 +284,13 @@ end) QBCore.Functions.CreateUseableItem("weedgrinder", function(source, item) local src = source local Player = QBCore.Functions.GetPlayer(src) + if Player.Functions.RemoveItem("drycannabis",1 ) then Player.Functions.AddItem("grindedweed", 1) TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["grindedweed"], "add", 1) TriggerClientEvent("md-drugs:client:grind", src) +else + Notifysu('You Need Dried Weed', 'error', src) end end)