big update. i prob broke something, let me know in discord

This commit is contained in:
Mustache Dom authored and GitHub committed 2024-09-24 15:07:41 -07:00
1 parent 009b0a4f4a
commit 028c5f771f
42 files changed
+2042 -3056

No files matched your search

+72 -114
View File
@@ -1,155 +1,115 @@
local QBCore = exports['qb-core']:GetCoreObject()
RegisterServerEvent('md-drugs:server:getlysergic', function(num)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local playerPed = GetPlayerPed(source)
if CheckDist(source, playerPed, Config.lysergicacid[num]['loc']) then return end
if AddItem('lysergic_acid', 2) then
Notifys(Lang.lsd.lys, "success")
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got Lysergic acid with a distance of ' .. dist(source, playerPed, Config.lysergicacid[num]['loc']) .. '!', 'lsd')
local src = source
if CheckDist(src, Config.lysergicacid[num]['loc']) then return end
if AddItem(src,'lysergic_acid', 2) then
Log(GetName(src) ..' Got Lysergic acid with a distance of ' .. dist(source, Config.lysergicacid[num]['loc']) .. '!', 'lsd')
end
end)
RegisterServerEvent('md-drugs:server:getdiethylamide', function(num)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local playerPed = GetPlayerPed(source)
if CheckDist(source, playerPed, Config.diethylamide[num]['loc']) then return end
if AddItem('diethylamide', 2) then
Notifys(Lang.lsd.die, "success")
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got Diethylamide with a distance of ' .. dist(source, playerPed, Config.diethylamide[num]['loc']) .. '!', 'lsd')
if CheckDist(src, Config.diethylamide[num]['loc']) then return end
if AddItem(src,'diethylamide', 2) then
Log(GetName(src) ..' Got Diethylamide with a distance of ' .. dist(source, Config.diethylamide[num]['loc']) .. '!', 'lsd')
end
end)
QBCore.Functions.CreateUseableItem('lsdlabkit', function(source, item)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local playerPed = GetPlayerPed(src)
if TriggerClientEvent("md-drugs:client:setlsdlabkit", src) then
Player.Functions.RemoveItem("lsdlabkit", 1)
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Placed Their LSD Lab Kit Back At ' .. GetEntityCoords(playerPed) .. '!', 'lsd')
RemoveItem(src, "lsdlabkit", 1)
Log(GetName(src) ..' Placed Their LSD Lab Kit Back At ' .. GetCoords(src) .. '!', 'lsd')
end
end)
end)
RegisterServerEvent('md-drugs:server:removecleaningkit', function(data)
lib.callback.register('md-drugs:server:removecleaningkit', function(source)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Itemcheck(Player, 'cleaningkit', 1, 'true') then return end
if RemoveItem("cleaningkit", 1) then
Notifys(Lang.lsd.cleaned, "success")
TriggerClientEvent("md-drugs:client:resetlsdkit", src, data)
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Wiped Down Their LSD Lab Kit!' , 'lsd')
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)
RegisterServerEvent('md-drugs:server:getlabkitback', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local playerPed = GetPlayerPed(src)
if AddItem("lsdlabkit", 1) then
Notifys('You Got Your Lab Kit Back', 'success')
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked Up Their LSD Lab Kit Back At ' .. GetEntityCoords(playerPed) .. '!', 'lsd')
if AddItem(src,"lsdlabkit", 1) then
Log(GetName(src) ..' Picked Up Their LSD Lab Kit Back At ' .. GetCoords(src) .. '!', 'lsd')
end
end)
RegisterServerEvent('md-drugs:server:heatliquid', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Itemcheck(Player, 'lysergic_acid', 1, 'true') then return end
if not Itemcheck(Player, 'diethylamide', 1, 'true') then return end
RemoveItem('diethylamide', 1)
RemoveItem('lysergic_acid', 1)
AddItem('lsd_one_vial', 1)
Notifys(Lang.lsd.madelsd, "success")
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Heated Basic LSD!', 'lsd')
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
local Player = QBCore.Functions.GetPlayer(src)
RemoveItem('diethylamide', 1)
RemoveItem('lysergic_acid', 1)
Notifys(Lang.lsd.failed, "error")
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Failed Basic LSD Like An Idiot!', 'lsd')
if not ChecknRemove(source, {lysergic_acid = 1, diethylamide = 1}) then return end
Notifys(src,Lang.lsd.failed, "error")
Log(GetName(src) ..' Failed Basic LSD Like An Idiot!', 'lsd')
end)
RegisterServerEvent('md-drugs:server:refinequalityacid', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local randomchance = math.random(1,100)
if not Itemcheck(Player, 'lsd_one_vial', 1, 'true') then return end
if not Itemcheck(src, 'lsd_one_vial', 1) then return end
if Config.TierSystem then
local lsd = Player.PlayerData.metadata['lsd']
if RemoveItem('lsd_one_vial', 1) then
local lsd = getRep(src, 'lsd')
if RemoveItem(src, 'lsd_one_vial', 1) then
if lsd <= 30 then
AddItem('lsd_vial_two', 1)
Notifys(Lang.lsd.refined, "Success")
AddItem(src,'lsd_vial_two', 1)
elseif lsd >= 31 and lsd <= 60 then
AddItem('lsd_vial_three', 1)
Notifys(Lang.lsd.refined, "Success")
AddItem(src,'lsd_vial_three', 1)
elseif lsd >= 61 and lsd <= 90 then
AddItem('lsd_vial_four', 1)
Notifys(Lang.lsd.refined, "Success")
AddItem(src,'lsd_vial_four', 1)
elseif lsd >= 91 and lsd <= 120 then
AddItem('lsd_vial_five', 1)
Notifys(Lang.lsd.refined, "Success")
AddItem(src,'lsd_vial_five', 1)
else
AddItem('lsd_vial_six', 1)
Notifys(Lang.lsd.refined, "Success")
AddItem(src,'lsd_vial_six', 1)
end
Player.Functions.SetMetaData('lsd', (lsd + 1))
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Refined Acid and Now Has A Rep Of ' .. lsd + 1 .. '!', 'lsd')
AddRep(src,'lsd')
Log(GetName(src) ..' Refined Acid and Now Has A Rep Of ' .. lsd + 1 .. '!', 'lsd')
end
else
if RemoveItem('lsd_one_vial', 1) then
if RemoveItem(src,'lsd_one_vial', 1) then
if randomchance <= 60 then
AddItem('lsd_vial_two', 1)
Notifys(Lang.lsd.refined, "Success")
AddItem(src,'lsd_vial_two', 1)
elseif randomchance >= 61 and randomchance <= 75 then
AddItem('lsd_vial_three', 1)
Notifys(Lang.lsd.refined, "Success")
AddItem(src,'lsd_vial_three', 1)
elseif randomchance >= 76 and randomchance <= 85 then
AddItem('lsd_vial_four', 1)
Notifys(Lang.lsd.refined, "Success")
AddItem(src,'lsd_vial_four', 1)
elseif randomchance >= 86 and randomchance <= 93 then
AddItem('lsd_vial_five', 1)
Notifys(Lang.lsd.refined, "Success")
AddItem(src,'lsd_vial_five', 1)
else
AddItem('lsd_vial_six', 1)
Notifys(Lang.lsd.refined, "Success")
AddItem(src,'lsd_vial_six', 1)
end
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Refined Acid!', 'lsd')
Log(GetName(src) ..' Refined Acid!', 'lsd')
end
end
end)
RegisterServerEvent('md-drugs:server:failrefinequality', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local randomchance = math.random(1,100)
if not Itemcheck(Player, 'lsd_one_vial', 1, 'true') then return end
if RemoveItem('lsd_one_vial', 1) then
Player.Functions.SetMetaData('lsd', (Player.PlayerData.metadata.lsd - 1))
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Failed A Refinement And Now Has A Rep Of ' .. Player.PlayerData.metadata.lsd - 1 .. '!', 'lsd')
if Player.PlayerData.metadata.lsd < 0 then Player.Functions.SetMetaData('lsd', 0) end
end
local src = source
if not Itemcheck(src, 'lsd_one_vial', 1) then return end
RemoveItem('lsd_one_vial', 1)
end)
RegisterServerEvent('md-drugs:server:gettabpaper', function(num)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local playerPed = GetPlayerPed(source)
if CheckDist(source, playerPed, Config.gettabs[num]['loc']) then return end
if CheckDist(source, Config.gettabs[num]['loc']) then return end
if Player.Functions.RemoveMoney('cash', Config.tabcost * 10) then
AddItem('tab_paper', 10)
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bought Tab Paper!', 'lsd')
AddItem(src,'tab_paper', 10)
Log(GetName(src) ..' Bought Tab Paper!', 'lsd')
else
Notifys(Lang.lsd.broke, "error")
end
@@ -158,13 +118,12 @@ end)
RegisterServerEvent('md-drugs:server:getlabkit', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local playerPed = GetPlayerPed(source)
if CheckDist(source, playerPed, vector3(Config.buylsdlabkit.x, Config.buylsdlabkit.y, Config.buylsdlabkit.z)) then return end
if CheckDist(source, vector3(Config.buylsdlabkit.x, Config.buylsdlabkit.y, Config.buylsdlabkit.z)) then return end
if Player.Functions.RemoveMoney('cash', Config.lsdlabkitcost) then
AddItem('lsdlabkit', 1)
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bought A LSD Lab Kit!', 'lsd')
AddItem(src,'lsdlabkit', 1)
Log(GetName(src) ..' Bought A LSD Lab Kit!', 'lsd')
else
Notifys(Lang.lsd.broke, "error")
Notifys(src, Lang.lsd.broke, "error")
end
end)
@@ -174,31 +133,31 @@ end)
RegisterServerEvent('md-drugs:server:maketabpaper', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Itemcheck(Player, 'tab_paper', 1, 'true') then return end
if Player.Functions.RemoveItem('lsd_one_vial', 1) then
RemoveItem('tab_paper', 1)
AddItem('smileyfacesheet', 1)
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Smiley Face Sheet', 'lsd')
if not Itemcheck(src,'tab_paper', 1) then return end
if RemoveItem(src,'lsd_one_vial', 1) then
RemoveItem(src,'tab_paper', 1)
AddItem(src,'smileyfacesheet', 1)
Log(GetName(src) ..' Made A Smiley Face Sheet', 'lsd')
elseif Player.Functions.RemoveItem('lsd_vial_two', 1) then
RemoveItem('tab_paper', 1)
AddItem('wildcherrysheet', 1)
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Wild Cherry Sheet', 'lsd')
RemoveItem(src,'tab_paper', 1)
AddItem(src,'wildcherrysheet', 1)
Log(GetName(src) ..' Made A Wild Cherry Sheet', 'lsd')
elseif Player.Functions.RemoveItem('lsd_vial_three', 1) then
RemoveItem('tab_paper', 1)
AddItem('yinyangsheet', 1)
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Yin Yang Sheet', 'lsd')
RemoveItem(src,'tab_paper', 1)
AddItem(src,'yinyangsheet', 1)
Log(GetName(src) ..' Made A Yin Yang Sheet', 'lsd')
elseif Player.Functions.RemoveItem('lsd_vial_four', 1) then
RemoveItem('tab_paper', 1)
AddItem('pineapplesheet', 1)
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Pine Apple Sheet', 'lsd')
RemoveItem(src,'tab_paper', 1)
AddItem(src,'pineapplesheet', 1)
Log(GetName(src) ..' Made A Pine Apple Sheet', 'lsd')
elseif Player.Functions.RemoveItem('lsd_vial_five', 1) then
RemoveItem('tab_paper', 1)
AddItem('bartsheet', 1)
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Cluckin Bell Sheet', 'lsd')
RemoveItem(src,'tab_paper', 1)
AddItem(src,'bartsheet', 1)
Log(GetName(src) ..' Made A Cluckin Bell Sheet', 'lsd')
elseif Player.Functions.RemoveItem('lsd_vial_six', 1) then
RemoveItem('tab_paper', 1)
AddItem('gratefuldeadsheet', 1)
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Maze Sheet', 'lsd')
RemoveItem(src,'tab_paper', 1)
AddItem(src,'gratefuldeadsheet', 1)
Log(GetName(src) ..' Made A Maze Sheet', 'lsd')
else
Notifys(Lang.lsd.novial, "error")
end
@@ -218,10 +177,9 @@ for k, v in pairs (sheets) do
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local math = math.random(1,10)
if Player.Functions.RemoveItem(v.item, 1) then
Player.Functions.AddItem(v.recieve, math)
TriggerClientEvent("inventory:client:ItemBox", src, QBCore.Shared.Items[v.recieve], "add", math )
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made ' .. math .. 'Tabs of ' .. v.recieve .. '!', 'lsd')
if RemoveItem(src, v.item, 1) then
AddItem(src, v.recieve, math)
Log(GetName(src) ..' Made ' .. math .. 'Tabs of ' .. v.recieve .. '!', 'lsd')
end
end)
end