90%
This commit is contained in:
1 parent
66934fd68a
commit
df9584711a
16 files changed
+537
-291
No files matched your search
@@ -150,23 +150,23 @@ xanax = { anim = 'pill', effect = 'none', add = { stress = -40
|
||||
}
|
||||
|
||||
for k, v in pairs(Consume) do
|
||||
ps.createUseable(k, function(source, item)
|
||||
if not ps.hasItem(source, k, 1) then return end
|
||||
Bridge.Callback.Register(k, function(source, item)
|
||||
if not Bridge.Inventory.HasItem(source, k, 1) then return end
|
||||
local time = v.time or Consumables.defaulttime
|
||||
local effect = v.effect or 0
|
||||
local anim = v.anim or Consumables.defaultanim
|
||||
local progressbartext = v.progressbartext or Consumables.defaultprogresstext
|
||||
local add = v.add or {hunger = 0}
|
||||
local done = ps.callback('md-drugs:client:consumedrugs', source, time, effect, anim, progressbartext, add, k)
|
||||
local done = Bridge.Callback.Trigger('md-drugs:client:consumedrugs', source, time, effect, anim, progressbartext, add, k)
|
||||
if done then
|
||||
ps.removeItem(source, k, 1)
|
||||
Bridge.Inventory.RemoveItem(source, k, 1)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
|
||||
local src = source
|
||||
local Player = ps.getPlayer(src)
|
||||
local Player = Bridge.Framework.GetPlayer(src)
|
||||
if GetResourceState('es_extended') == 'started' then return end
|
||||
local hunger, thirst = Player.PlayerData.metadata.hunger, Player.PlayerData.metadata.thirst
|
||||
if stat == "thirst" then
|
||||
|
||||
@@ -165,6 +165,7 @@ local function getLoc(src, ped)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
Bridge.Callback.Register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, ped)
|
||||
local src = source
|
||||
local rep = getRep(source, 'cornerselling')
|
||||
@@ -269,19 +270,17 @@ RegisterNetEvent('md-drugs:server:getBackRobbed', function(peds)
|
||||
RobbedDrugs[src] = nil
|
||||
end)
|
||||
|
||||
ps.registerCommand('cornersell', {
|
||||
help = Bridge.Language.Locale('Cornerselling.comDes'),
|
||||
params = {
|
||||
},
|
||||
}, function(source, args, raw)
|
||||
|
||||
RegisterCommand('cornersell', function(source, args, raw)
|
||||
local src = source
|
||||
local jobCount = ps.getJobTypeCount('leo')
|
||||
if jobCount < cornsellConfig.policeRequired then
|
||||
local jobCount = Bridge.Framework.GetPlayersByJob('police')
|
||||
if #jobCount < cornsellConfig.policeRequired then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.noCops'), 'error')
|
||||
return
|
||||
end
|
||||
TriggerClientEvent('md-drugs:client:cornerselling', src)
|
||||
end)
|
||||
end, false)
|
||||
TriggerClientEvent('chat:addSuggestion', -1, '/cornersell', Bridge.Language.Locale('Cornerselling.comDes'))
|
||||
|
||||
RegisterServerEvent('md-drugs:server:cornerselling:stop', function()
|
||||
local src = source
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ for k, v in pairs (cokecut) do
|
||||
return
|
||||
end
|
||||
if Bridge.Inventory.HasItem(src,item.name) then
|
||||
local check = ps.callback('md-drugs:client:uncuff', src, 'Cutting It Further')
|
||||
local check = Bridge.Callback.Trigger('md-drugs:client:uncuff', src, 'Cutting It Further')
|
||||
if not check then return end
|
||||
if Bridge.Inventory.RemoveItem(src, k, 1) and Bridge.Inventory.RemoveItem(src, 'bakingsoda', 1) then
|
||||
Bridge.Inventory.AddItem(src, 'crackrock', v)
|
||||
|
||||
@@ -235,6 +235,7 @@ ps.registerCommand("deletedealer", {
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent('md-drugs:server:buyItemDealer', function(num, loc)
|
||||
local src = source
|
||||
local itemData = Products[num]
|
||||
@@ -249,7 +250,7 @@ RegisterNetEvent('md-drugs:server:buyItemDealer', function(num, loc)
|
||||
return
|
||||
end
|
||||
Bridge.Inventory.AddItem(src, itemData.name, 1)
|
||||
Bridge.Notify.SendNotify(src, string.format(Bridge.Language.Locale('Deliveries.buyItemSuccess'), 1, ps.getLabel(itemData.name), itemData.price), 'success')
|
||||
Bridge.Notify.SendNotify(src, string.format(Bridge.Language.Locale('Deliveries.buyItemSuccess'), 1, Bridge.Inventory.GetItemInfo(itemData.name).label, itemData.price), 'success')
|
||||
end)
|
||||
|
||||
Dealers = MySQL.query.await('SELECT * FROM dealers')
|
||||
|
||||
@@ -128,7 +128,7 @@ ps.registerCallback('md-drugs:server:GetCoppers', function(source, cb, args)
|
||||
return Bridge.Framework.GetPlayersByJob('police')
|
||||
end)
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetRep', function(source, cb, args)
|
||||
Bridge.Callback.Register('md-drugs:server:GetRep', function(source, cb, args)
|
||||
local rep = GetAllRep(source)
|
||||
return rep
|
||||
end)
|
||||
|
||||
+90
-22
@@ -1,6 +1,7 @@
|
||||
|
||||
Locations = Locations or {}
|
||||
Recipes = Recipes or {}
|
||||
local onRun = {}
|
||||
local leanLocs = {
|
||||
Locations.Lean = {
|
||||
MakeLean = {
|
||||
{
|
||||
loc = vector3(2635.81, 4240.57, 45.32),
|
||||
@@ -22,10 +23,28 @@ local leanLocs = {
|
||||
},
|
||||
}
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetLeanLocs', function(source)
|
||||
return leanLocs
|
||||
end)
|
||||
|
||||
GlobalState.MDDrugsLocations = Locations
|
||||
Recipes.Lean = {
|
||||
{
|
||||
item = 'cupoflean',
|
||||
amount = 1,
|
||||
ingredients = {
|
||||
{item = 'leancup', amount = 1},
|
||||
{item = 'mdlean', amount = 1},
|
||||
{item = 'sprunk', amount = 1},
|
||||
}
|
||||
},
|
||||
{
|
||||
item = 'cupofdextro',
|
||||
amount = 1,
|
||||
ingredients = {
|
||||
{item = 'leancup', amount = 1},
|
||||
{item = 'mdreddextro', amount = 1},
|
||||
{item = 'sprunk', amount = 1},
|
||||
}
|
||||
}
|
||||
}
|
||||
GlobalState.MDDrugsRecipes = Recipes
|
||||
local function setTimeout(identifier)
|
||||
if onRun[identifier] then
|
||||
CreateThread(function()
|
||||
@@ -36,21 +55,33 @@ local function setTimeout(identifier)
|
||||
end
|
||||
RegisterServerEvent('md-drugs:server:givelean', function()
|
||||
local src = source
|
||||
local amount = math.random(1,5)
|
||||
if not onRun[ps.getIdentifier(src)] then return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('lean.notOnRun'), "error") end
|
||||
onRun[ps.getIdentifier(src)] = onRun[ps.getIdentifier(src)] + 1
|
||||
if math.random(1,100) <= 50 then
|
||||
ps.addItem(src, "mdlean", amount)
|
||||
else
|
||||
ps.addItem(src, "mdreddextro", amount)
|
||||
if not onRun[src] then
|
||||
return
|
||||
end
|
||||
if onRun[ps.getIdentifier(src)] >= 4 then
|
||||
onRun[ps.getIdentifier(src)] = nil
|
||||
local veh = onRun[src].vehicle
|
||||
if not veh or veh == 0 then
|
||||
return
|
||||
end
|
||||
if GetEntityModel(veh) ~= GetHashKey('pounder') then
|
||||
return
|
||||
end
|
||||
local pcoords, vcoords = GetEntityCoords(GetPlayerPed(src)), GetEntityCoords(veh)
|
||||
if #(pcoords - vcoords) > 10.0 then
|
||||
return
|
||||
end
|
||||
onRun[src].taken = onRun[src].taken + 1
|
||||
local item, amount = math.random(1,2) == 1 and 'mdlean' or 'mdreddextro', math.random(1,3)
|
||||
Bridge.Inventory.AddItem(src, item, amount)
|
||||
if onRun[src].taken < 5 then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('lean.maxTaken'), 'error')
|
||||
DeleteEntity(veh)
|
||||
onRun[src] = nil
|
||||
return
|
||||
end
|
||||
end)
|
||||
|
||||
exports.ps_lib:registerCrafter({
|
||||
loc = leanLocs.MakeLean,
|
||||
loc = Locations.Lean.MakeLean,
|
||||
recipes = {
|
||||
cupoflean = {
|
||||
amount = 1,
|
||||
@@ -80,14 +111,51 @@ exports.ps_lib:registerCrafter({
|
||||
},
|
||||
})
|
||||
|
||||
ps.registerCallback('md-drugs:server:RegisterLean', function(source)
|
||||
local identifier = ps.getIdentifier(source)
|
||||
if not identifier then return false end
|
||||
if onRun[identifier] then
|
||||
Bridge.Callback.Register('md-drugs:server:registerLean', function(source, loc, vehicleNetId)
|
||||
local src = source
|
||||
if onRun[src] then
|
||||
return false
|
||||
else
|
||||
onRun[identifier] = 0
|
||||
setTimeout(identifier)
|
||||
if not checkDistance(src, Locations.Lean.SyrupVendor[loc].loc, 5.0) then
|
||||
return false
|
||||
end
|
||||
if not vehicleNetId then
|
||||
return false
|
||||
end
|
||||
local veh = NetworkGetEntityFromNetworkId(vehicleNetId)
|
||||
if not veh or veh == 0 or GetEntityModel(veh) ~= GetHashKey('pounder') then
|
||||
return false
|
||||
end
|
||||
|
||||
onRun[src] = {
|
||||
taken = 0,
|
||||
vehicle = veh,
|
||||
}
|
||||
setTimeout(src)
|
||||
return true
|
||||
end
|
||||
end)
|
||||
|
||||
Bridge.Framework.RegisterUsableItem('leancup', function(source, item)
|
||||
local src = source
|
||||
if not item then return end
|
||||
TriggerClientEvent('md-drugs:client:makeLean', src)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:server:makeLean', function(recipe)
|
||||
local src = source
|
||||
if not Recipes.Lean[recipe] then
|
||||
return
|
||||
end
|
||||
local rec = Recipes.Lean[recipe]
|
||||
for k, v in pairs (rec.ingredients) do
|
||||
if not Bridge.Inventory.HasItem(src, v.item, v.amount) then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('lean.missingIngredients'), 'error')
|
||||
return
|
||||
end
|
||||
end
|
||||
for k, v in pairs (rec.ingredients) do
|
||||
Bridge.Inventory.RemoveItem(src, v.item, v.amount)
|
||||
end
|
||||
Bridge.Inventory.AddItem(src, rec.item, rec.amount)
|
||||
end)
|
||||
+131
-122
@@ -1,4 +1,7 @@
|
||||
local weedLocs = {
|
||||
Locations, Recipes = Locations or {}, Recipes or {}
|
||||
|
||||
|
||||
Locations.Weed = {
|
||||
WeedTele = { -- where you tele out of weed
|
||||
{inside = vector3(1066.31, -3183.36, -39.16), outside = vector3(244.74, 374.54, 105.74), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
|
||||
},
|
||||
@@ -18,19 +21,7 @@ local weedLocs = {
|
||||
{loc = vector4(1030.77, -3203.18, -38.2, 262.37), ped = 'a_m_m_farmer_01', gang = ""},
|
||||
},
|
||||
}
|
||||
|
||||
local weedStore = {
|
||||
weedgrinder =25,
|
||||
mdbutter =25,
|
||||
flour =25,
|
||||
chocolate =25,
|
||||
butane =25,
|
||||
butanetorch =2,
|
||||
dabrig =2,
|
||||
mdwoods =2,
|
||||
}
|
||||
|
||||
local weed = {
|
||||
Recipes.Weed = {
|
||||
blunts = {
|
||||
blunt = {take = {bluntwrap = 1, grindedweed = 1}, give = {blunt = 1}},
|
||||
chewyblunt = {take = {bluntwrap = 1, grindedweed = 1, loosecoke = 1}, give = {chewyblunt = 1}},
|
||||
@@ -40,106 +31,8 @@ local weed = {
|
||||
bluntwrap = {
|
||||
leanbluntwrap = {take = {bluntwrap = 5, mdlean = 1}, give = {leanbluntwrap = 5}},
|
||||
dextrobluntwrap = {take = {bluntwrap = 5, mdreddextro = 1}, give = {dextrobluntwrap = 5}},
|
||||
}
|
||||
}
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetWeedRecipe', function(source, tableName)
|
||||
if not source then return false end
|
||||
return weed[tableName]
|
||||
end)
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetWeedLocs', function(source)
|
||||
return weedLocs
|
||||
end)
|
||||
|
||||
ps.registerCallback('md-drugs:server:getWeedItems', function(source)
|
||||
return weedStore
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:server:buyWeedItem', function(loc, name, amount)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, weedLocs.WeedSalesman[loc].loc, 3.5) then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if not weedStore[name] then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.itemDoesntExist'), "error")
|
||||
return
|
||||
end
|
||||
if ps.removeMoney(src, 'cash', weedStore[name] * amount) or ps.removeMoney(src, 'bank', weedStore[name] * amount) then
|
||||
ps.addItem(src, name, amount)
|
||||
else
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:dryoutweed', function()
|
||||
local src = source
|
||||
if timeOut(src, 'md-drugs:server:dryoutweed') then return end
|
||||
if ps.removeItem(src,"wetcannabis", 1) then
|
||||
ps.addItem(src,"drycannabis", 1)
|
||||
else
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.noDry'), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
local bluntwrap = {'mdreddextro','mdlean'}
|
||||
for k, v in pairs (bluntwrap) do
|
||||
ps.createUseable(v, function(source, item) TriggerClientEvent('md-drugs:client:makeBluntWrap', source) end)
|
||||
end
|
||||
|
||||
local bluntwraps = {'leanbluntwrap', 'dextrobluntwrap', 'bluntwrap'}
|
||||
|
||||
for k, v in pairs (bluntwraps) do
|
||||
ps.createUseable(v, function(source, item) TriggerClientEvent('md-drugs:client:rollBlunt', source) end)
|
||||
end
|
||||
|
||||
|
||||
RegisterServerEvent('md-drugs:server:MakeWeedItems', function(data)
|
||||
local src = source
|
||||
if timeOut(src, 'md-drugs:server:MakeWeedItems') then return end
|
||||
if not ps.craftItem(src, weed[data.table][data.item]) then
|
||||
verifyHas(src, weed[data.table][data.item].take)
|
||||
return
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
ps.createUseable("dabrig", function(source, item)
|
||||
local src = source
|
||||
if ps.hasItem(src, "butanetorch") then
|
||||
if ps.removeItem(src, "shatter", 1) then
|
||||
TriggerClientEvent("md-drugs:client:dodabs", src)
|
||||
end
|
||||
else
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.needItem', ps.getItemLabel("butanetorch")), 'error')
|
||||
end
|
||||
end)
|
||||
|
||||
ps.createUseable("weedgrinder", function(source, item)
|
||||
local src = source
|
||||
if not ps.hasItem(src, "drycannabis") then Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.needItem', ps.getItemLabel("drycannabis")), 'error') return end
|
||||
local check = ps.callback('md-drugs:client:uncuff', src, 'Grinding Weed')
|
||||
if not check then return end
|
||||
if ps.removeItem(src, "drycannabis",1 ) then
|
||||
ps.addItem(src, "grindedweed", 1)
|
||||
end
|
||||
end)
|
||||
|
||||
ps.createUseable("mdwoods", function(source, item)
|
||||
local src = source
|
||||
local check = ps.callback('md-drugs:client:uncuff', src, Bridge.Language.Locale('weed.crackBlunt'))
|
||||
if not check then return end
|
||||
if ps.removeItem(src, "mdwoods",1 ) then
|
||||
ps.addItem(src, "bluntwrap", 5)
|
||||
ps.addItem(src, "tobacco", 5)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
exports['ps_lib']:registerCrafter({
|
||||
loc = weedLocs.MakeButter,
|
||||
recipes = {
|
||||
},
|
||||
makeButter= {
|
||||
cannabutter = {
|
||||
amount = 1,
|
||||
time = 4000,
|
||||
@@ -186,13 +79,8 @@ exports['ps_lib']:registerCrafter({
|
||||
flour = 1
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
exports['ps_lib']:registerCrafter({
|
||||
loc = weedLocs.MakeOil,
|
||||
recipes = {
|
||||
},
|
||||
makeOil = {
|
||||
shatter = {
|
||||
amount = 1,
|
||||
time = 4000,
|
||||
@@ -202,7 +90,128 @@ exports['ps_lib']:registerCrafter({
|
||||
grindedweed = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
weedStore = {
|
||||
weedgrinder =25,
|
||||
mdbutter =25,
|
||||
flour =25,
|
||||
chocolate =25,
|
||||
butane =25,
|
||||
butanetorch =2,
|
||||
dabrig =2,
|
||||
mdwoods =2,
|
||||
}
|
||||
})
|
||||
}
|
||||
GlobalState.MDDrugsLocations = Locations
|
||||
GlobalState.MDDrugsRecipes = Recipes
|
||||
|
||||
RegisterNetEvent('md-drugs:server:buyWeedItem', function(loc, name, amount)
|
||||
local src = source
|
||||
if not checkDistance(src, Locations.Weed.WeedSalesman[loc].loc, 3.5) then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if not Recipes.Weed.weedStore[name] then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.itemDoesntExist'), "error")
|
||||
return
|
||||
end
|
||||
|
||||
if Bridge.Framework.RemoveAccountBalance(src, 'cash', Recipes.Weed.weedStore[name] * amount) or Bridge.Framework.RemoveAccountBalance(src, 'bank', Recipes.Weed.weedStore[name] * amount) then
|
||||
Bridge.Inventory.AddItem(src, name, amount)
|
||||
else
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:dryoutweed', function(loc)
|
||||
local src = source
|
||||
if timeOut(src, 'md-drugs:server:dryoutweed') then return end
|
||||
if checkDistance(src, Locations.Weed.WeedDry[loc].loc, 5.0) == false then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if Bridge.Inventory.RemoveItem(src,"wetcannabis", 1) then
|
||||
Bridge.Inventory.AddItem(src,"drycannabis", 1)
|
||||
else
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.noDry'), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
local bluntwrap = {'mdreddextro','mdlean'}
|
||||
for k, v in pairs (bluntwrap) do
|
||||
Bridge.Framework.RegisterUsableItem(v, function(source, item) TriggerClientEvent('md-drugs:client:makeBluntWrap', source) end)
|
||||
end
|
||||
|
||||
local bluntwraps = {'leanbluntwrap', 'dextrobluntwrap', 'bluntwrap'}
|
||||
|
||||
for k, v in pairs (bluntwraps) do
|
||||
Bridge.Framework.RegisterUsableItem(v, function(source, item) TriggerClientEvent('md-drugs:client:rollBlunt', source) end)
|
||||
end
|
||||
|
||||
|
||||
RegisterServerEvent('md-drugs:server:MakeWeedItems', function(tabl, item, loc)
|
||||
local src = source
|
||||
if timeOut(src, 'md-drugs:server:MakeWeedItems') then return end
|
||||
local locs = tabl == 'makeButter' and 'MakeButter' or tabl == 'makeOil' and 'MakeOil' or nil
|
||||
if not locs then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.invalidTable'), "error")
|
||||
return
|
||||
end
|
||||
if not checkDistance(src, Locations.Weed[locs][loc].loc, 5.0) then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
|
||||
return
|
||||
end
|
||||
local recipe = Recipes.Weed[tabl][item]
|
||||
if not recipe then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.itemDoesntExist'), "error")
|
||||
return
|
||||
end
|
||||
for k, v in pairs (recipe.recipe) do
|
||||
if not Bridge.Inventory.HasItem(src, k, v) then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.missingItem', Bridge.Inventory.GetItemInfo(k).label), "error")
|
||||
return
|
||||
end
|
||||
end
|
||||
for k, v in pairs (recipe.recipe) do
|
||||
if not Bridge.Inventory.RemoveItem(src, k, v) then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.missingItem', Bridge.Inventory.GetItemInfo(k).label), "error")
|
||||
return
|
||||
end
|
||||
end
|
||||
Bridge.Inventory.AddItem(src, item, recipe.amount)
|
||||
end)
|
||||
|
||||
|
||||
Bridge.Framework.RegisterUsableItem("dabrig", function(source, item)
|
||||
local src = source
|
||||
if Bridge.Inventory.HasItem(src, "butanetorch") then
|
||||
if Bridge.Inventory.RemoveItem(src, "shatter", 1) then
|
||||
TriggerClientEvent("md-drugs:client:dodabs", src)
|
||||
end
|
||||
else
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.needItem', Bridge.Inventory.GetItemInfo("butanetorch").label), 'error')
|
||||
end
|
||||
end)
|
||||
|
||||
Bridge.Framework.RegisterUsableItem("weedgrinder", function(source, item)
|
||||
local src = source
|
||||
if not Bridge.Inventory.HasItem(src, "drycannabis") then
|
||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.needItem', Bridge.Inventory.GetItemInfo("drycannabis").label), 'error')
|
||||
return
|
||||
end
|
||||
local check = Bridge.Callback.Trigger('md-drugs:client:uncuff', src, 'Grinding Weed')
|
||||
if not check then return end
|
||||
if Bridge.Inventory.RemoveItem(src, "drycannabis",1 ) then
|
||||
Bridge.Inventory.AddItem(src, "grindedweed", 1)
|
||||
end
|
||||
end)
|
||||
|
||||
Bridge.Framework.RegisterUsableItem("mdwoods", function(source, item)
|
||||
local src = source
|
||||
local check = Bridge.Callback.Trigger('md-drugs:client:uncuff', src, Bridge.Language.Locale('weed.crackBlunt'))
|
||||
if not check then return end
|
||||
if Bridge.Inventory.RemoveItem(src, "mdwoods",1 ) then
|
||||
Bridge.Inventory.AddItem(src, "bluntwrap", 5)
|
||||
Bridge.Inventory.AddItem(src, "tobacco", 5)
|
||||
end
|
||||
end)
|
||||
+30
-33
@@ -1,5 +1,5 @@
|
||||
|
||||
local itemCraft = {
|
||||
Locations, Recipes = Locations or {}, Recipes or {}
|
||||
Recipes.Whippit = {
|
||||
cracker = {
|
||||
{color = 'blue', item = 'blue_uninflated_balloon'},
|
||||
{color = 'green', item = 'green_uninflated_balloon'},
|
||||
@@ -8,48 +8,45 @@ local itemCraft = {
|
||||
{color = 'red', item = 'red_uninflated_balloon'},
|
||||
{color = 'white', item = 'white_uninflated_balloon'},
|
||||
{color = 'yellow', item = 'yellow_uninflated_balloon'}
|
||||
},
|
||||
shop = {
|
||||
blue_uninflated_balloon =5,
|
||||
green_uninflated_balloon =5,
|
||||
orange_uninflated_balloon =5,
|
||||
purple_uninflated_balloon =5,
|
||||
red_uninflated_balloon =5,
|
||||
white_uninflated_balloon =5,
|
||||
yellow_uninflated_balloon =5,
|
||||
cracker =500,
|
||||
whipped_cream_cannister =10
|
||||
}
|
||||
}
|
||||
local store = {
|
||||
Locations.Whippit = {
|
||||
{loc =vector4(1695.47, 4872.98, 42.16, 288.86), ped = 'ig_priest' },
|
||||
}
|
||||
ps.registerCallback('md-drugs:server:getWhippitLocations', function(source)
|
||||
return store
|
||||
end)
|
||||
local itemShop = {
|
||||
blue_uninflated_balloon = 5,
|
||||
green_uninflated_balloon = 5,
|
||||
orange_uninflated_balloon = 5,
|
||||
purple_uninflated_balloon = 5,
|
||||
red_uninflated_balloon = 5,
|
||||
white_uninflated_balloon = 5,
|
||||
yellow_uninflated_balloon = 5,
|
||||
cracker = 500,
|
||||
whipped_cream_cannister = 10
|
||||
}
|
||||
|
||||
ps.registerCallback('md-drugs:server:getwhippitShop', function(source)
|
||||
return itemShop
|
||||
end)
|
||||
GlobalState.MDDrugsLocations = Locations
|
||||
GlobalState.MDDrugsRecipes = Recipes
|
||||
|
||||
|
||||
RegisterServerEvent('md-drugs:server:buyWhippitItem', function(loc, item,amount)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, store[loc].loc, 3.0) then return end
|
||||
if not itemShop[item] then return end
|
||||
local price = itemShop[item] * amount
|
||||
if not ps.removeMoney(src, 'cash', price, 'whippit-shop') then
|
||||
if not ps.checkDistance(src, Locations.Whippit[loc].loc, 3.0) then return end
|
||||
if not Recipes.Whippit.shop[item] then return end
|
||||
local price = Recipes.Whippit.shop[item] * amount
|
||||
if not Bridge.Framework.RemoveAccountBalance(src, 'cash', price, 'whippit-shop') then
|
||||
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.notEnoughMoney', price), 'error')
|
||||
end
|
||||
ps.addItem(src, item, amount)
|
||||
Bridge.Inventory.AddItem(src, item, amount)
|
||||
end)
|
||||
|
||||
ps.createUseable('cracker', function(source)
|
||||
Bridge.Framework.RegisterUsableItem('cracker', function(source)
|
||||
local src = source
|
||||
if not ps.hasItem(src, 'cracker', 1) then return end
|
||||
if not ps.hasItem(src, 'whipped_cream_cannister', 1) then return end
|
||||
if not Bridge.Inventory.HasItem(src, 'cracker', 1) then return end
|
||||
if not Bridge.Inventory.HasItem(src, 'whipped_cream_cannister', 1) then return end
|
||||
local balloonItem, balloonColor = nil, nil
|
||||
for _, balloon in pairs(itemCraft['cracker']) do
|
||||
if ps.hasItem(src, balloon.item, 1) then
|
||||
for _, balloon in pairs(Recipes.Whippit.cracker) do
|
||||
if Bridge.Inventory.HasItem(src, balloon.item, 1) then
|
||||
balloonItem = balloon.item
|
||||
balloonColor = 'ate_balloon_' .. balloon.color
|
||||
break
|
||||
@@ -59,11 +56,11 @@ ps.createUseable('cracker', function(source)
|
||||
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.needBalloon'), 'error')
|
||||
end
|
||||
|
||||
if not ps.removeItem(src, 'whipped_cream_cannister', 1) then
|
||||
if not Bridge.Inventory.RemoveItem(src, 'whipped_cream_cannister', 1) then
|
||||
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.needCanister'), 'error')
|
||||
end
|
||||
if not ps.removeItem(src, balloonItem, 1) then
|
||||
if not Bridge.Inventory.RemoveItem(src, balloonItem, 1) then
|
||||
return ps.warn(src, 'Failed to remove balloon', 'error')
|
||||
end
|
||||
ps.callback('md-drugs:client:useWhippit', src, balloonColor)
|
||||
Bridge.Callback.Trigger('md-drugs:client:useWhippit', src, balloonColor)
|
||||
end)
|
||||
Reference in new issue
Block a user