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
|
||||
Reference in new issue
Block a user