big update. i prob broke something, let me know in discord
This commit is contained in:
1 parent
009b0a4f4a
commit
028c5f771f
42 files changed
+2042
-3056
No files matched your search
+50
-79
@@ -21,130 +21,101 @@ end
|
||||
|
||||
RegisterNetEvent("coke:pickupCane")
|
||||
AddEventHandler("coke:pickupCane", function(loc)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
|
||||
if CheckDist(source, playerPed, Config.CocaPlant[loc].location) then return end
|
||||
local src = source
|
||||
if CheckDist(src, Config.CocaPlant[loc].location) then return end
|
||||
if not Config.CocaPlant[loc].taken then
|
||||
Config.CocaPlant[loc].taken = true
|
||||
GlobalState.CocaPlant = Config.CocaPlant
|
||||
TriggerClientEvent("coke:removeCane", -1, loc)
|
||||
CaneCooldown(loc)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
AddItem('coca_leaf', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked A Coca Leaf With a distance of ' .. dist(source, playerPed, Config.CocaPlant[loc].location) .. ' vectors', 'coke')
|
||||
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)
|
||||
|
||||
|
||||
RegisterServerEvent('md-drugs:server:makepowder', function(num)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.MakePowder[num]['loc']) then return end
|
||||
if not Itemcheck(Player, 'coca_leaf', 1, 'true') then return end
|
||||
if CheckDist(src, Config.MakePowder[num]['loc']) then return end
|
||||
if Config.TierSystem then
|
||||
local coke = Player.PlayerData.metadata['coke']
|
||||
local coke = getRep(src, 'coke')
|
||||
if coke <= Config.Tier1 then
|
||||
if RemoveItem("coca_leaf", 1) then
|
||||
AddItem("coke", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Raw Coke' .. dist(source, playerPed, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
|
||||
end
|
||||
if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier1') then return end
|
||||
Log(GetName(src) .. ' Made Raw Coke' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
|
||||
elseif coke >= Config.Tier1 and coke <= Config.Tier2 then
|
||||
if RemoveItem("coca_leaf", 1) then
|
||||
AddItem("cokestagetwo", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Raw Coke tier 2' .. dist(source, playerPed, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
|
||||
end
|
||||
|
||||
if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier2') then return end
|
||||
Log(GetName(src) .. ' Made Raw Coke tier 2' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
|
||||
else
|
||||
if RemoveItem("coca_leaf", 1) then
|
||||
AddItem("cokestagethree", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Raw Coke tier 3' .. dist(source, playerPed, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
|
||||
end
|
||||
if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier3') then return end
|
||||
Log(GetName(src) ..' Made Raw Coke tier 3' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
|
||||
end
|
||||
else
|
||||
if RemoveItem("coca_leaf", 1) then
|
||||
AddItem("coke", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Raw Coke' .. dist(source, playerPed, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
|
||||
end
|
||||
end
|
||||
if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier1') then return end
|
||||
Log(GetName(src) .. ' Made Raw Coke' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterServerEvent('md-drugs:server:cutcokeone', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if not Itemcheck(Player,'bakingsoda', 1, 'true') then return end
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if Config.TierSystem then
|
||||
local coke = Player.Functions.GetItemByName('coke')
|
||||
local coke2 = Player.Functions.GetItemByName('cokestagetwo')
|
||||
local coke3 = Player.Functions.GetItemByName('cokestagethree')
|
||||
if coke then
|
||||
RemoveItem('coke', 1 )
|
||||
RemoveItem('bakingsoda', 1 )
|
||||
AddItem('loosecoke', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Coke', 'coke')
|
||||
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end
|
||||
Log(GetName(src) .. ' Cut Coke', 'coke')
|
||||
elseif coke2 then
|
||||
RemoveItem('cokestagetwo', 1 )
|
||||
RemoveItem('bakingsoda', 1 )
|
||||
AddItem('loosecokestagetwo', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Coke tier 2', 'coke')
|
||||
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier2') then return end
|
||||
Log(GetName(src) .. ' Cut Coke tier 2', 'coke')
|
||||
elseif coke3 then
|
||||
RemoveItem('cokestagethree', 1 )
|
||||
RemoveItem('bakingsoda', 1 )
|
||||
AddItem('loosecokestagethree', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Coke tier 3', 'coke')
|
||||
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier3') then return end
|
||||
Log(GetName(src) .. ' Cut Coke tier 3', 'coke')
|
||||
else
|
||||
Notifys(Lang.Coke.nocutcoke, "error")
|
||||
Notifys(src,Lang.Coke.nocutcoke, "error")
|
||||
end
|
||||
else
|
||||
if RemoveItem('coke', 1 ) then
|
||||
RemoveItem('bakingsoda', 1 )
|
||||
AddItem('loosecoke', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Coke', 'coke')
|
||||
else
|
||||
Notifys(Lang.Coke.nocutcoke, "error")
|
||||
end
|
||||
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end
|
||||
Log(GetName(src) .. ' Cut Coke', 'coke')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:bagcoke', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if not Itemcheck(Player, 'empty_weed_bag', 1, 'true') then return end
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if Config.TierSystem then
|
||||
local coke = Player.PlayerData.metadata['coke']
|
||||
local coke = getRep(source, 'coke')
|
||||
local locoke = Player.Functions.GetItemByName('loosecoke')
|
||||
local locoke2 = Player.Functions.GetItemByName('loosecokestagetwo')
|
||||
local locoke3 = Player.Functions.GetItemByName('loosecokestagethree')
|
||||
if locoke then
|
||||
RemoveItem('loosecoke', 1 )
|
||||
RemoveItem('empty_weed_bag', 1)
|
||||
AddItem('cokebaggy', 1)
|
||||
Player.Functions.SetMetaData('coke', (coke + 1))
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Coke and now has a rep of ' .. coke + 1, 'coke')
|
||||
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end
|
||||
AddRep(src, 'coke')
|
||||
Log(GetName(src) .. ' Bagged Coke and now has a rep of ' .. coke + 1, 'coke')
|
||||
elseif locoke2 then
|
||||
RemoveItem('loosecokestagetwo', 1 )
|
||||
RemoveItem('empty_weed_bag', 1)
|
||||
AddItem('cokebaggystagetwo', 1)
|
||||
Player.Functions.SetMetaData('coke', (coke + 1))
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Coke tier 2 and now has a rep of ' .. coke + 1, 'coke')
|
||||
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end
|
||||
AddRep(src, 'coke')
|
||||
Log(GetName(src) .. ' Bagged Coke tier 2 and now has a rep of ' .. coke + 1, 'coke')
|
||||
elseif locoke3 then
|
||||
RemoveItem('loosecokestagethree', 1 )
|
||||
RemoveItem('empty_weed_bag', 1)
|
||||
AddItem('cokebaggystagethree', 1)
|
||||
Player.Functions.SetMetaData('coke', (coke + 1))
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Coke tier 3 and now has a rep of ' .. coke + 1, 'coke')
|
||||
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier3') then return end
|
||||
AddRep(src, 'coke')
|
||||
Log(GetName(source) .. ' Bagged Coke tier 3 and now has a rep of ' .. coke + 1, 'coke')
|
||||
else
|
||||
Notifys(Lang.Coke.nobagcoke, "error")
|
||||
Notifys(src, Lang.Coke.nobagcoke, "error")
|
||||
end
|
||||
else
|
||||
if RemoveItem('loosecoke', 1 ) then
|
||||
RemoveItem('empty_weed_bag', 1)
|
||||
AddItem('cokebaggy', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Coke', 'coke')
|
||||
else
|
||||
Notifys(Lang.Coke.nobagcoke, "error")
|
||||
end
|
||||
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end
|
||||
Log(GetName(source) .. ' Bagged Coke', 'coke')
|
||||
end
|
||||
end)
|
||||
|
||||
local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3}
|
||||
for k, v in pairs (cokecut) do
|
||||
QBCore.Functions.CreateUseableItem(k, function(source, item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if Player.Functions.GetItemByName(item.name) then
|
||||
if not Itemcheck(src, 'bakingsoda', 1) then return end
|
||||
TriggerClientEvent('md-drugs:client:minusTier', src, {type = 'coke', xt = 'bakingsoda', item = k, amount = v,recieve = 'loosecoke'})
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -15,9 +15,8 @@ end
|
||||
|
||||
RegisterNetEvent('md-drugs:server:removeconsum', function(item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
Player.Functions.RemoveItem(item, 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got High With ' .. item .. '!', 'consuming')
|
||||
RemoveItem(source,item, 1)
|
||||
Log(GetName(source) .. ' Got High With ' .. item .. '!', 'consuming')
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
|
||||
|
||||
+11
-25
@@ -1,21 +1,22 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local StolenDrugs = {}
|
||||
|
||||
lib.callback.register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, cb)
|
||||
local AvailableDrugs = {}
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if not Player then return nil end
|
||||
local type = 0
|
||||
for k in pairs(QBConfig.DrugsPrice) do
|
||||
for k, v in pairs(QBConfig.DrugsPrice) do
|
||||
local item = Player.Functions.GetItemByName(k)
|
||||
if item and type == 0 then
|
||||
type = type + 1
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Allowed To Sell ' .. item.name .. '!' , 'cornerselling')
|
||||
return item.name, item.amount
|
||||
Log(GetName(source) .. ' Allowed To Sell ' .. item.name .. '!' , 'cornerselling')
|
||||
local amount = math.random(1,item.amount)
|
||||
if amount >= 15 then amount = 15 end
|
||||
local price = math.random(QBConfig.DrugsPrice[k]['min'], QBConfig.DrugsPrice[k]['max']) * amount
|
||||
return item.name, amount, price
|
||||
end
|
||||
end
|
||||
if type == 0 then
|
||||
return 'nothing', 0
|
||||
return 'nothing', 0, 0
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -23,9 +24,8 @@ end)
|
||||
RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if RemoveItem(item, amount) then
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Sold ' .. amount .. ' Of ' .. item .. ' For A Price Of ' .. price .. '!' , 'cornerselling')
|
||||
if RemoveItem(src, item, amount) then
|
||||
Log(GetName(src) .. ' Sold ' .. amount .. ' Of ' .. item .. ' For A Price Of ' .. price .. '!' , 'cornerselling')
|
||||
if QBConfig.MarkedBills then
|
||||
if price >= QBConfig.DrugsPrice[item]['min'] * amount and price <= QBConfig.DrugsPrice[item]['max'] * amount then
|
||||
local info = {
|
||||
@@ -34,27 +34,13 @@ RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price
|
||||
Player.Functions.AddItem('markedbills', 1, false, info )
|
||||
end
|
||||
elseif QBConfig.CustomDirtyMoney then
|
||||
Player.Functions.AddItem(QBConfig.CustomDirtyMoneyitem,price)
|
||||
AddItem(src, QBConfig.CustomDirtyMoneyitem, price)
|
||||
else
|
||||
Player.Functions.AddMoney('cash', price)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:server:robCornerDrugs', function(drugType, amount)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local availableDrugs = getAvailableDrugs(src)
|
||||
|
||||
if not availableDrugs or not Player then return end
|
||||
|
||||
local item = availableDrugs[drugType].item
|
||||
|
||||
Player.Functions.RemoveItem(item, amount)
|
||||
table.insert(StolenDrugs, {item = item, amount = amount})
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove", amount)
|
||||
TriggerClientEvent('md-drugs:client:refreshAvailableDrugs', src, getAvailableDrugs(src))
|
||||
end)
|
||||
lib.addCommand('cornersell', {
|
||||
help = 'Sell Things On The Corner',
|
||||
params = {
|
||||
@@ -63,6 +49,6 @@ lib.addCommand('cornersell', {
|
||||
}, function(source, args, raw)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Used Command cornersell!' , 'cornerselling')
|
||||
Log(GetName(source) .. ' Used Command cornersell!' , 'cornerselling')
|
||||
TriggerClientEvent('md-drugs:client:cornerselling', src)
|
||||
end)
|
||||
+33
-55
@@ -4,85 +4,63 @@ local QBCore = exports['qb-core']:GetCoreObject()
|
||||
RegisterServerEvent('md-drugs:server:makecrackone', function(num)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.makecrack[num]['loc']) then end
|
||||
if not Itemcheck(Player, 'bakingsoda', 1, 'true') then return end
|
||||
if CheckDist(src, Config.makecrack[num]['loc']) then return end
|
||||
if Config.TierSystem then
|
||||
local locoke = Player.Functions.GetItemByName('loosecoke')
|
||||
local locoke2 = Player.Functions.GetItemByName('loosecokestagetwo')
|
||||
local locoke3 = Player.Functions.GetItemByName('loosecokestagethree')
|
||||
if locoke then
|
||||
RemoveItem('loosecoke', 1 )
|
||||
RemoveItem('bakingsoda', 1)
|
||||
AddItem('crackrock', 1)
|
||||
Notifys(Lang.Crack.makecrack, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Crack', 'crack')
|
||||
if not GetRecipe(src, 'crack', 'cookcrack', 'tier1') then return end
|
||||
Log(GetName(src) .. ' Cut Crack', 'crack')
|
||||
elseif locoke2 then
|
||||
RemoveItem('loosecokestagetwo', 1 )
|
||||
RemoveItem('bakingsoda', 1)
|
||||
AddItem('crackrockstagetwo', 1)
|
||||
Notifys(Lang.Crack.makecrack, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Crack', 'crack')
|
||||
if not GetRecipe(src, 'crack', 'cookcrack', 'tier2') then return end
|
||||
Log(GetName(src) .. ' Cut Crack', 'crack')
|
||||
elseif locoke3 then
|
||||
RemoveItem('loosecokestagethree', 1 )
|
||||
RemoveItem('bakingsoda', 1)
|
||||
AddItem('crackrockstagethree', 1)
|
||||
Notifys(Lang.Crack.makecrack, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Crack', 'crack')
|
||||
if not GetRecipe(src, 'crack', 'cookcrack', 'tier3') then return end
|
||||
Log(GetName(src) .. ' Cut Crack', 'crack')
|
||||
else
|
||||
Notifys(Lang.Crack.nocoke, 'error')
|
||||
Notifys(src,Lang.Crack.nocoke, 'error')
|
||||
end
|
||||
else
|
||||
if RemoveItem('loosecoke', 1 ) then
|
||||
RemoveItem('bakingsoda', 1)
|
||||
AddItem('crackrock', 1)
|
||||
Notifys(Lang.Crack.makecrack, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Crack', 'crack')
|
||||
else
|
||||
Notifys(Lang.Crack.nocoke, 'error')
|
||||
end
|
||||
if not GetRecipe(src, 'crack', 'cookcrack', 'tier1') then return end
|
||||
Log(GetName(src) .. ' Cut Crack', 'crack')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:bagcrack', function(num)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.bagcrack[num]['loc']) then return end
|
||||
if not Itemcheck(Player, 'empty_weed_bag', 1, 'true') then return end
|
||||
if CheckDist(src, Config.bagcrack[num]['loc']) then return end
|
||||
if Config.TierSystem then
|
||||
local rock = Player.Functions.GetItemByName('crackrock')
|
||||
local rock2 = Player.Functions.GetItemByName('crackrockstagetwo')
|
||||
local rock3 = Player.Functions.GetItemByName('crackrockstagethree')
|
||||
if rock then
|
||||
RemoveItem('crackrock', 1 )
|
||||
RemoveItem('empty_weed_bag', 1)
|
||||
AddItem('baggedcracked', 1)
|
||||
Notifys(Lang.Crack.makecrack, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Crack', 'crack')
|
||||
if not GetRecipe(src, 'crack', 'bagcrack', 'tier1') then return end
|
||||
Log(GetName(src) .. ' Bagged Crack', 'crack')
|
||||
elseif rock2 then
|
||||
RemoveItem('crackrockstagetwo', 1 )
|
||||
RemoveItem('empty_weed_bag', 1)
|
||||
AddItem('baggedcrackedstagetwo', 1)
|
||||
Notifys(Lang.Crack.makecrack, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Crack', 'crack')
|
||||
if not GetRecipe(src, 'crack', 'bagcrack', 'tier2') then return end
|
||||
Log(GetName(src) .. ' Bagged Crack', 'crack')
|
||||
elseif rock3 then
|
||||
RemoveItem('crackrockstagethree', 1 )
|
||||
RemoveItem('empty_weed_bag', 1)
|
||||
AddItem('baggedcrackedstagethree', 1)
|
||||
Notifys(Lang.Crack.makecrack, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Crack', 'crack')
|
||||
if not GetRecipe(src, 'crack', 'bagcrack', 'tier3') then return end
|
||||
Log(GetName(src) .. ' Bagged Crack', 'crack')
|
||||
else
|
||||
Notifys(Lang.Crack.nocoke, "error")
|
||||
Notifys(src, Lang.Crack.nocoke, "error")
|
||||
end
|
||||
else
|
||||
if RemoveItem('crackrock', 1 ) then
|
||||
RemoveItem('empty_weed_bag', 1)
|
||||
AddItem('baggedcracked', 1)
|
||||
Notifys(Lang.Crack.makecrack, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged Crack', 'crack')
|
||||
else
|
||||
Notifys(Lang.Crack.nocoke, "error")
|
||||
end
|
||||
if not GetRecipe(src, 'crack', 'bagcrack', 'tier1') then return end
|
||||
Log(GetName(src) .. ' Bagged Crack', 'crack')
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3}
|
||||
for k, v in pairs (cokecut) do
|
||||
QBCore.Functions.CreateUseableItem(k, function(source, item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if Player.Functions.GetItemByName(item.name) then
|
||||
if not Itemcheck(src, 'bakingsoda', 1) then return end
|
||||
TriggerClientEvent('md-drugs:client:minusTier', src, {type = 'crack', xt = 'bakingsoda', item = k, amount = v,recieve = 'crackrock'})
|
||||
end
|
||||
end)
|
||||
end
|
||||
+50
-168
@@ -1,128 +1,65 @@
|
||||
QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
-- Functions
|
||||
exports('GetDealers', function()
|
||||
return QBConfig.Dealers
|
||||
end)
|
||||
|
||||
-- Callbacks
|
||||
QBCore.Functions.CreateCallback('md-drugs:server:RequestConfig', function(_, cb)
|
||||
cb(QBConfig.Dealers)
|
||||
end)
|
||||
|
||||
-- Events
|
||||
RegisterNetEvent('md-drugs:server:updateDealerItems', function(itemData, amount, dealer)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if not Player then return end
|
||||
|
||||
if QBConfig.Dealers[dealer]["products"][itemData.slot].amount - 1 >= 0 then
|
||||
QBConfig.Dealers[dealer]["products"][itemData.slot].amount = QBConfig.Dealers[dealer]["products"][itemData.slot].amount - amount
|
||||
TriggerClientEvent('md-drugs:client:setDealerItems', -1, itemData, amount, dealer)
|
||||
lib.callback.register('md-drugs:server:getDealers', function(data)
|
||||
local check = MySQL.query.await('SELECT * FROM dealers', {})
|
||||
local loc = json.encode({x = 899.98, y = -2603.24, z = 6.11, h = 176.12 })
|
||||
if not check[1] then
|
||||
MySQL.insert('INSERT INTO dealers SET name = ?, coords = ?, time = ?, createdby = ?', {'MD', loc, 'any', 'code Newb'})
|
||||
return false
|
||||
else
|
||||
Player.Functions.RemoveItem(itemData.name, amount)
|
||||
Player.Functions.AddMoney('cash', amount * QBConfig.Dealers[dealer]["products"][itemData.slot].price)
|
||||
TriggerClientEvent("QBCore:Notify", src, "none Left", "error")
|
||||
return check
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
lib.callback.register('md-drugs:server:GetDeliveryItem', function(data)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local item = math.random(1, #QBConfig.DeliveryItems)
|
||||
local amount = math.random(1,4)
|
||||
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
local locnum = math.random(1, #QBConfig.DeliveryLocations)
|
||||
local coord = json.encode({
|
||||
x = math.floor(QBConfig.DeliveryLocations[locnum].coords.x * 100) / 100,
|
||||
y = math.floor(QBConfig.DeliveryLocations[locnum].coords.y * 100) / 100,
|
||||
z = math.floor(QBConfig.DeliveryLocations[locnum].coords.z * 100) / 100,
|
||||
})
|
||||
if not check[1] then
|
||||
MySQL.insert('INSERT INTO deliveriesdealer SET cid = ?, itemdata = ?, timestart = ?, maxtime = ?, location = ?',
|
||||
{Player.PlayerData.citizenid, json.encode({item = QBConfig.DeliveryItems[item].item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
|
||||
AddItem(Player.PlayerData.source, QBConfig.DeliveryItems[item].item, amount)
|
||||
return true, QBConfig.DeliveryItems[item].item, amount, coord
|
||||
else
|
||||
local time = os.time()
|
||||
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
|
||||
|
||||
if timeout > 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) Notifys(src, 'You Failed To Make It In Time!', 'error' ) return false end
|
||||
Notifys(src,'You Already Have A Delivery To Make', 'error' ) return false, QBConfig.DeliveryItems[item].item, amount, coord
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(deliveryData)
|
||||
RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local item = QBConfig.DeliveryItems[deliveryData.item].item
|
||||
|
||||
if Player.Functions.AddItem(item, deliveryData.amount) then
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "add")
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:server:successDelivery', function(deliveryData, inTime)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local item = QBConfig.DeliveryItems[deliveryData.item].item
|
||||
local itemAmount = deliveryData.amount
|
||||
local payout = deliveryData.itemData.payout * itemAmount
|
||||
local copsOnline = QBCore.Functions.GetDutyCount('police')
|
||||
local curRep = Player.PlayerData.metadata["dealerrep"]
|
||||
local invItem = Player.Functions.GetItemByName(item)
|
||||
|
||||
|
||||
if inTime then
|
||||
if invItem and invItem.amount >= itemAmount then -- on time correct amount
|
||||
Player.Functions.RemoveItem(item, itemAmount)
|
||||
if copsOnline > 0 then
|
||||
local copModifier = copsOnline * QBConfig.PoliceDeliveryModifier
|
||||
if QBConfig.UseMarkedBills then
|
||||
local info = {worth = math.floor(payout * copModifier)}
|
||||
Player.Functions.AddItem('markedbills', 1, false, info)
|
||||
else
|
||||
Player.Functions.AddMoney('cash', math.floor(payout * copModifier), 'drug-delivery')
|
||||
end
|
||||
else
|
||||
if QBConfig.UseMarkedBills then
|
||||
local info = {worth = payout}
|
||||
Player.Functions.AddItem('markedbills', 1, false, info)
|
||||
else
|
||||
Player.Functions.AddMoney('cash', payout, 'drug-delivery')
|
||||
end
|
||||
end
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove")
|
||||
TriggerClientEvent('QBCore:Notify', src, "You Got There In Time!", 'success')
|
||||
SetTimeout(math.random(5000, 10000), function()
|
||||
TriggerClientEvent('md-drugs:client:sendDeliveryMail', src, 'perfect', deliveryData)
|
||||
Player.Functions.SetMetaData('dealerrep', (curRep + QBConfig.DeliveryRepGain))
|
||||
end)
|
||||
else
|
||||
TriggerClientEvent('QBCore:Notify', src, "Wheres The Rest Of It", 'error')-- on time incorrect amount
|
||||
if invItem then
|
||||
local newItemAmount = invItem.amount
|
||||
local modifiedPayout = deliveryData.itemData.payout * newItemAmount
|
||||
Player.Functions.RemoveItem(item, newItemAmount)
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove")
|
||||
Player.Functions.AddMoney('cash', math.floor(modifiedPayout / QBConfig.WrongAmountFee))
|
||||
end
|
||||
SetTimeout(math.random(5000, 10000), function()
|
||||
TriggerClientEvent('md-drugs:client:sendDeliveryMail', src, 'bad', deliveryData)
|
||||
if curRep - 1 > 0 then
|
||||
Player.Functions.SetMetaData('dealerrep', (curRep - QBConfig.DeliveryRepLoss))
|
||||
else
|
||||
Player.Functions.SetMetaData('dealerrep', 0)
|
||||
end
|
||||
end)
|
||||
end
|
||||
else
|
||||
if invItem and invItem.amount >= itemAmount then -- late correct amount
|
||||
TriggerClientEvent('QBCore:Notify', src, "Where Were You Slow Ass", 'error')
|
||||
Player.Functions.RemoveItem(item, itemAmount)
|
||||
Player.Functions.AddMoney('cash', math.floor(payout / QBConfig.OverdueDeliveryFee), "delivery-drugs-too-late")
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove")
|
||||
SetTimeout(math.random(5000, 10000), function()
|
||||
TriggerClientEvent('md-drugs:client:sendDeliveryMail', src, 'late', deliveryData)
|
||||
if curRep - 1 > 0 then
|
||||
Player.Functions.SetMetaData('dealerrep', (curRep - QBConfig.DeliveryRepLoss))
|
||||
else
|
||||
Player.Functions.SetMetaData('dealerrep', 0)
|
||||
end
|
||||
end)
|
||||
else
|
||||
if invItem then -- late incorrect amount
|
||||
local newItemAmount = invItem.amount
|
||||
local modifiedPayout = deliveryData.itemData.payout * newItemAmount
|
||||
TriggerClientEvent('QBCore:Notify', src, "Late And Missing Product GZ You Suck", 'error')
|
||||
Player.Functions.RemoveItem(item, itemAmount)
|
||||
Player.Functions.AddMoney('cash', math.floor(modifiedPayout / QBConfig.OverdueDeliveryFee), "delivery-drugs-too-late")
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove")
|
||||
SetTimeout(math.random(5000, 10000), function()
|
||||
TriggerClientEvent('md-drugs:client:sendDeliveryMail', src, 'late', deliveryData)
|
||||
if curRep - 1 > 0 then
|
||||
Player.Functions.SetMetaData('dealerrep', (curRep - QBConfig.DeliveryRepLoss))
|
||||
else
|
||||
Player.Functions.SetMetaData('dealerrep', 0)
|
||||
end
|
||||
end)
|
||||
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
if not check[1] then return end
|
||||
local time = os.time()
|
||||
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
|
||||
local itemData = json.decode(check[1].itemdata)
|
||||
if timeout >= 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) Notifys(source, 'You Failed To Make It In Time!', 'error' ) return end
|
||||
if item ~= itemData.item then return end
|
||||
if amount ~= itemData.amount then return end
|
||||
if RemoveItem(src, item, amount) then
|
||||
for k, v in pairs (QBConfig.DeliveryItems) do
|
||||
if v.item == item then
|
||||
local income = math.random(v.payout.min, v.payout.max)
|
||||
Player.Functions.AddMoney('cash', income)
|
||||
AddRep(src, 'dealerrep')
|
||||
end
|
||||
end
|
||||
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -173,61 +110,6 @@ QBCore.Commands.Add("deletedealer", "Delete a dealer (Admin Only)", {{
|
||||
end
|
||||
end, "admin")
|
||||
|
||||
QBCore.Commands.Add("dealers", "View all dealers (Admin Only)", {}, false, function(source, _)
|
||||
local DealersText = ""
|
||||
if QBConfig.Dealers ~= nil and next(QBConfig.Dealers) ~= nil then
|
||||
for _, v in pairs(QBConfig.Dealers) do
|
||||
DealersText = DealersText .. "Name: " .. v["name"] .. "<br>"
|
||||
end
|
||||
TriggerClientEvent('chat:addMessage', source, {
|
||||
template = '<div class="chat-message advert"><div class="chat-message-body"><strong>' .."List Of Dealers " .. '</strong><br><br> ' .. DealersText .. '</div></div>',
|
||||
args = {}
|
||||
})
|
||||
else
|
||||
TriggerClientEvent('QBCore:Notify', source, "No Dealers", 'error')
|
||||
end
|
||||
end, "admin")
|
||||
|
||||
QBCore.Commands.Add("dealergoto", "Teleport to a dealer (Admin Only)", {{
|
||||
name = "name",
|
||||
help = "Dealer name"
|
||||
}}, true, function(source, args)
|
||||
local DealerName = tostring(args[1])
|
||||
if QBConfig.Dealers[DealerName] then
|
||||
local ped = GetPlayerPed(source)
|
||||
SetEntityCoords(ped, QBConfig.Dealers[DealerName]['coords']['x'], QBConfig.Dealers[DealerName]['coords']['y'], QBConfig.Dealers[DealerName]['coords']['z'])
|
||||
TriggerClientEvent('QBCore:Notify', source, "TelePorted", {dealerName = DealerName}, 'success')
|
||||
else
|
||||
TriggerClientEvent('QBCore:Notify', source, "Doesnt Exist", 'error')
|
||||
end
|
||||
end, "admin")
|
||||
|
||||
CreateThread(function()
|
||||
Wait(500)
|
||||
local dealers = MySQL.query.await('SELECT * FROM dealers', {})
|
||||
if dealers[1] then
|
||||
for _, v in pairs(dealers) do
|
||||
local coords = json.decode(v.coords)
|
||||
local time = json.decode(v.time)
|
||||
|
||||
QBConfig.Dealers[v.name] = {
|
||||
["name"] = v.name,
|
||||
["coords"] = {
|
||||
["x"] = coords.x,
|
||||
["y"] = coords.y,
|
||||
["z"] = coords.z
|
||||
},
|
||||
["time"] = {
|
||||
["min"] = time.min,
|
||||
["max"] = time.max
|
||||
},
|
||||
["products"] = QBConfig.Products
|
||||
}
|
||||
end
|
||||
end
|
||||
TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers)
|
||||
|
||||
end)
|
||||
RegisterServerEvent("md-drugs:server:Dealershop", function(amount, value, item, info)
|
||||
local src = source local Player = QBCore.Functions.GetPlayer(src)
|
||||
local balance = Player.Functions.GetMoney(tostring(value))
|
||||
|
||||
+220
-65
@@ -1,5 +1,7 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local notify = Config.Notify -- qb or ox
|
||||
|
||||
------------------------------------------ logging stuff
|
||||
local logs = false
|
||||
local logapi = GetConvar("fivemerrLogs", "")
|
||||
local endpoint = 'https://api.fivemerr.com/v1/logs'
|
||||
@@ -20,6 +22,7 @@ else
|
||||
print'^1 logs disabled for md-drugs'
|
||||
end
|
||||
end)
|
||||
|
||||
function Log(message, type)
|
||||
if logs == false then return end
|
||||
local buffer = {
|
||||
@@ -42,6 +45,7 @@ if logs == false then return end
|
||||
buffer = nil
|
||||
end)
|
||||
end
|
||||
---------------------------------------------------- inventory catcher
|
||||
local invname = ''
|
||||
CreateThread(function()
|
||||
if GetResourceState('ps-inventory') == 'started' then
|
||||
@@ -51,10 +55,21 @@ elseif GetResourceState('qb-inventory') == 'started' then
|
||||
else
|
||||
invname = 'inventory'
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
function Notifys(text, type)
|
||||
local inventory = ''
|
||||
|
||||
CreateThread(function()
|
||||
if GetResourceState('ox_inventory') == 'started' then
|
||||
inventory = 'ox'
|
||||
else
|
||||
inventory = 'qb'
|
||||
end
|
||||
end)
|
||||
------------------------------------ functions
|
||||
---
|
||||
---
|
||||
function Notifys(source, text, type)
|
||||
local src = source
|
||||
if notify == 'qb' then
|
||||
TriggerClientEvent("QBCore:Notify", src, text, type)
|
||||
@@ -63,94 +78,223 @@ function Notifys(text, type)
|
||||
elseif notify == 'okok' then
|
||||
TriggerClientEvent('okokNotify:Alert', src, '', text, 4000, type, false)
|
||||
else
|
||||
print"dude, it literally tells you what to put in the config"
|
||||
print"^1 Look At The Config For Proper Alert Options"
|
||||
end
|
||||
end
|
||||
|
||||
function Itemcheck(Player, item, amount, notify)
|
||||
local itemchecks = Player.Functions.GetItemByName(item)
|
||||
local yes
|
||||
|
||||
if notify == nil then notify = false end
|
||||
if itemchecks and itemchecks.amount >= amount then
|
||||
yes = true return yes
|
||||
else
|
||||
if notify == 'true' then
|
||||
Notifys('You Need ' .. amount .. ' Of ' .. QBCore.Shared.Items[item].label .. ' To Do this', 'error') return else end
|
||||
end
|
||||
end
|
||||
function dist(source, Player, coords)
|
||||
local pcoords = GetEntityCoords(Player)
|
||||
|
||||
function GetLabels(item)
|
||||
if inventory == 'qb' then
|
||||
return QBCore.Shared.Items[item].label
|
||||
elseif inventory == 'ox' then
|
||||
local items = exports.ox_inventory:Items()
|
||||
return items[item].label
|
||||
end
|
||||
end
|
||||
|
||||
function Itemcheck(source, item, amount)
|
||||
if inventory == 'qb' then
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local itemchecks = Player.Functions.GetItemByName(item)
|
||||
if itemchecks and itemchecks.amount >= amount then
|
||||
return true
|
||||
else
|
||||
Notifys(source, 'You Need ' .. amount .. ' Of ' .. GetLabels(item) .. ' To Do this', 'error')
|
||||
return false
|
||||
end
|
||||
elseif inventory == 'ox' then
|
||||
local has = exports.ox_inventory:GetItem(source, item , nil, true)
|
||||
if has.count >= amount then
|
||||
return true
|
||||
else
|
||||
Notifys(source, 'You Need ' .. amount .. ' Of ' .. GetLabels(item) .. ' To Do This', 'error')
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function GetCoords(source)
|
||||
local ped = GetPlayerPed(source)
|
||||
local playerCoords = GetEntityCoords(ped)
|
||||
return playerCoords
|
||||
end
|
||||
|
||||
function dist(source, coords)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
local pcoords = GetEntityCoords(playerPed)
|
||||
local dist = #(pcoords - coords)
|
||||
return dist
|
||||
end
|
||||
function CheckDist(source,Player, coords)
|
||||
local pcoords = GetEntityCoords(Player)
|
||||
|
||||
function CheckDist(source, coords)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
local pcoords = GetEntityCoords(playerPed)
|
||||
local ok
|
||||
if #(pcoords - coords) < 4.0 then
|
||||
return ok
|
||||
else
|
||||
DropPlayer(source, 'Too Far') return end
|
||||
DropPlayer(source, 'md-drugs: You Were A Total Of ' .. #(pcoords - coords) .. ' Too Far Away To Trigger This Event')
|
||||
return false
|
||||
end
|
||||
end
|
||||
function checkTable(player, table)
|
||||
|
||||
function checkTable(table)
|
||||
local need = 0
|
||||
local have = 0
|
||||
for k, v in pairs (table) do
|
||||
need = need + 1
|
||||
if Itemcheck(player, k, v, 'true') then have = have + 1 end
|
||||
if Itemcheck(source, k, v) then have = have + 1 end
|
||||
end
|
||||
if need == have then
|
||||
return true
|
||||
else
|
||||
end
|
||||
end
|
||||
function RemoveItem( item, amount)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if Player.Functions.RemoveItem(item, amount) then TriggerClientEvent(invname ..":client:ItemBox", src, QBCore.Shared.Items[item], "remove", amount) return true
|
||||
else
|
||||
Notifys('You Need ' .. amount .. ' Of ' .. QBCore.Shared.Items[item].label .. ' To Do This', 'error')
|
||||
|
||||
function RemoveItem(source, item, amount)
|
||||
if inventory == 'qb' then
|
||||
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
|
||||
Notifys(source, 'You Need ' .. amount .. ' Of ' .. GetLabels(item) .. ' To Do This', 'error')
|
||||
end
|
||||
elseif inventory == 'ox' then
|
||||
if exports.ox_inventory:RemoveItem(source, item, amount) then
|
||||
return true
|
||||
else
|
||||
Notifys(source, 'You Need ' .. amount .. ' Of ' .. GetLabels(item) .. ' To Do This', 'error')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AddItem(item, amount)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if Player.Functions.AddItem(item, amount) then TriggerClientEvent(invname ..":client:ItemBox", src, QBCore.Shared.Items[item], "add", amount) return true
|
||||
else
|
||||
print('you sucks')
|
||||
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)
|
||||
function AddItem(source, item, amount)
|
||||
if inventory == 'qb' then
|
||||
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('Failed To Give Item: ' .. item .. ' Check Your qb-core/shared/items.lua')
|
||||
return false
|
||||
end
|
||||
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)
|
||||
local carry = exports.ox_inventory:CanCarryItem(source, item, amount)
|
||||
if not carry then Notifys(source, 'You Cant Carry that Much Weight!', 'error') return false end
|
||||
if exports.ox_inventory:AddItem(source, item, amount) then
|
||||
return true
|
||||
else
|
||||
print('Failed To Give Item: ' .. item .. ' Check Your ox_inventory/data/items.lua')
|
||||
return false
|
||||
end
|
||||
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')
|
||||
function GetName(source)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
return Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname
|
||||
|
||||
end
|
||||
|
||||
function getRep(source, type)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
if not sql[1] then
|
||||
local table = json.encode({
|
||||
coke = Player.PlayerData.metadata.coke or 0,
|
||||
lsd = Player.PlayerData.metadata.lsd or 0,
|
||||
heroin = Player.PlayerData.metadata.heroin or 0,
|
||||
dealerrep = Player.PlayerData.metadata.dealerrep or 0,
|
||||
})
|
||||
MySQL.insert('INSERT INTO drugrep SET cid = ?, drugrep = ?, name = ?', {Player.PlayerData.citizenid, table, GetName(source)})
|
||||
return false
|
||||
else
|
||||
local rep = json.decode(sql[1].drugrep)
|
||||
if type == 'coke' then
|
||||
return rep.coke
|
||||
elseif type == 'heroin' then
|
||||
return rep.heroin
|
||||
elseif type == 'lsd' then
|
||||
return rep.lsd
|
||||
elseif type == 'dealerrep' then
|
||||
return rep.dealerrep
|
||||
else
|
||||
print('^1 Error: No Valid Drug Rep Option Chosen')
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function GetAllRep(source)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
if not sql[1] then
|
||||
local table = json.encode({
|
||||
coke = Player.PlayerData.metadata.coke or 0,
|
||||
lsd = Player.PlayerData.metadata.lsd or 0,
|
||||
heroin = Player.PlayerData.metadata.heroin or 0,
|
||||
dealerrep = Player.PlayerData.metadata.dealerrep or 0,
|
||||
})
|
||||
MySQL.insert('INSERT INTO drugrep SET cid = ?, drugrep = ?, name = ?', {Player.PlayerData.citizenid, table, GetName(source)})
|
||||
Wait(1000)
|
||||
return false
|
||||
else
|
||||
local rep = json.decode(sql[1].drugrep)
|
||||
return rep
|
||||
end
|
||||
end
|
||||
|
||||
function AddRep(source, type)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
local rep = json.decode(sql[1].drugrep)
|
||||
local update
|
||||
if type == 'coke' then
|
||||
update = json.encode({coke = rep.coke + 1, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep})
|
||||
elseif type == 'heroin' then
|
||||
update = json.encode({coke = rep.coke, heroin = rep.heroin + 1, lsd = rep.lsd, dealerrep = rep.dealerrep})
|
||||
elseif type == 'lsd' then
|
||||
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd +1 , dealerrep = rep.dealerrep})
|
||||
elseif type == 'dealerrep' then
|
||||
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep + 1})
|
||||
end
|
||||
if update == '' then return false end
|
||||
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, Player.PlayerData.citizenid})
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
function ChecknRemove(source, table)
|
||||
local Player = QBCore.Functions.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 has = exports.ox_inventory:GetItem(source, k , nil, true)
|
||||
if has.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
|
||||
@@ -163,17 +307,20 @@ lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args)
|
||||
return amount
|
||||
end)
|
||||
|
||||
lib.callback.register('md-drugs:server:GetRep', function(source, cb, args)
|
||||
local src = source
|
||||
local rep = GetAllRep(source)
|
||||
return rep
|
||||
end)
|
||||
|
||||
CreateThread(function()
|
||||
if not GetResourceState('ox_lib'):find("start") then
|
||||
print('^1 ox_lib Is A Depndancy, Not An Optional ')
|
||||
end
|
||||
if Config.minigametype == 'ps' and not GetResourceState('ps-ui'):find("start") then
|
||||
print('^1 You Have Config.minigametype as ps but dont have ps-ui started')
|
||||
end
|
||||
end)
|
||||
CreateThread(function()
|
||||
local url = "https://raw.githubusercontent.com/Mustachedom/md-drugs/main/version.txt"
|
||||
local version = GetResourceMetadata('md-drugs', "version" )
|
||||
local version = GetResourceMetadata('md-drugs-expiramental', "version" )
|
||||
PerformHttpRequest(url, function(err, text, headers)
|
||||
if (text ~= nil) then
|
||||
print('^2 Your Version:' .. version .. ' | Current Version:' .. text .. '' )
|
||||
@@ -181,3 +328,11 @@ CreateThread(function()
|
||||
end, "GET", "", "")
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:AddMas', function(data)
|
||||
local src = source
|
||||
if not data then return end
|
||||
if not Itemcheck(src, data.xt, 1) then return end
|
||||
if not RemoveItem(src, data.item, 1) then return end
|
||||
RemoveItem(src, data.xt, 1)
|
||||
AddItem(src, data.recieve, data.amount)
|
||||
end)
|
||||
+73
-141
@@ -22,63 +22,46 @@ end
|
||||
|
||||
RegisterServerEvent('md-drugs:server:removecleaningkitheroin', function(data)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if RemoveItem("cleaningkit", 1) then
|
||||
Notifys("Cleaned It Perfectly", "success")
|
||||
if RemoveItem(src,"cleaningkit", 1) then
|
||||
TriggerClientEvent("md-drugs:client:deletedirtyheroin", src, data)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Wiped Down Their Heroin Lab Kit!' , 'heroin')
|
||||
Log(GetName(src) .. ' Wiped Down Their Heroin Lab Kit!' , 'heroin')
|
||||
else
|
||||
Notifys("You cant clean it with spit alone", "error")
|
||||
Notifys(src, "You cant clean it with spit alone", "error")
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterServerEvent("heroin:pickupCane", function(loc)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.PoppyPlants[loc].location) then return end
|
||||
if CheckDist(source, Config.PoppyPlants[loc].location) then return end
|
||||
if not Config.PoppyPlants[loc].taken then
|
||||
Config.PoppyPlants[loc].taken = true
|
||||
GlobalState.PoppyPlants = Config.PoppyPlants
|
||||
TriggerClientEvent("heroin:removeCane", -1, loc)
|
||||
heroinCooldown(loc)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
AddItem('poppyresin', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked A Poppies With a distance of ' .. dist(source, playerPed, Config.PoppyPlants[loc].location) .. ' vectors', 'heroin')
|
||||
|
||||
AddItem(source, 'poppyresin', 1)
|
||||
Log(GetName(source) .. ' Picked A Poppies With a distance of ' .. dist(source, Config.PoppyPlants[loc].location) .. ' vectors', 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:dryplant', function(num)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.dryplant[num]['loc']) then return end
|
||||
if not Itemcheck(Player, 'poppyresin', 1, 'true') then return end
|
||||
if CheckDist(source, Config.dryplant[num]['loc']) then return end
|
||||
if not Itemcheck(source, 'poppyresin', 1) then return end
|
||||
if Config.TierSystem then
|
||||
local heroin = Player.PlayerData.metadata['heroin']
|
||||
local heroin = getRep(src, 'heroin')
|
||||
if heroin <= Config.Tier1 then
|
||||
if RemoveItem("poppyresin", 1) then
|
||||
AddItem("heroin", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Heroin Powder With a distance of ' .. dist(source, playerPed, Config.dryplant[num]['loc']) .. ' vectors', 'heroin')
|
||||
end
|
||||
if not GetRecipe(src, 'heroin', 'dryheroin', 'tier1') then return end
|
||||
Log(GetName(src) ..' Made Heroin Powder With a distance of ' .. dist(source, Config.dryplant[num]['loc']) .. ' vectors', 'heroin')
|
||||
elseif heroin >= Config.Tier1 and heroin <= Config.Tier2 then
|
||||
if RemoveItem("poppyresin", 1) then
|
||||
AddItem("heroinstagetwo", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Heroin Powder Tier 2 With a distance of ' .. dist(source, playerPed, Config.dryplant[num]['loc']) .. ' vectors', 'heroin')
|
||||
end
|
||||
if not GetRecipe(src, 'heroin', 'dryheroin', 'tier2') then return end
|
||||
Log(GetName(src) ..' Made Heroin Powder Tier 2 With a distance of ' .. dist(source, Config.dryplant[num]['loc']) .. ' vectors', 'heroin')
|
||||
else
|
||||
if RemoveItem("poppyresin", 1) then
|
||||
AddItem("heroinstagethree", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Heroin Powder Tier 3 With a distance of ' .. dist(source, playerPed, Config.dryplant[num]['loc']) .. ' vectors', 'heroin')
|
||||
end
|
||||
if not GetRecipe(src, 'heroin', 'dryheroin', 'tier3') then return end
|
||||
Log(GetName(src) ..' Made Heroin Powder Tier 3 With a distance of ' .. dist(source, Config.dryplant[num]['loc']) .. ' vectors', 'heroin')
|
||||
end
|
||||
else
|
||||
if RemoveItem("poppyresin", 1) then
|
||||
AddItem("heroin", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Heroin Powder With a distance of ' .. dist(source, playerPed, Config.dryplant[num]['loc']) .. ' vectors', 'heroin')
|
||||
|
||||
end
|
||||
if not GetRecipe(src, 'heroin', 'dryheroin', 'tier1') then return end
|
||||
Log(GetName(src) ..' Made Heroin Powder With a distance of ' .. dist(source, Config.dryplant[num]['loc']) .. ' vectors', 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -86,78 +69,58 @@ end)
|
||||
RegisterServerEvent('md-drugs:server:cutheroin', function(num)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.cutheroinone[num]['loc']) then return end
|
||||
if not Itemcheck(Player, 'bakingsoda', 1, 'true') then return end
|
||||
if CheckDist(source, Config.cutheroinone[num]['loc']) then return end
|
||||
if not Itemcheck(src, 'bakingsoda', 1) then return end
|
||||
if Config.TierSystem then
|
||||
local rawh = Player.Functions.GetItemByName('heroin')
|
||||
local rawh2 = Player.Functions.GetItemByName('heroinstagetwo')
|
||||
local rawh3 = Player.Functions.GetItemByName('heroinstagethree')
|
||||
if rawh then
|
||||
RemoveItem('heroin', 1 )
|
||||
RemoveItem('bakingsoda', 1 )
|
||||
AddItem('heroincut',1)
|
||||
Notifys(Lang.Heroin.cutheroin, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Heroin With a distance of ' .. dist(source, playerPed, Config.cutheroinone[num]['loc']) .. ' vectors', 'heroin')
|
||||
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end
|
||||
Log(GetName(src) ..' Cut Heroin With a distance of ' .. dist(source, Config.cutheroinone[num]['loc']) .. ' vectors', 'heroin')
|
||||
elseif rawh2 then
|
||||
RemoveItem('heroinstagetwo', 1 )
|
||||
RemoveItem('bakingsoda', 1 )
|
||||
AddItem('heroincutstagetwo', 1)
|
||||
Notifys(Lang.Heroin.cutheroin, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Heroin Tier 2 With a distance of ' .. dist(source, playerPed, Config.cutheroinone[num]['loc']) .. ' vectors', 'heroin')
|
||||
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier2') then return end
|
||||
Log(GetName(src) ..' Cut Heroin Tier 2 With a distance of ' .. dist(source, Config.cutheroinone[num]['loc']) .. ' vectors', 'heroin')
|
||||
elseif rawh3 then
|
||||
RemoveItem('heroinstagethree', 1 )
|
||||
RemoveItem('bakingsoda', 1 )
|
||||
AddItem('heroincutstagethree', 1)
|
||||
Notifys(Lang.Heroin.cutheroin, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Heroin Tier 3 With a distance of ' .. dist(source, playerPed, Config.cutheroinone[num]['loc']) .. ' vectors', 'heroin')
|
||||
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier3') then return end
|
||||
Log(GetName(src) .. ' Cut Heroin Tier 3 With a distance of ' .. dist(source, Config.cutheroinone[num]['loc']) .. ' vectors', 'heroin')
|
||||
else
|
||||
Notifys(Lang.Heroin.noheroin, "error")
|
||||
Notifys(src, Lang.Heroin.noheroin, "error")
|
||||
end
|
||||
else
|
||||
if RemoveItem('heroin', 1 ) then
|
||||
RemoveItem('bakingsoda', 1 )
|
||||
AddItem('heroincut',1)
|
||||
Notifys(Lang.Heroin.cutheroin, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Cut Heroin With a distance of ' .. dist(source, playerPed, Config.cutheroinone[num]['loc']) .. ' vectors', 'heroin')
|
||||
else
|
||||
Notifys(Lang.Heroin.noheroin, "error")
|
||||
end
|
||||
if not GetRecipe(src, 'heroin', 'cutheroin', 'tier1') then return end
|
||||
Log(GetName(src) ..' Cut Heroin With a distance of ' .. dist(source, Config.cutheroinone[num]['loc']) .. ' vectors', 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:getheroinlabkit', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
|
||||
if CheckDist(source, playerPed, vector3(Config.buyheroinlabkit.x,Config.buyheroinlabkit.y,Config.buyheroinlabkit.z)) then return end
|
||||
if CheckDist(source, vector3(Config.buyheroinlabkit.x,Config.buyheroinlabkit.y,Config.buyheroinlabkit.z)) then return end
|
||||
if Player.Functions.RemoveMoney('cash', Config.heroinlabkitprice) then
|
||||
AddItem('heroinlabkit', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bought A Heroin lab Kit ' .. dist(source, playerPed, vector3(Config.buyheroinlabkit.x,Config.buyheroinlabkit.y,Config.buyheroinlabkit.z)) .. ' vectors', 'heroin')
|
||||
AddItem(src, 'heroinlabkit', 1)
|
||||
Log(GetName(src) ..' Bought A Heroin lab Kit ' .. dist(source, vector3(Config.buyheroinlabkit.x,Config.buyheroinlabkit.y,Config.buyheroinlabkit.z)) .. ' vectors', 'heroin')
|
||||
else
|
||||
Notifys('You Need '.. Config.heroinlabkitprice .. ' In Cash For This', 'error')
|
||||
Notifys(src, 'You Need '.. Config.heroinlabkitprice .. ' In Cash For This', 'error')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:getheroinlabkitback', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if Player.Functions.AddItem("heroinlabkit", 1) then
|
||||
Notifys('You Got Your Lab Kit Back', 'Success')
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked Up Their Heroin Lab Kit Back At ' .. GetEntityCoords(playerPed) .. '!', 'heroin')
|
||||
if AddItem(src, "heroinlabkit", 1) then
|
||||
Log(GetName(src) ..' Picked Up Their Heroin Lab Kit Back At ' .. GetCoords(src) .. '!', 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateUseableItem('heroinlabkit', function(source, item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(src)
|
||||
if not Itemcheck(Player, 'heroinlabkit', 1, 'true') then return end
|
||||
if not Itemcheck(source, 'heroinlabkit', 1) then return end
|
||||
if TriggerClientEvent("md-drugs:client:setheroinlabkit", src) then
|
||||
Player.Functions.RemoveItem("heroinlabkit", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Placed Their Heroin Lab Kit Back At ' .. GetEntityCoords(playerPed) .. '!', 'heroin')
|
||||
RemoveItem(src, "heroinlabkit", 1)
|
||||
Log(GetName(src) ..' Placed Their Heroin Lab Kit Back At ' .. GetCoords(src) .. '!', 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -166,41 +129,26 @@ end)
|
||||
RegisterServerEvent('md-drugs:server:heatliquidheroin', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if not Itemcheck(Player, 'emptyvial', 1, 'true') then return end
|
||||
if not Itemcheck(source, 'emptyvial', 1) then return end
|
||||
if Config.TierSystem then
|
||||
local cuth = Player.Functions.GetItemByName('heroincut')
|
||||
local cuth2 = Player.Functions.GetItemByName('heroincutstagetwo')
|
||||
local cuth3 = Player.Functions.GetItemByName('heroincutstagethree')
|
||||
if cuth then
|
||||
RemoveItem('heroincut', 1)
|
||||
RemoveItem('emptyvial', 1)
|
||||
AddItem('heroinvial', 1)
|
||||
Notifys(Lang.Heroin.vial, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Vial Of Heroin', 'heroin')
|
||||
if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end
|
||||
Log(GetName(src) ..' Made A Vial Of Heroin', 'heroin')
|
||||
elseif cuth2 then
|
||||
RemoveItem('heroincutstagetwo', 1)
|
||||
RemoveItem('emptyvial', 1)
|
||||
AddItem('heroinvialstagetwo', 1)
|
||||
Notifys(Lang.Heroin.vial, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Vial Of Heroin Tier 2', 'heroin')
|
||||
if not GetRecipe(src, 'heroin', 'fillvial', 'tier2') then return end
|
||||
Log(GetName(src) ..' Made A Vial Of Heroin Tier 2', 'heroin')
|
||||
elseif cuth3 then
|
||||
RemoveItem('heroincutstagethree', 1)
|
||||
RemoveItem('emptyvial', 1)
|
||||
AddItem('heroinvialstagethree', 1)
|
||||
Notifys(Lang.Heroin.vial, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Vial Of Heroin Tier 3', 'heroin')
|
||||
if not GetRecipe(src, 'heroin', 'fillvial', 'tier3') then return end
|
||||
Log(GetName(src) ..' Made A Vial Of Heroin Tier 3', 'heroin')
|
||||
else
|
||||
Notifys(Lang.Heroin.novial, "error")
|
||||
end
|
||||
else
|
||||
if RemoveItem('heroincut', 1) then
|
||||
RemoveItem('emptyvial', 1)
|
||||
AddItem('heroinvial', 1)
|
||||
Notifys(Lang.Heroin.vial, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Vial Of Heroin', 'heroin')
|
||||
else
|
||||
Notifys(Lang.Heroin.novial, "error")
|
||||
end
|
||||
if not GetRecipe(src, 'heroin', 'fillvial', 'tier1') then return end
|
||||
Log(GetName(src) ..' Made A Vial Of Heroin', 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -210,16 +158,16 @@ local Player = QBCore.Functions.GetPlayer(src)
|
||||
local cuth = Player.Functions.GetItemByName('heroincut')
|
||||
local cuth2 = Player.Functions.GetItemByName('heroincutstagetwo')
|
||||
local cuth3 = Player.Functions.GetItemByName('heroincutstagethree')
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Sucks And Burned Their Heroin', 'heroin')
|
||||
Log(GetName(src) ..' Sucks And Burned Their Heroin', 'heroin')
|
||||
if cuth then
|
||||
RemoveItem('heroincut', 1)
|
||||
Notifys(Lang.Heroin.fail, "error")
|
||||
RemoveItem(src, 'heroincut', 1)
|
||||
Notifys(src,Lang.Heroin.fail, "error")
|
||||
elseif cuth2 then
|
||||
RemoveItem('heroincutstagetwo', 1)
|
||||
Notifys(Lang.Heroin.fail, "error")
|
||||
RemoveItem(src, 'heroincutstagetwo', 1)
|
||||
Notifys(src,Lang.Heroin.fail, "error")
|
||||
elseif cuth3 then
|
||||
RemoveItem('heroincutstagethree', 1)
|
||||
Notifys(Lang.Heroin.fail, "error")
|
||||
RemoveItem(src, 'heroincutstagethree', 1)
|
||||
Notifys(src,Lang.Heroin.fail, "error")
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -227,47 +175,31 @@ end)
|
||||
RegisterServerEvent('md-drugs:server:fillneedle', function(num)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.fillneedle[num]['loc']) then return end
|
||||
if not Itemcheck(Player, 'needle', 1, 'true') then return end
|
||||
if CheckDist(source, Config.fillneedle[num]['loc']) then return end
|
||||
if not Itemcheck(src, 'needle', 1) then return end
|
||||
if Config.TierSystem then
|
||||
local heroin = Player.PlayerData.metadata['heroin']
|
||||
local heroin = getRep(src, 'heroin')
|
||||
local vh = Player.Functions.GetItemByName('heroinvial')
|
||||
local vh2 = Player.Functions.GetItemByName('heroinvialstagetwo')
|
||||
local vh3 = Player.Functions.GetItemByName('heroinvialstagethree')
|
||||
if vh then
|
||||
RemoveItem('heroinvial', 1 )
|
||||
RemoveItem('needle', 1)
|
||||
AddItem('heroin_ready', 1)
|
||||
Player.Functions.SetMetaData('heroin', (heroin + 1))
|
||||
Notifys(Lang.Heroin.fill, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Filled A Needle Of Heroin And Now Has A Rep Of ' .. heroin + 1 .. '!' , 'heroin')
|
||||
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
|
||||
RemoveItem('heroinvialstagetwo', 1 )
|
||||
RemoveItem('needle', 1)
|
||||
AddItem('heroin_readystagetwo', 1)
|
||||
Player.Functions.SetMetaData('heroin', (heroin + 1))
|
||||
Notifys(Lang.Heroin.fill, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Filled A Needle Of Heroin Tier 2 And Now Has A Rep Of ' .. heroin + 1 .. '!' , 'heroin')
|
||||
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
|
||||
RemoveItem('heroinvialstagethree', 1 )
|
||||
RemoveItem('needle', 1)
|
||||
AddItem('heroin_readystagethree', 1)
|
||||
Player.Functions.SetMetaData('heroin', (heroin + 1))
|
||||
Notifys(Lang.Heroin.fill, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Filled A Needle Of Heroin Tier 3 And Now Has A Rep Of ' .. heroin + 1 .. '!' , 'heroin')
|
||||
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(Lang.Heroin.nofill, "error")
|
||||
Notifys(src,Lang.Heroin.nofill, "error")
|
||||
end
|
||||
else
|
||||
if RemoveItem('heroinvial', 1 ) then
|
||||
RemoveItem('needle', 1)
|
||||
AddItem('heroin_ready', 1)
|
||||
Notifys(Lang.Heroin.fill, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Filled A Needle Of Heroin!' , 'heroin')
|
||||
else
|
||||
Notifys(Lang.Heroin.nofill, "error")
|
||||
end
|
||||
if not GetRecipe(src, 'heroin', 'fillneedle', 'tier1') then return end
|
||||
Log(GetName(src) ..' Filled A Needle Of Heroin!' , 'heroin')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -276,17 +208,17 @@ end)
|
||||
RegisterServerEvent('md-drugs:server:failheroin', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Sucks And Burned Their Heroin', 'heroin')
|
||||
Log(GetName(src) ..' Sucks And Burned Their Heroin', 'heroin')
|
||||
if Config.TierSystem then
|
||||
local vh = Player.Functions.GetItemByName('heroinvial')
|
||||
local vh2 = Player.Functions.GetItemByName('heroinvialstagetwo')
|
||||
local vh3 = Player.Functions.GetItemByName('heroinvialstagethree')
|
||||
if vh then RemoveItem('heroinvialstagethree', 1 )
|
||||
elseif vh2 then RemoveItem('heroinvialstagetwo', 1)
|
||||
elseif vh3 then RemoveItem('heroinvial', 1)
|
||||
if vh then RemoveItem(src, 'heroinvialstagethree', 1 )
|
||||
elseif vh2 then RemoveItem(src, 'heroinvialstagetwo', 1)
|
||||
elseif vh3 then RemoveItem(src, 'heroinvial', 1)
|
||||
end
|
||||
else
|
||||
RemoveItem('heroinvial', 1)
|
||||
RemoveItem(src, 'heroinvial', 1)
|
||||
end
|
||||
end)
|
||||
|
||||
+15
-27
@@ -2,42 +2,30 @@ local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
RegisterServerEvent('md-drugs:server:givelean', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local chance = math.random(1,100)
|
||||
local amount = math.random(1,5)
|
||||
if chance <= 50 then
|
||||
if AddItem('mdlean', amount) then
|
||||
if AddItem(src, 'mdlean', amount) then
|
||||
Notifys(Lang.Lean.lean, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got ' .. amount .. ' Of Lean' , 'lean')
|
||||
Log(GetName(src) .. ' Got ' .. amount .. ' Of Lean' , 'lean')
|
||||
end
|
||||
else
|
||||
if AddItem('mdreddextro', amount) then
|
||||
if AddItem(src, 'mdreddextro', amount) then
|
||||
Notifys(Lang.Lean.dextro, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got ' .. amount .. ' Of Red Dextro' , 'lean')
|
||||
Log(GetName(src) .. ' Got ' .. amount .. ' Of Red Dextro' , 'lean')
|
||||
end
|
||||
end
|
||||
end)
|
||||
local lean = {'mdlean', 'mdreddextro'}
|
||||
for k, v in pairs (lean) do
|
||||
QBCore.Functions.CreateUseableItem(v, function(source)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if v == 'mdlean' then
|
||||
if Player.Functions.GetItemByName('leancup') and Player.Functions.GetItemByName('sprunk') and Player.Functions.GetItemByName('mdlean') then
|
||||
Player.Functions.RemoveItem('mdlean', 1 )
|
||||
Player.Functions.RemoveItem('sprunk', 1 )
|
||||
Player.Functions.RemoveItem('leancup', 1 )
|
||||
Player.Functions.AddItem('cupoflean', 1 )
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Cup Of Lean' , 'lean')
|
||||
end
|
||||
else
|
||||
if Player.Functions.GetItemByName('leancup') and Player.Functions.GetItemByName('sprunk') and Player.Functions.GetItemByName('mdreddextro') then
|
||||
Player.Functions.RemoveItem('mdreddextro', 1 )
|
||||
Player.Functions.RemoveItem('sprunk', 1 )
|
||||
Player.Functions.RemoveItem('leancup', 1 )
|
||||
Player.Functions.AddItem('cupofdextro', 1 )
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Cup Of Red Dextro' , 'lean')
|
||||
end
|
||||
|
||||
QBCore.Functions.CreateUseableItem('leancup', function(source, item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if Itemcheck(src, 'leancup', 1) then
|
||||
TriggerClientEvent('md-drugs:client:leancraft', src)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('md-drugs:server:finishcup', function(data)
|
||||
local src = source
|
||||
if not GetRecipe(source, 'lean','cups', data.item) then return end
|
||||
end)
|
||||
+72
-114
@@ -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
|
||||
+10
-25
@@ -21,43 +21,28 @@ function MescalineCooldown(loc)
|
||||
end
|
||||
|
||||
|
||||
|
||||
RegisterNetEvent("Mescaline:pickupCane")
|
||||
AddEventHandler("Mescaline:pickupCane", function(loc)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.Mescaline[loc].location) then end
|
||||
RegisterNetEvent("Mescaline:pickupCane", function(loc)
|
||||
if CheckDist(source, Config.Mescaline[loc].location) then return end
|
||||
if not Config.Mescaline[loc].taken then
|
||||
Config.Mescaline[loc].taken = true
|
||||
GlobalState.Mescaline = Config.Mescaline
|
||||
TriggerClientEvent("Mescaline:removeCane", -1, loc)
|
||||
MescalineCooldown(loc)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
AddItem('cactusbulb', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked Cactus Bulbs With a distance of ' .. dist(source, playerPed, Config.Mescaline[loc].location) .. ' vectors', 'mescaline')
|
||||
AddItem(source,'cactusbulb', 1)
|
||||
Log(GetName(source) .. ' Picked Cactus Bulbs With a distance of ' .. dist(source, Config.Mescaline[loc].location) .. ' vectors', 'mescaline')
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
RegisterNetEvent("md-drugs:server:drymescaline")
|
||||
AddEventHandler("md-drugs:server:drymescaline", function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if RemoveItem("cactusbulb", 1) then
|
||||
AddItem("driedmescaline", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Dried Mescaline', 'mescaline')
|
||||
else
|
||||
Notifys(Lang.mescaline.nocactus, "error")
|
||||
end
|
||||
RegisterNetEvent("md-drugs:server:drymescaline", function()
|
||||
local src = source
|
||||
if not GetRecipe(src, 'mescaline', 'dry', 'dried') then return end
|
||||
Log(GetName(source) .. ' Dried Mescaline', 'mescaline')
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateUseableItem("driedmescaline", function(source, item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if Player.Functions.RemoveItem("driedmescaline", 1) then
|
||||
if RemoveItem(src, "driedmescaline", 1) then
|
||||
TriggerClientEvent("md-drugs:client:takemescaline", src)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Consumed Mescaline', 'consume')
|
||||
Log(GetName(source) .. ' Consumed Mescaline', 'consume')
|
||||
end
|
||||
end)
|
||||
+18
-36
@@ -2,64 +2,46 @@ local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
RegisterServerEvent('md-drugs:server:startcook', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if not Itemcheck(Player, 'ephedrine', 1, 'true') and Itemcheck(Player, 'acetone', 1, 'true') then return end
|
||||
Notifys("Adding Things To The Mix", "success")
|
||||
RemoveItem('ephedrine', 1)
|
||||
RemoveItem('acetone', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Started A Meth Batch', 'Meth')
|
||||
if not GetRecipe(source, 'meth', 'cook', 'heat') then return end
|
||||
Notifys(src, "Adding Things To The Mix", "success")
|
||||
Log(GetName(source) .. ' Started A Meth Batch', 'Meth')
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:givemethingridients', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local chance = math.random(1,100)
|
||||
local amount = math.random(1,5)
|
||||
if chance <= 50 then
|
||||
if AddItem('ephedrine', amount) then
|
||||
Notifys(Lang.meth.eph, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got ' .. amount .. ' Of Ephedrine', 'Meth')
|
||||
if AddItem(src,'ephedrine', amount) then
|
||||
Log(GetName(src) .. ' Got ' .. amount .. ' Of Ephedrine', 'Meth')
|
||||
end
|
||||
else
|
||||
if AddItem('acetone', amount) then
|
||||
Notifys(Lang.meth.ace, "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got ' .. amount .. ' Of Acetone', 'Meth')
|
||||
if AddItem(src, 'acetone', amount) then
|
||||
Log(GetName(src) .. ' Got ' .. amount .. ' Of Acetone', 'Meth')
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:getmeth', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local amount = math.random(1,5)
|
||||
|
||||
if RemoveItem("empty_weed_bag", amount) then
|
||||
AddItem("methbags", amount)
|
||||
Notifys("You Made " .. amount .. " Bags Of Meth!", "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bagged ' .. amount .. 'Of Meth', 'Meth')
|
||||
else
|
||||
Notifys(Lang.meth.nobag, "error")
|
||||
end
|
||||
local src = source
|
||||
if not GetRecipe(src, 'meth', 'bag', 'bags') then return end
|
||||
Log(GetName(src) .. ' Bagged 5 Of Meth', 'Meth')
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:geteph', function(num)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.MethEph[num]['loc']) then return end
|
||||
if AddItem('ephedrine', 1) then
|
||||
Notifys('Got Ephedrine!', "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got ' .. 1 .. 'Of Ephedrine', 'Meth')
|
||||
if CheckDist(src, Config.MethEph[num]['loc']) then return end
|
||||
if AddItem(src, 'ephedrine', 1) then
|
||||
Notifys(src, 'Got Ephedrine!', "success")
|
||||
Log(GetName(src) .. ' Got ' .. 1 .. 'Of Ephedrine', 'Meth')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:getace', function(num)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.Methace[num]['loc']) then return end
|
||||
if AddItem('acetone', 1) then
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got ' .. 1 .. 'Of Acetone', 'Meth')
|
||||
Notifys('Got Acetone!', "success")
|
||||
if CheckDist(src, Config.Methace[num]['loc']) then return end
|
||||
if AddItem(src, 'acetone', 1) then
|
||||
Log(GetName(src) .. ' Got ' .. 1 .. 'Of Acetone', 'Meth')
|
||||
Notifys(src, 'Got Acetone!', "success")
|
||||
end
|
||||
end)
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
RegisterServerEvent('md-drugs:server:payfortruck', function()
|
||||
lib.callback.register('md-drugs:server:payfortruck', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if Player.Functions.RemoveMoney('cash', Config.TruckPrice ) or Player.Functions.RemoveMoney('bank', Config.TruckPrice ) then
|
||||
TriggerClientEvent("md-drugs:Client:getoxylocation", src)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Rented A Van For OxyRuns', 'oxy')
|
||||
Log(GetName(src) .. ' Rented A Van For OxyRuns', 'oxy')
|
||||
return true
|
||||
else
|
||||
Notifys(Lang.oxy.broke, "error")
|
||||
Notifys(src, Lang.oxy.broke, "error")
|
||||
return false
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -22,19 +22,19 @@ RegisterServerEvent('md-drugs:server:giveoxybox', function()
|
||||
local item = Config.OxyRandItems[math.random(1, #Config.OxyRandItems)]
|
||||
|
||||
if chance <= Config.OxyRunDitchChance then
|
||||
Notifys(Lang.oxy.hot, "error")
|
||||
Notifys(src, Lang.oxy.hot, "error")
|
||||
Player.Functions.AddMoney("cash", cash * 0.5)
|
||||
if itemchance <= Config.OxyItemChance then
|
||||
AddItem(item, Config.OxyItemAmount)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got ' .. Config.OxyItemAmount .. ' Of ' .. item .. ' For This Drop Off', 'oxy')
|
||||
AddItem(src, item, Config.OxyItemAmount)
|
||||
Log(GetName(source) .. ' Got ' .. Config.OxyItemAmount .. ' Of ' .. item .. ' For This Drop Off', 'oxy')
|
||||
end
|
||||
else
|
||||
Notifys(Lang.oxy.next, "success")
|
||||
TriggerClientEvent("md-drugs:client:getoxylocationroute", src)
|
||||
Player.Functions.AddMoney("cash", cash)
|
||||
if itemchance <= Config.OxyItemChance then
|
||||
AddItem(item, Config.OxyItemAmount)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got ' .. Config.OxyItemAmount .. ' Of ' .. item .. ' For This Drop Off', 'oxy')
|
||||
AddItem(src, item, Config.OxyItemAmount)
|
||||
Log(GetName(source) .. ' Got ' .. Config.OxyItemAmount .. ' Of ' .. item .. ' For This Drop Off', 'oxy')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+36
-34
@@ -1,38 +1,43 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local function GetJob(source)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if Player.PlayerData.job.type == 'ems' then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
QBCore.Functions.CreateUseableItem('prescription_pad', function(source, item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if Player.PlayerData.job.type == 'ems' then
|
||||
if GetJob(src) then
|
||||
TriggerClientEvent("md-drugs:client:prescriptionpad", src, item)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:giveprescription', function(item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
Player.Functions.AddItem(item, 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Prescription Of ' .. item .. '!', 'pharma')
|
||||
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items[item], "add", 1)
|
||||
if GetJob(src) then
|
||||
AddItem(src, item, 1)
|
||||
Log(GetName(src) .. ' Made A Prescription Of ' .. item .. '!', 'pharma')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:unbottle', function(item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local amount = math.random(10,30)
|
||||
Player.Functions.AddItem(item, amount)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Unbottled '.. amount .. ' Of ' .. item .. '!', 'pharma')
|
||||
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items[item], "add", amount)
|
||||
AddItem(src, item, amount)
|
||||
Log(GetName(src) .. ' Unbottled '.. amount .. ' Of ' .. item .. '!', 'pharma')
|
||||
end)
|
||||
|
||||
local pharmabottle = {'vicodinbottle', 'adderalbottle','morphinebottle','xanaxbottle'}
|
||||
for m, d in pairs (pharmabottle) do
|
||||
QBCore.Functions.CreateUseableItem(d, function(source, item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if Player.Functions.RemoveItem(d, 1) then
|
||||
if RemoveItem(src, d, 1) then
|
||||
TriggerClientEvent("md-drugs:client:unbottle", src, item)
|
||||
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items[d], "remove", 1)
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -40,43 +45,40 @@ end
|
||||
local pharmadrugs = { "adderal", "vicodin", "xanax", "morphine"}
|
||||
for k, v in pairs (pharmadrugs) do QBCore.Functions.CreateUseableItem(v, function(source, item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if TriggerClientEvent('md-drugs:client:takepharma', src, item.name) then
|
||||
Player.Functions.RemoveItem(item.name, 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Took ' .. item.name .. '!', 'pharma')
|
||||
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items[item.name], "remove", 1)
|
||||
|
||||
if TriggerClientEvent('md-drugs:client:takepharma', src, item.name) then
|
||||
RemoveItem(src, item.name, 1)
|
||||
Log(GetName(source) .. ' Took ' .. item.name .. '!', 'pharma')
|
||||
end
|
||||
end)
|
||||
end
|
||||
RegisterServerEvent('md-drugs:server:fillprescription', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local vic = Player.Functions.GetItemByName('vicodin_prescription')
|
||||
local add = Player.Functions.GetItemByName('adderal_prescription')
|
||||
local mor = Player.Functions.GetItemByName('morphine_prescription')
|
||||
local xan = Player.Functions.GetItemByName('xanax_prescription')
|
||||
if vic then
|
||||
RemoveItem('vicodin_prescription', 1 )
|
||||
AddItem('vicodinbottle', 1)
|
||||
Notifys(Lang.Pharma.pills, "success")
|
||||
RemoveItem(src,'vicodin_prescription', 1 )
|
||||
AddItem(src,'vicodinbottle', 1)
|
||||
Notifys(src,Lang.Pharma.pills, "success")
|
||||
elseif add then
|
||||
RemoveItem('adderal_prescription', 1 )
|
||||
AddItem('adderalbottle', 1)
|
||||
Notifys(Lang.Pharma.pills, "success")
|
||||
RemoveItem(src,'adderal_prescription', 1 )
|
||||
AddItem(src,'adderalbottle', 1)
|
||||
Notifys(src,Lang.Pharma.pills, "success")
|
||||
elseif mor then
|
||||
RemoveItem('morphine_prescription', 1 )
|
||||
AddItem('morphinebottle', 1)
|
||||
Notifys(Lang.Pharma.pills, "success")
|
||||
RemoveItem(src,'morphine_prescription', 1 )
|
||||
AddItem(src,'morphinebottle', 1)
|
||||
Notifys(src,Lang.Pharma.pills, "success")
|
||||
|
||||
elseif xan then
|
||||
RemoveItem('xanax_prescription', 1 )
|
||||
AddItem('xanaxbottle', 1)
|
||||
Notifys(Lang.Pharma.pills, "success")
|
||||
RemoveItem(src,'xanax_prescription', 1 )
|
||||
AddItem(src,'xanaxbottle', 1)
|
||||
Notifys(src,Lang.Pharma.pills, "success")
|
||||
|
||||
else
|
||||
Notifys(Lang.Pharma.no, "error")
|
||||
Notifys(src,Lang.Pharma.no, "error")
|
||||
end
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Filled A Prescription!', 'pharma')
|
||||
Log(GetName(src) .. ' Filled A Prescription!', 'pharma')
|
||||
end)
|
||||
@@ -0,0 +1,169 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local recipe = {
|
||||
cocaine = {
|
||||
cokepowder = {
|
||||
tier1 = {take = {coca_leaf = 1}, give = {coke = 1}},
|
||||
tier2 = {take = {coca_leaf = 1}, give = {cokestagetwo = 1}},
|
||||
tier3 = {take = {coca_leaf = 1}, give = {cokestagethree = 1}},
|
||||
},
|
||||
cutcoke = {
|
||||
tier1 = {take = {coke = 1, bakingsoda = 1}, give = {loosecoke = 1}},
|
||||
tier2 = {take = {cokestagetwo = 1, bakingsoda = 1}, give = {loosecokestagetwo = 1}},
|
||||
tier3 = {take = {cokestagethree = 1, bakingsoda = 1}, give = {loosecokestagethree = 1}},
|
||||
},
|
||||
bagcoke = {
|
||||
tier1 = {take = {loosecoke = 1, empty_weed_bag = 1}, give = {cokebaggy = 1}},
|
||||
tier2 = {take = {loosecokestagetwo = 1, empty_weed_bag = 1}, give = {cokebaggystagetwo = 1}},
|
||||
tier3 = {take = {loosecokestagethree = 1, empty_weed_bag = 1}, give = {cokebaggystagethree = 1}},
|
||||
}
|
||||
},
|
||||
crack = {
|
||||
cookcrack = {
|
||||
tier1 = {take = {loosecoke = 1, bakingsoda = 1}, give = {crackrock = 1}},
|
||||
tier2 = {take = {loosecokestagetwo = 1, bakingsoda = 1}, give = {crackrockstagetwo = 1}},
|
||||
tier3 = {take = {loosecokestagethree = 1,bakingsoda = 1}, give = {crackrockstagethree = 1}},
|
||||
},
|
||||
bagcrack = {
|
||||
tier1 = {take = {crackrock = 1, empty_weed_bag = 1}, give = {baggedcracked = 1}},
|
||||
tier2 = {take = {crackrockstagetwo = 1, empty_weed_bag = 1}, give = {baggedcrackedstagetwo = 1}},
|
||||
tier3 = {take = {crackrockstagethree = 1, empty_weed_bag = 1}, give = {baggedcrackedstagethree = 1}},
|
||||
}
|
||||
},
|
||||
heroin = {
|
||||
dryheroin = {
|
||||
tier1 = {take = {poppyresin = 1}, give = {heroin = 1}},
|
||||
tier2 = {take = {poppyresin = 1}, give = {heroinstagetwo = 1}},
|
||||
tier3 = {take = {poppyresin = 1}, give = {heroinstagethree = 1}},
|
||||
},
|
||||
cutheroin = {
|
||||
tier1 = {take = {heroin = 1, bakingsoda = 1}, give = {heroincut = 1}},
|
||||
tier2 = {take = {heroinstagetwo = 1, bakingsoda = 1}, give = {heroincutstagetwo = 1}},
|
||||
tier3 = {take = {heroinstagethree = 1, bakingsoda = 1}, give = {heroincutstagethree = 1}},
|
||||
},
|
||||
fillvial = {
|
||||
tier1 = {take = {heroincut = 1, emptyvial = 1}, give = {heroinvial = 1}},
|
||||
tier2 = {take = {heroincutstagetwo = 1, emptyvial = 1}, give = {heroinvialstagetwo = 1}},
|
||||
tier3 = {take = {heroincutstagethree = 1, emptyvial = 1}, give = {heroinvialstagethree = 1}},
|
||||
},
|
||||
fillneedle = {
|
||||
tier1 = {take = {heroinvial = 1, needle = 1}, give = {heroin_ready = 1}},
|
||||
tier2 = {take = {heroin_readystagetwo = 1, needle = 1}, give = {heroin_readystagetwo = 1}},
|
||||
tier3 = {take = {heroinvialstagethree = 1, needle = 1}, give = {heroin_readystagethree = 1}},
|
||||
}
|
||||
},
|
||||
lsd = {
|
||||
vial = {
|
||||
heat = {take = {lysergic_acid = 1, diethylamide = 1,}, give = {lsd_vial_one = 1}}
|
||||
},
|
||||
|
||||
},
|
||||
mescaline = {
|
||||
dry = {
|
||||
dried = {take = {cactusbulb = 1}, give = {driedmescaline = 1} }
|
||||
}
|
||||
},
|
||||
lean = {
|
||||
cups = {
|
||||
cupoflean = {take = {leancup = 1, sprunk = 1, mdlean = 1}, give = {cupoflean = 1}},
|
||||
cupofdextro = {take = {leancup = 1, sprunk = 1, mdreddextro = 1}, give = {cupofdextro = 1}},
|
||||
}
|
||||
},
|
||||
meth = {
|
||||
cook = {
|
||||
heat = {take = {ephedrine = 1, acetone = 1}, give = {}}
|
||||
},
|
||||
bag = {
|
||||
bags = {take = {empty_weed_bag = 5}, give = {methbags = 5} }
|
||||
}
|
||||
},
|
||||
weed = {
|
||||
edibles = {
|
||||
cannabutter = {take = { mdbutter = 1, grindedweed = 1}, give = {cannabutter = 1}},
|
||||
specialbrownie = {take = { cannabutter = 1, flour = 1, chocolate = 1}, give = {specialbrownie = 1}},
|
||||
specialcookie = { take = { cannabutter = 1, flour = 1}, give = {specialcookie = 1}},
|
||||
specialchocolate = { take = { cannabutter = 1, chocolate = 1}, give = {specialchocolate = 1}},
|
||||
specialmuffin = { take = { cannabutter = 1, flour = 1}, give = {specialmuffin = 1}},
|
||||
},
|
||||
oil = {
|
||||
shatter = {take = {butane = 1, grindedweed = 1}, give = {'shatter'}}
|
||||
},
|
||||
blunts = {
|
||||
blunt = {take = {bluntwrap = 1, grindedweed = 1}, give = {blunt = 1}},
|
||||
chewyblunt = {take = {bluntwrap = 1, grindedweed = 1, loosecoke = 1}, give = {chewyblunt = 1}},
|
||||
leanblunts = {take = {leanbluntwrap = 1, grindedweed = 1}, give = {leanblunts = 1}},
|
||||
dextroblunts = {take = {dextrobluntwrap = 1, grindedweed = 1}, give = {dextroblunts = 1}}
|
||||
},
|
||||
bluntwrap = {
|
||||
leanbluntwrap = {take = {bluntwrap = 5, mdlean = 1}, give = {leanbluntwrap = 5}},
|
||||
dextrobluntwrap = {take = {bluntwrap = 5, mdreddextro = 1}, give = {dextrobluntwrap = 5}},
|
||||
}
|
||||
},
|
||||
xtc = {
|
||||
raw = {
|
||||
raw_xtc = {take = {mdp2p = 1, isosafrole = 1}, give = {raw_xtc = 1}}
|
||||
},
|
||||
singlestack = {
|
||||
white = {take = {raw_xtc = 1}, give = {white_xtc = 1}},
|
||||
red = {take = {raw_xtc = 1, loosecoke = 1 }, give = {red_xtc = 1}},
|
||||
orange = {take = {raw_xtc = 1, heroinvial = 1}, give = {orange_xtc = 1}},
|
||||
blue = {take = {raw_xtc = 1, crackrock = 1 }, give = {blue_xtc = 1}},
|
||||
},
|
||||
dualstack = {
|
||||
white = {take = {raw_xtc = 1}, give = {white_xtc2 = 1}},
|
||||
red = {take = {raw_xtc = 1, loosecoke = 1}, give = {red_xtc2 = 1}},
|
||||
orange = {take = {raw_xtc = 1, heroinvial = 1}, give = {orange_xtc2 = 1}},
|
||||
blue = {take = {raw_xtc = 1, crackrock = 1}, give = {blue_xtc2 = 1}},
|
||||
},
|
||||
triplestack = {
|
||||
white = {take = {raw_xtc = 1}, give = {white_xtc3 = 1}},
|
||||
red = {take = {raw_xtc = 1, loosecoke = 1}, give = {red_xtc3 = 1}},
|
||||
orange = {take = {raw_xtc = 1, heroinvial = 1}, give = {orange_xtc3 = 1}},
|
||||
blue = {take = {raw_xtc = 1, crackrock = 1}, give = {blue_xtc3 = 1}},
|
||||
},
|
||||
quadstack = {
|
||||
white = {take = {raw_xtc = 1}, give = {white_xtc4 = 1}},
|
||||
red = {take = {raw_xtc = 1, loosecoke = 1}, give = {red_xtc4 = 1}},
|
||||
orange = {take = {raw_xtc = 1, heroinvial = 1}, give = {orange_xtc4 = 1}},
|
||||
blue = {take = {raw_xtc = 1, crackrock = 1}, give = {blue_xtc4 = 1}},
|
||||
},
|
||||
press = {
|
||||
dual = {take = {white_xtc = 20, blue_xtc = 20, red_xtc = 20, orange_xtc = 20, singlepress = 1}, give = {dualpress = 1}},
|
||||
triple = {take = {white_xtc2 = 50, blue_xtc2 = 50, red_xtc2 = 50, orange_xtc2 = 50, dualpress = 1}, give = {triplepres = 1}},
|
||||
quad = { take = {white_xtc3 = 50, blue_xtc3 = 50, red_xtc3 = 50, orange_xtc3 = 50, triplepress = 1}, give = {quadpress = 1}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function GetRecipe(source, type, method, tier)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local has = 0
|
||||
local need = 0
|
||||
for k, v in pairs (recipe[type][method][tier].take) do
|
||||
local item = Player.Functions.GetItemByName(k)
|
||||
if item and item.amount >= v then
|
||||
has = has + 1
|
||||
else
|
||||
Notifys(src, ' You Need ' .. v .. ' Of ' .. GetLabels(k) .. ' To Do This', 'error')
|
||||
end
|
||||
need = need + 1
|
||||
end
|
||||
if has == need then
|
||||
for k, v in pairs (recipe[type][method][tier].take) do
|
||||
RemoveItem(src, k, v)
|
||||
end
|
||||
for k,v in pairs (recipe[type][method][tier].give) do
|
||||
AddItem(src, k, v)
|
||||
end
|
||||
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
lib.callback.register('md-drugs:server:GetRecipe', function(source, type, cat)
|
||||
if not source then return false end
|
||||
return recipe[type][cat]
|
||||
end)
|
||||
+6
-10
@@ -24,27 +24,23 @@ end
|
||||
RegisterNetEvent("shrooms:pickupCane")
|
||||
AddEventHandler("shrooms:pickupCane", function(loc)
|
||||
local chance = math.random(1,10)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.shrooms[loc].location) then return end
|
||||
if CheckDist(source, Config.shrooms[loc].location) then return end
|
||||
if not Config.shrooms[loc].taken then
|
||||
Config.shrooms[loc].taken = true
|
||||
GlobalState.shrooms = Config.shrooms
|
||||
TriggerClientEvent("shrooms:removeCane", -1, loc)
|
||||
shroomsCooldown(loc)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
AddItem('shrooms', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked A Shroom With a distance of ' .. dist(source, playerPed, Config.shrooms[loc].location) .. ' vectors', 'shrooms')
|
||||
AddItem(source, 'shrooms', 1)
|
||||
Log(GetName(source) .. ' Picked A Shroom With a distance of ' .. dist(source, Config.shrooms[loc].location) .. ' vectors', 'shrooms')
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateUseableItem('shrooms', function(source, item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if TriggerClientEvent('md-drugs:client:takeshrooms', src, item.name) then
|
||||
Player.Functions.RemoveItem('shrooms', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Took Some Mushrooms', 'shrooms')
|
||||
TriggerClientEvent("QBCore:Notify", src, Lang.Shrooms.trip, 'success')
|
||||
RemoveItem(src, 'shrooms', 1)
|
||||
Log(GetName(source) .. ' Took Some Mushrooms', 'shrooms')
|
||||
Notifys(src, 'You Took Some Shrooms!', 'success')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local loc = math.random(1, #Config.Travellingmerchant)
|
||||
RegisterServerEvent("md-drugs:server:travellingmerchantox", function(amount, money, item, price,table,num)
|
||||
local src = source local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if not table[num]['name'] == item then return end
|
||||
if Player.Functions.RemoveMoney(tostring(money), tonumber(price) * tonumber(amount)) then
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "add", amount)
|
||||
Player.Functions.AddItem(item, amount)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant')
|
||||
AddItem(source, item, amount)
|
||||
Log(GetName(source) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant')
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
lib.callback.register('md-drugs:server:GetMerchant', function(source)
|
||||
return loc
|
||||
end)
|
||||
+34
-237
@@ -22,245 +22,53 @@ end
|
||||
|
||||
RegisterNetEvent("weed:pickupCane")
|
||||
AddEventHandler("weed:pickupCane", function(loc)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.WeedPlant[loc].location) then return end
|
||||
local src = source
|
||||
if not Config.WeedPlant[loc].taken then
|
||||
Config.WeedPlant[loc].taken = true
|
||||
GlobalState.WeedPlant = Config.WeedPlant
|
||||
TriggerClientEvent("weed:removeCane", -1, loc)
|
||||
WeedCooldown(loc)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
AddItem('wetcannabis', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked Weed With a distance of ' .. dist(source, playerPed, Config.WeedPlant[loc].location) .. ' vectors', 'weed')
|
||||
AddItem(src, 'wetcannabis', 1)
|
||||
Log(GetName(source) .. ' Picked Weed With a distance of ' .. dist(source, Config.WeedPlant[loc].location) .. ' vectors', 'weed')
|
||||
|
||||
end
|
||||
end)
|
||||
--------------- events
|
||||
|
||||
RegisterServerEvent('md-drugs:server:dryoutweed', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if RemoveItem("wetcannabis", 1) then
|
||||
AddItem("drycannabis", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Dried Weed', 'weed')
|
||||
if RemoveItem(src,"wetcannabis", 1) then
|
||||
AddItem(src,"drycannabis", 1)
|
||||
Log(GetName(source) .. ' Dried Weed', 'weed')
|
||||
else
|
||||
Notifys(Lang.Weed.nodry, "error")
|
||||
Notifys(src, Lang.Weed.nodry, "error")
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterServerEvent('md-drugs:server:makebutter', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local recipe = {'mdbutter', 'grindedweed'}
|
||||
local have = 0
|
||||
for k, v in pairs (recipe) do
|
||||
if Itemcheck(Player, v, 1, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 2 then
|
||||
RemoveItem('mdbutter', 1)
|
||||
RemoveItem('grindedweed', 1)
|
||||
AddItem('cannabutter', 1 )
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Canna Butter ', 'weed')
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterServerEvent('md-drugs:server:makebrownies', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local recipe = {'cannabutter', 'flour', 'chocolate' }
|
||||
local have = 0
|
||||
for k, v in pairs (recipe) do
|
||||
if Itemcheck(Player, v, 1, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 3 then
|
||||
RemoveItem('cannabutter', 1)
|
||||
RemoveItem('flour', 1)
|
||||
RemoveItem('chocolate', 1)
|
||||
AddItem('specialbrownie', 1 )
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Special Brownies ', 'weed')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:makecookies', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local recipe = {'cannabutter', 'flour' }
|
||||
local have = 0
|
||||
for k, v in pairs (recipe) do
|
||||
if Itemcheck(Player, v, 1, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 2 then
|
||||
RemoveItem('cannabutter', 1)
|
||||
RemoveItem('flour', 1)
|
||||
AddItem('specialcookie', 1 )
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Special Cookies ', 'weed')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:makechocolate', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local recipe = {'cannabutter', 'chocolate' }
|
||||
local have = 0
|
||||
for k, v in pairs (recipe) do
|
||||
if Itemcheck(Player, v, 1, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 2 then
|
||||
RemoveItem('cannabutter', 1)
|
||||
RemoveItem('chocolate', 1)
|
||||
AddItem('specialchocolate', 1 )
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Special Chocolate ', 'weed')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:makemuffin', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local recipe = {'cannabutter', 'flour' }
|
||||
local have = 0
|
||||
for k, v in pairs (recipe) do
|
||||
if Itemcheck(Player, v, 1, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 2 then
|
||||
RemoveItem('cannabutter', 1)
|
||||
RemoveItem('flour', 1)
|
||||
AddItem('specialmuffin', 1 )
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Special Muffin ', 'weed')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:makeoil', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local recipe = {'grindedweed', 'butane' }
|
||||
local have = 0
|
||||
for k, v in pairs (recipe) do
|
||||
if Itemcheck(Player, v, 1, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 2 then
|
||||
RemoveItem('butane', 1)
|
||||
RemoveItem('grindedweed', 1)
|
||||
AddItem('shatter', 1 )
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Shatter ', 'weed')
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
RegisterServerEvent('md-drugs:server:rollblunt', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local recipe = {'bluntwrap', 'grindedweed' }
|
||||
local have = 0
|
||||
for k, v in pairs (recipe) do
|
||||
if Itemcheck(Player, v, 1, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 2 then
|
||||
TriggerClientEvent("md-drugs:client:rollanim", src)
|
||||
RemoveItem('bluntwrap', 1)
|
||||
RemoveItem('grindedweed', 1)
|
||||
AddItem('blunt', 1 )
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Rolled A Blunt ', 'weed')
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:rollleanblunt', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local chance = math.random(1,10)
|
||||
local recipe = {'bluntwrap', 'mdlean' }
|
||||
local have = 0
|
||||
for k, v in pairs (recipe) do
|
||||
if Itemcheck(Player, v, 1, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 2 then
|
||||
TriggerClientEvent("md-drugs:client:rollanim", src)
|
||||
RemoveItem("bluntwrap", 1)
|
||||
AddItem("leanbluntwrap", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Rolled A Lean Blunt ', 'weed')
|
||||
if chance > 8 then
|
||||
RemoveItem("mdlean", 1)
|
||||
end
|
||||
local bluntwrap = {'mdreddextro','mdlean'}
|
||||
for k, v in pairs (bluntwrap) do
|
||||
QBCore.Functions.CreateUseableItem(v, function(source, item)
|
||||
local src = source
|
||||
TriggerClientEvent('md-drugs:client:makeBluntWrap', src)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:rolldextroblunt', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local chance = math.random(1,10)
|
||||
local chance = math.random(1,10)
|
||||
local recipe = {'mdreddextro', 'mdlean' }
|
||||
local have = 0
|
||||
for k, v in pairs (recipe) do
|
||||
if Itemcheck(Player, v, 1, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 2 then
|
||||
RemoveItem("bluntwrap", 1)
|
||||
AddItem("dextrobluntwrap", 1)
|
||||
TriggerClientEvent("md-drugs:client:rollanim", src)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Rolled A Dextro Blunt ', 'weed')
|
||||
if chance > 8 then
|
||||
Player.Functions.RemoveItem("mdreddextro", 1)
|
||||
end
|
||||
local bluntwraps = {'leanbluntwrap', 'dextrobluntwrap', 'bluntwrap'}
|
||||
|
||||
for k, v in pairs (bluntwraps) do
|
||||
QBCore.Functions.CreateUseableItem(v, function(source, item)
|
||||
local src = source
|
||||
TriggerClientEvent('md-drugs:client:rollBlunt', source)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:rollchewyblunt', function()
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local recipe = {'bluntwrap', 'loosecoke', 'grindedweed' }
|
||||
local have = 0
|
||||
for k, v in pairs (recipe) do
|
||||
if Itemcheck(Player, v, 1, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 3 then
|
||||
RemoveItem("bluntwrap", 1)
|
||||
RemoveItem("loosecoke", 1)
|
||||
RemoveItem("grindedweed", 1)
|
||||
AddItem("chewyblunt", 1)
|
||||
TriggerClientEvent("md-drugs:client:rollanim", src)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Rolled A Chewy Blunt ', 'weed')
|
||||
|
||||
end
|
||||
end)
|
||||
------------------------ usuable items
|
||||
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)
|
||||
Player.Functions.RemoveItem("leanbluntwrap", 1)
|
||||
Player.Functions.AddItem('leanblunts', 1)
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['leanblunts'], "add", 1)
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['grindedweed'], "remove", 1)
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['leanbluntwrap'], "remove", 1)
|
||||
|
||||
end
|
||||
else
|
||||
Notifys(Lang.Weed.noweed, "error")
|
||||
end
|
||||
end)
|
||||
QBCore.Functions.CreateUseableItem("dextrobluntwrap", 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)
|
||||
Player.Functions.RemoveItem("dextrobluntwrap", 1)
|
||||
Player.Functions.AddItem('dextroblunts', 1)
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['dextroblunts'], "add", 1)
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['grindedweed'], "remove", 1)
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['dextrobluntwrap'], "remove", 1)
|
||||
end
|
||||
else
|
||||
Notifysu('You Need Keef', 'error', src)
|
||||
end
|
||||
RegisterServerEvent('md-drugs:server:MakeWeedItems', function(data)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if not Player then return end
|
||||
if not GetRecipe(src, data.recipe, data.table, data.item) then return end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateUseableItem("dabrig", function(source, item)
|
||||
@@ -268,29 +76,20 @@ local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if Player.Functions.GetItemByName("butanetorch") then
|
||||
if RemoveItemu("shatter", 1, src) then
|
||||
Notifysu('test', 'success', src)
|
||||
if RemoveItem(src, "shatter", 1) then
|
||||
Notifys(src, 'test', 'success')
|
||||
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)
|
||||
TriggerClientEvent('md-drugs:client:bluntwraps', src)
|
||||
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)
|
||||
if RemoveItem(src, "drycannabis",1 ) then
|
||||
AddItem(src, "grindedweed", 1)
|
||||
TriggerClientEvent("md-drugs:client:grind", src)
|
||||
else
|
||||
Notifysu('You Need Dried Weed', 'error', src)
|
||||
Notifys(src,'You Need Dried Weed', 'error')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -299,11 +98,9 @@ local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
TriggerClientEvent("md-drugs:client:rollanim", src)
|
||||
Wait(4000)
|
||||
if Player.Functions.RemoveItem("mdwoods",1 ) then
|
||||
Player.Functions.AddItem("bluntwrap", 5)
|
||||
Player.Functions.AddItem("tobacco", 5)
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["bluntwrap"], "add", 1)
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["tobacco"], "add", 1)
|
||||
if RemoveItem(src, "mdwoods",1 ) then
|
||||
AddItem(src, "bluntwrap", 5)
|
||||
AddItem(src, "tobacco", 5)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ RegisterServerEvent('md-drugs:server:wholesalecoke', function()
|
||||
local removed = Player.Functions.RemoveItem(v, item.amount)
|
||||
Player.Functions.AddMoney("cash", item.amount * price)
|
||||
Notifys("You received " .. item.amount * price .. " Dollars!" , "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Wholesaled Drugs ', 'wholesale')
|
||||
Log(GetName(source) .. ' Wholesaled Drugs ', 'wholesale')
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -47,7 +47,7 @@ RegisterServerEvent('md-drugs:server:wholesalecrack', function()
|
||||
local removed = Player.Functions.RemoveItem(v, item.amount)
|
||||
Player.Functions.AddMoney("cash", item.amount * price)
|
||||
Notifys("You received " .. item.amount * price .. " Dollars!" , "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Wholesaled Drugs ', 'wholesale')
|
||||
Log(GetName(source) .. ' Wholesaled Drugs ', 'wholesale')
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -73,7 +73,7 @@ RegisterServerEvent('md-drugs:server:wholesalelsd', function()
|
||||
local removed = Player.Functions.RemoveItem(v, item.amount)
|
||||
Player.Functions.AddMoney("cash", item.amount * price)
|
||||
Notifys("You received " .. item.amount * price .. " Dollars!" , "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Wholesaled Drugs ', 'wholesale')
|
||||
Log(GetName(source) .. ' Wholesaled Drugs ', 'wholesale')
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -98,7 +98,7 @@ RegisterServerEvent('md-drugs:server:wholesaleheroin', function()
|
||||
local removed = Player.Functions.RemoveItem(v, item.amount)
|
||||
Player.Functions.AddMoney("cash", item.amount * price)
|
||||
Notifys("You received " .. item.amount * price .. " Dollars!" , "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Wholesaled Drugs ', 'wholesale')
|
||||
Log(GetName(source) .. ' Wholesaled Drugs ', 'wholesale')
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -122,7 +122,7 @@ RegisterServerEvent('md-drugs:server:wholesalextc', function()
|
||||
local removed = Player.Functions.RemoveItem(v, item.amount)
|
||||
Player.Functions.AddMoney("cash", item.amount * price)
|
||||
Notifys("You received " .. item.amount * price .. " Dollars!" , "success")
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Wholesaled Drugs ', 'wholesale')
|
||||
Log(GetName(source) .. ' Wholesaled Drugs ', 'wholesale')
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
+119
-223
@@ -3,23 +3,21 @@ local QBCore = exports['qb-core']:GetCoreObject()
|
||||
RegisterServerEvent('md-drugs:server:stealisosafrole', function(num)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.isosafrole[num]['loc']) then return end
|
||||
if AddItem("isosafrole", 1) then
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stole isosafrole with a distance of ' .. dist(source, playerPed, Config.isosafrole[num]['loc']) .. ' vectors!', 'xtc')
|
||||
if CheckDist(source, Config.isosafrole[num]['loc']) 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)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:stealmdp2p', function(num)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.mdp2p[num]['loc']) then return end
|
||||
if AddItem("mdp2p", 1) then
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stole MDP2P with a distance of ' .. dist(source, playerPed, Config.mdp2p[num]['loc']) .. ' vectors!', 'xtc')
|
||||
|
||||
if CheckDist(source, Config.mdp2p[num]['loc']) 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)
|
||||
|
||||
local presses = {
|
||||
{item = 'singlepress', data = 'single'},
|
||||
{item = 'dualpress', data = 'dual'},
|
||||
@@ -30,10 +28,9 @@ for k, v in pairs (presses) do
|
||||
QBCore.Functions.CreateUseableItem(v.item, function(source, item)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if TriggerClientEvent("md-drugs:client:setpress", src, v.data) then
|
||||
Player.Functions.RemoveItem(v.item, 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Placed A ' .. v.item .. ' At ' .. GetEntityCoords(playerPed) .. '!', 'xtc')
|
||||
RemoveItem(src, v.item, 1)
|
||||
Log(GetName(source) .. ' Placed A ' .. v.item .. ' At ' .. GetCoords(source) .. '!', 'xtc')
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -41,23 +38,22 @@ end
|
||||
RegisterServerEvent('md-drugs:server:getpressback', function(type)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if type == 'single' then
|
||||
if Player.Functions.GetItemByName('singlepress') then Notifys('You Already Have A Kit') return end
|
||||
AddItem('singlepress', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked Their Single Press At ' .. GetEntityCoords(playerPed) .. '!', 'xtc')
|
||||
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('You Already Have A Kit') return end
|
||||
AddItem('dualpress', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked Their Dual Press At ' .. GetEntityCoords(playerPed) .. '!', 'xtc')
|
||||
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('You Already Have A Kit') return end
|
||||
AddItem('triplepress', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked Their Triple Press At ' .. GetEntityCoords(playerPed) .. '!', 'xtc')
|
||||
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('You Already Have A Kit') return end
|
||||
AddItem('quadpress', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Picked Their Quad Press At ' .. GetEntityCoords(playerPed) .. '!', 'xtc')
|
||||
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')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -65,118 +61,62 @@ end)
|
||||
RegisterServerEvent('md-drugs:server:makextc', function(data)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if not Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(src, 'raw_xtc', 1) then return end
|
||||
if data.data == 'single' then
|
||||
if data.color == 'white' then
|
||||
if RemoveItem('raw_xtc', 1) then
|
||||
AddItem('white_xtc', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Single Stack White Pill!', 'xtc')
|
||||
end
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'loosecoke', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('loosecoke', 1)
|
||||
AddItem('red_xtc', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Single Stack Red Pill!', 'xtc')
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'heroinvial', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('heroinvial', 1)
|
||||
AddItem('orange_xtc', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Single Stack Orange Pill!', 'xtc')
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'crackrock', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('crackrock', 1)
|
||||
AddItem('blue_xtc', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Single Stack Blue Pill!', 'xtc')
|
||||
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
|
||||
if data.color == 'white' then
|
||||
if RemoveItem('raw_xtc', 1) then
|
||||
AddItem('white_xtc2', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Dual Stack White Pill!', 'xtc')
|
||||
end
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'loosecoke', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('loosecoke', 1)
|
||||
AddItem('red_xtc2', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Dual Stack Red Pill!', 'xtc')
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'heroinvial', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('heroinvial', 1)
|
||||
AddItem('orange_xtc2', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Dual Stack Orange Pill!', 'xtc')
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'crackrock', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('crackrock', 1)
|
||||
AddItem('blue_xtc2', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Dual Stack Blue Pill!', 'xtc')
|
||||
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
|
||||
if data.color == 'white' then
|
||||
if RemoveItem('raw_xtc', 1) then
|
||||
AddItem('white_xtc3', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Triple Stack White Pill!', 'xtc')
|
||||
end
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'loosecoke', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('loosecoke', 1)
|
||||
AddItem('red_xtc3', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Triple Stack Red Pill!', 'xtc')
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'heroinvial', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('heroinvial', 1)
|
||||
AddItem('orange_xtc3', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Triple Stack Orange Pill!', 'xtc')
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'crackrock', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('crackrock', 1)
|
||||
AddItem('blue_xtc3', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Triple Stack Blue Pill!', 'xtc')
|
||||
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
|
||||
if data.color == 'white' then
|
||||
if RemoveItem('raw_xtc', 1) then
|
||||
AddItem('white_xtc4', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Quad Stack White Pill!', 'xtc')
|
||||
end
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'loosecoke', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('loosecoke', 1)
|
||||
AddItem('red_xtc4', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Quad Stack Red Pill!', 'xtc')
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'heroinvial', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('heroinvial', 1)
|
||||
AddItem('orange_xtc4', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Quad Stack Orange Pill!', 'xtc')
|
||||
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 Itemcheck(Player, 'raw_xtc', 1, 'true') then return end
|
||||
if not Itemcheck(Player, 'crackrock', 1, 'true') then return end
|
||||
RemoveItem('raw_xtc', 1)
|
||||
RemoveItem('crackrock', 1)
|
||||
AddItem('blue_xtc4', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made A Quad Stack Blue Pill!', 'xtc')
|
||||
if not GetRecipe(src, 'xtc', 'quadstack', 'blue') then return end
|
||||
Log(GetName(source) .. ' Made A Quad Stack Blue Pill!', 'xtc')
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -186,8 +126,8 @@ RegisterServerEvent('md-drugs:server:buypress', function()
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if Player.Functions.RemoveMoney("cash", 20000) then
|
||||
AddItem("singlepress", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Bought A Pill Press', 'xtc')
|
||||
AddItem(src, "singlepress", 1)
|
||||
Log(GetName(source) .. ' Bought A Pill Press', 'xtc')
|
||||
else
|
||||
Notifys(Lang.xtc.cash, "error")
|
||||
end
|
||||
@@ -195,58 +135,19 @@ RegisterServerEvent('md-drugs:server:buypress', function()
|
||||
|
||||
RegisterServerEvent('md-drugs:server:upgradepress', function(data)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
|
||||
if CheckDist(source, playerPed, Config.buypress) then return end
|
||||
if CheckDist(source, Config.buypress) then return end
|
||||
if data == 'dual' then
|
||||
local have = 0
|
||||
local pill = {'white_xtc', 'blue_xtc', 'red_xtc', 'orange_xtc'}
|
||||
for k, v in pairs (pill) do
|
||||
if Itemcheck(Player, v, 20, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 4 then
|
||||
if not Itemcheck(Player, 'singlepress', 1, 'true') then return end
|
||||
RemoveItem('white_xtc', 20)
|
||||
RemoveItem('blue_xtc', 20)
|
||||
RemoveItem('red_xtc', 20)
|
||||
RemoveItem('orange_xtc', 20)
|
||||
RemoveItem('singlepress', 1)
|
||||
AddItem('dualpress', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Upgraded Press To Dual Press', 'xtc')
|
||||
end
|
||||
if not GetRecipe(src, 'xtc', 'press', 'dual') then return end
|
||||
Log(GetName(source) .. ' Upgraded Press To Dual Press', 'xtc')
|
||||
elseif data == 'triple' then
|
||||
local have = 0
|
||||
local pill = {'white_xtc2', 'blue_xtc2', 'red_xtc2', 'orange_xtc2'}
|
||||
for k, v in pairs (pill) do
|
||||
if Itemcheck(Player, v, 50, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 4 then
|
||||
RemoveItem('dualpress', 1)
|
||||
RemoveItem('white_xtc2', 50)
|
||||
RemoveItem('blue_xtc2', 50)
|
||||
RemoveItem('red_xtc2', 50)
|
||||
RemoveItem('orange_xtc2', 50)
|
||||
AddItem('triplepress', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Upgraded Press To Triple Press', 'xtc')
|
||||
end
|
||||
if not GetRecipe(src, 'xtc', 'press', 'triple') then return end
|
||||
Log(GetName(source) .. ' Upgraded Press To Triple Press', 'xtc')
|
||||
elseif data == 'quad' then
|
||||
local have = 0
|
||||
local pill = {'white_xtc3', 'blue_xtc3', 'red_xtc3', 'orange_xtc3'}
|
||||
for k, v in pairs (pill) do
|
||||
if Itemcheck(Player, v, 150, 'true') then have = have + 1 end
|
||||
end
|
||||
if have == 4 then
|
||||
RemoveItem('triplepress', 1)
|
||||
RemoveItem('white_xtc3', 150)
|
||||
RemoveItem('blue_xtc3', 150)
|
||||
RemoveItem('red_xtc3', 150)
|
||||
RemoveItem('orange_xtc3', 150)
|
||||
AddItem('quadpress', 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Upgraded Press To Quad Press', 'xtc')
|
||||
end
|
||||
if not GetRecipe(src, 'xtc', 'press', 'quad') then return end
|
||||
Log(GetName(source) .. ' Upgraded Press To Quad Press', 'xtc')
|
||||
else
|
||||
Notify('huh', 'error')
|
||||
Notifys(src, 'huh', 'error')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -254,13 +155,9 @@ end)
|
||||
RegisterServerEvent('md-drugs:server:makingrawxtc', function(num)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.rawxtcloc[num]['loc']) then return end
|
||||
if not Itemcheck(Player, 'mdp2p', 1, 'true') and not Itemcheck(Player, 'isosafrole', 1, 'true') then return end
|
||||
RemoveItem('mdp2p', 1)
|
||||
RemoveItem('isosafrole', 1)
|
||||
AddItem("raw_xtc", 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Made Raw XTC With A Distance Of ' .. dist(source, playerPed, Config.rawxtcloc[num]['loc']) .. '!', 'xtc')
|
||||
if CheckDist(source, Config.rawxtcloc[num]['loc']) 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)
|
||||
@@ -274,21 +171,20 @@ RegisterServerEvent('md-drugs:server:stampwhite', function(num)
|
||||
local chance3 = math.random(#one)
|
||||
local four = {'white_playboys4', 'white_aliens4', 'white_pl4', 'white_trolls4', 'white_cats4'}
|
||||
local chance4 = math.random(#one)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.stamp[num]['loc']) then return end
|
||||
if CheckDist(source, Config.stamp[num]['loc']) then return end
|
||||
|
||||
if Player.Functions.RemoveItem("white_xtc", 1) then
|
||||
AddItem(one[chance], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Single White Pill And Got ' .. one[chance] .. '!', 'xtc')
|
||||
elseif Player.Functions.RemoveItem("white_xtc2", 1) then
|
||||
AddItem(two[chance2], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Dual White Pill And Got ' .. two[chance2] .. '!', 'xtc')
|
||||
elseif Player.Functions.RemoveItem("white_xtc3", 1) then
|
||||
AddItem(three[chance3], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Triple White Pill And Got ' .. three[chance3] .. '!', 'xtc')
|
||||
elseif Player.Functions.RemoveItem("white_xtc4", 1) then
|
||||
AddItem(four[chance4], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Quad White Pill And Got ' .. four[chance4] .. '!', 'xtc')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
else
|
||||
Notifys('You Dont Have Unstamped White Pills', 'error')
|
||||
end
|
||||
@@ -306,20 +202,20 @@ RegisterServerEvent('md-drugs:server:stampred', function(num)
|
||||
local four = {'red_playboys4', 'red_aliens4', 'red_pl4', 'red_trolls4', 'red_cats4'}
|
||||
local chance4 = math.random(#one)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.stamp[num]['loc']) then return end
|
||||
if CheckDist(source, Config.stamp[num]['loc']) then return end
|
||||
|
||||
if Player.Functions.RemoveItem("red_xtc", 1) then
|
||||
AddItem(one[chance], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Single Red Pill And Got ' .. one[chance] .. '!', 'xtc')
|
||||
elseif Player.Functions.RemoveItem("red_xtc2", 1) then
|
||||
AddItem(two[chance2], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Dual Red Pill And Got ' .. two[chance2] .. '!', 'xtc')
|
||||
elseif Player.Functions.RemoveItem("red_xtc3", 1) then
|
||||
AddItem(three[chance3], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Triple Red Pill And Got ' .. three[chance3] .. '!', 'xtc')
|
||||
elseif Player.Functions.RemoveItem("red_xtc4", 1) then
|
||||
AddItem(four[chance4], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Quad Red Pill And Got ' .. four[chance4] .. '!', 'xtc')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
else
|
||||
Notifys('You Dont Have Unstamped red Pills', 'error')
|
||||
end
|
||||
@@ -337,20 +233,20 @@ RegisterServerEvent('md-drugs:server:stamporange', function(num)
|
||||
local four = {'orange_playboys4', 'orange_aliens4', 'orange_pl4', 'orange_trolls4', 'orange_cats4'}
|
||||
local chance4 = math.random(#one)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.stamp[num]['loc']) then return end
|
||||
if CheckDist(source, Config.stamp[num]['loc']) then return end
|
||||
|
||||
if Player.Functions.RemoveItem("orange_xtc", 1) then
|
||||
AddItem(one[chance], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Single Orange Pill And Got ' .. one[chance] .. '!', 'xtc')
|
||||
elseif Player.Functions.RemoveItem("orange_xtc2", 1) then
|
||||
AddItem(two[chance2], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Dual Orange Pill And Got ' .. two[chance2] .. '!', 'xtc')
|
||||
elseif Player.Functions.RemoveItem("orange_xtc3", 1) then
|
||||
AddItem(three[chance3], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Triple Orange Pill And Got ' .. three[chance3] .. '!', 'xtc')
|
||||
elseif Player.Functions.RemoveItem("orange_xtc4", 1) then
|
||||
AddItem(four[chance4], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Quad Orange Pill And Got ' .. four[chance4] .. '!', 'xtc')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
else
|
||||
Notifys('You Dont Have Unstamped orange Pills', 'error')
|
||||
end
|
||||
@@ -368,19 +264,19 @@ RegisterServerEvent('md-drugs:server:stampblue', function(num)
|
||||
local four = {'blue_playboys4', 'blue_aliens4', 'blue_pl4', 'blue_trolls4', 'blue_cats4'}
|
||||
local chance4 = math.random(#one)
|
||||
local playerPed = GetPlayerPed(source)
|
||||
if CheckDist(source, playerPed, Config.stamp[num]['loc']) then return end
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Single Blue Pill And Got ' .. one[chance] .. '!', 'xtc')
|
||||
if Player.Functions.RemoveItem("blue_xtc", 1) then
|
||||
AddItem(one[chance], 1)
|
||||
elseif Player.Functions.RemoveItem("blue_xtc2", 1) then
|
||||
AddItem(two[chance2], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Dual Blue Pill And Got ' .. two[chance2] .. '!', 'xtc')
|
||||
elseif Player.Functions.RemoveItem("blue_xtc3", 1) then
|
||||
AddItem(three[chance3], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Triple Blue Pill And Got ' .. three[chance3] .. '!', 'xtc')
|
||||
elseif Player.Functions.RemoveItem("blue_xtc4", 1) then
|
||||
AddItem(four[chance4], 1)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Stamped A Quad Blue Pill And Got ' .. four[chance4] .. '!', 'xtc')
|
||||
if CheckDist(source, Config.stamp[num]['loc']) then return end
|
||||
Log(GetName(source) .. ' Stamped A Single Blue Pill And Got ' .. one[chance] .. '!', 'xtc')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
else
|
||||
Notifys('You Dont Have Unstamped blue Pills', 'error')
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user