90%
This commit is contained in:
1 parent
66934fd68a
commit
df9584711a
16 files changed
+536
-290
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
ps.registerCallback('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item)
|
Bridge.Callback.Register('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item)
|
||||||
if not ps.progressbar(progresstext .. ps.getLabel(item).. "!", time, anim ) then return end
|
if not progressbar(progresstext .. Bridge.Inventory.GetItemInfo(item).label.. "!", time, anim ) then return end
|
||||||
for k, v in pairs (status) do
|
for k, v in pairs (status) do
|
||||||
if k == 'health' then
|
if k == 'health' then
|
||||||
local cur = GetEntityHealth(PlayerPedId())
|
local cur = GetEntityHealth(PlayerPedId())
|
||||||
|
|||||||
@@ -185,6 +185,10 @@ local function Cornersell()
|
|||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent('md-drugs:client:cornerselling', function()
|
RegisterNetEvent('md-drugs:client:cornerselling', function()
|
||||||
|
if inZone then
|
||||||
|
Bridge.Notify.SendNotify(Bridge.Language.Locale('Cornerselling.inNoSellZone'), 'error')
|
||||||
|
return
|
||||||
|
end
|
||||||
if sell then
|
if sell then
|
||||||
sell = false
|
sell = false
|
||||||
Bridge.HelpText.HideHelpText()
|
Bridge.HelpText.HideHelpText()
|
||||||
@@ -198,7 +202,17 @@ end)
|
|||||||
|
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
for k, v in pairs (QBConfig.NoSellZones) do
|
for k, v in pairs (QBConfig.NoSellZones) do
|
||||||
local box = ps.zones.box({ coords = v.loc, size = vec3(v.width, v.length, v.height), rotation = 180.0, debug = false,
|
Bridge.Point.Register(
|
||||||
onEnter = function() inZone = true end, onExit = function() inZone = false end})
|
'MDDRUGNOSELLZONE'..k,
|
||||||
|
v.loc,
|
||||||
|
(v.width or 10.0 + v.length or 10.0) / 2,
|
||||||
|
nil,
|
||||||
|
function()
|
||||||
|
inZone = true
|
||||||
|
end,
|
||||||
|
function(point, data)
|
||||||
|
inZone = false
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
|
--TODO: Make dealers better
|
||||||
local isActive = false
|
local isActive = false
|
||||||
local dealer = {}
|
local dealer = {}
|
||||||
--TODO: Finish Dealers
|
|
||||||
local function SpawnDealer()
|
local function SpawnDealer()
|
||||||
if #dealer >= 1 then
|
if #dealer >= 1 then
|
||||||
for k,v in pairs (dealer) do
|
for k,v in pairs (dealer) do
|
||||||
|
|||||||
+60
-18
@@ -97,7 +97,7 @@ function minigame()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function GetRep()
|
function GetRep()
|
||||||
local rep = ps.callback('md-drugs:server:GetRep')
|
local rep = Bridge.Callback.Trigger('md-drugs:server:GetRep')
|
||||||
return rep
|
return rep
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ end
|
|||||||
|
|
||||||
function GetCops(number)
|
function GetCops(number)
|
||||||
if number == 0 then return true end
|
if number == 0 then return true end
|
||||||
local amount = ps.callback('md-drugs:server:GetCoppers')
|
local amount = Bridge.Callback.Trigger('md-drugs:server:GetCoppers')
|
||||||
if amount >= number then return true else Bridge.Notify.SendNotify('You Need '.. number - amount .. ' More Cops To Do This', 'error') end
|
if amount >= number then return true else Bridge.Notify.SendNotify('You Need '.. number - amount .. ' More Cops To Do This', 'error') end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -136,6 +136,43 @@ function Freeze(entity, toggle, head)
|
|||||||
SetBlockingOfNonTemporaryEvents(entity, toggle)
|
SetBlockingOfNonTemporaryEvents(entity, toggle)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function RotationToDirection(rotation)
|
||||||
|
local adjustedRotation = {
|
||||||
|
x = (math.pi / 180) * rotation.x,
|
||||||
|
y = (math.pi / 180) * rotation.y,
|
||||||
|
z = (math.pi / 180) * rotation.z
|
||||||
|
}
|
||||||
|
local direction = {
|
||||||
|
x = -math.sin(adjustedRotation.z) * math.abs(math.cos(adjustedRotation.x)),
|
||||||
|
y = math.cos(adjustedRotation.z) * math.abs(math.cos(adjustedRotation.x)),
|
||||||
|
z = math.sin(adjustedRotation.x)
|
||||||
|
}
|
||||||
|
return direction
|
||||||
|
end
|
||||||
|
|
||||||
|
local function RayCastGamePlayCamera(distance)
|
||||||
|
local currentRenderingCam = false
|
||||||
|
if not IsGameplayCamRendering() then
|
||||||
|
currentRenderingCam = GetRenderingCam()
|
||||||
|
end
|
||||||
|
|
||||||
|
local cameraRotation = not currentRenderingCam and GetGameplayCamRot() or GetCamRot(currentRenderingCam, 2)
|
||||||
|
local cameraCoord = not currentRenderingCam and GetGameplayCamCoord() or GetCamCoord(currentRenderingCam)
|
||||||
|
local direction = RotationToDirection(cameraRotation)
|
||||||
|
local destination = {
|
||||||
|
x = cameraCoord.x + direction.x * distance,
|
||||||
|
y = cameraCoord.y + direction.y * distance,
|
||||||
|
z = cameraCoord.z + direction.z * distance
|
||||||
|
}
|
||||||
|
local _, hit, endCoords, surfaceNormal, entityHit = GetShapeTestResult(StartShapeTestRay(cameraCoord.x, cameraCoord.y, cameraCoord.z, destination.x, destination.y, destination.z, -1, PlayerPedId(), 0))
|
||||||
|
return _, hit, endCoords, surfaceNormal, entityHit
|
||||||
|
end
|
||||||
|
|
||||||
|
local function ray()
|
||||||
|
local _, hit, endCoords, surfaceNormal, entityHit = RayCastGamePlayCamera(1000.0)
|
||||||
|
return hit, endCoords, surfaceNormal, entityHit
|
||||||
|
end
|
||||||
|
|
||||||
local created = false
|
local created = false
|
||||||
local heading = 180.0
|
local heading = 180.0
|
||||||
function StartRay()
|
function StartRay()
|
||||||
@@ -144,10 +181,10 @@ function StartRay()
|
|||||||
requestModel('v_ret_ml_tablea', 30000)
|
requestModel('v_ret_ml_tablea', 30000)
|
||||||
local table = CreateObject('v_ret_ml_tablea', pedcoord.x, pedcoord.y, pedcoord.z+1, heading, false, false)
|
local table = CreateObject('v_ret_ml_tablea', pedcoord.x, pedcoord.y, pedcoord.z+1, heading, false, false)
|
||||||
repeat
|
repeat
|
||||||
local hit, endCoords, surfaceNormal, entityHit = ps.raycast()
|
local hit, endCoords, surfaceNormal, entityHit = ray()
|
||||||
if not created then
|
if not created then
|
||||||
created = true
|
created = true
|
||||||
ps.drawText([[[E] To Place
|
Bridge.HelpText.ShowHelpText([[[E] To Place
|
||||||
[DEL] To Cancel
|
[DEL] To Cancel
|
||||||
[<-] To Move Left
|
[<-] To Move Left
|
||||||
[->] To Move Right]])
|
[->] To Move Right]])
|
||||||
@@ -164,7 +201,7 @@ function StartRay()
|
|||||||
heading = heading + 2
|
heading = heading + 2
|
||||||
end
|
end
|
||||||
if IsControlPressed(0, 38) then
|
if IsControlPressed(0, 38) then
|
||||||
ps.hideText()
|
Bridge.HelpText.HideHelpText()
|
||||||
run = false
|
run = false
|
||||||
DeleteObject(table)
|
DeleteObject(table)
|
||||||
created = false
|
created = false
|
||||||
@@ -172,7 +209,7 @@ function StartRay()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if IsControlPressed(0, 178) then
|
if IsControlPressed(0, 178) then
|
||||||
ps.hideText()
|
Bridge.HelpText.HideHelpText()
|
||||||
run = false
|
run = false
|
||||||
created = false
|
created = false
|
||||||
DeleteObject(table)
|
DeleteObject(table)
|
||||||
@@ -188,10 +225,10 @@ function StartRay2()
|
|||||||
requestModel('bkr_prop_coke_press_01aa', 30000)
|
requestModel('bkr_prop_coke_press_01aa', 30000)
|
||||||
local table = CreateObject('bkr_prop_coke_press_01aa', pedcoord.x, pedcoord.y, pedcoord.z+1, heading, false, false)
|
local table = CreateObject('bkr_prop_coke_press_01aa', pedcoord.x, pedcoord.y, pedcoord.z+1, heading, false, false)
|
||||||
repeat
|
repeat
|
||||||
local hit, endCoords, surfaceNormal, entityHit = ps.raycast()
|
local hit, endCoords, surfaceNormal, entityHit = ray()
|
||||||
if not created then
|
if not created then
|
||||||
created = true
|
created = true
|
||||||
ps.drawText([[[E] To Place
|
Bridge.HelpText.ShowHelpText([[[E] To Place
|
||||||
[DEL] To Cancel
|
[DEL] To Cancel
|
||||||
[<-] To Move Left
|
[<-] To Move Left
|
||||||
[->] To Move Right]])
|
[->] To Move Right]])
|
||||||
@@ -208,7 +245,7 @@ function StartRay2()
|
|||||||
heading = heading + 2
|
heading = heading + 2
|
||||||
end
|
end
|
||||||
if IsControlPressed(0, 38) then
|
if IsControlPressed(0, 38) then
|
||||||
ps.hideText()
|
Bridge.HelpText.HideHelpText()
|
||||||
run = false
|
run = false
|
||||||
DeleteObject(table)
|
DeleteObject(table)
|
||||||
created = false
|
created = false
|
||||||
@@ -216,7 +253,7 @@ function StartRay2()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if IsControlPressed(0, 178) then
|
if IsControlPressed(0, 178) then
|
||||||
ps.hideText()
|
Bridge.HelpText.HideHelpText()
|
||||||
run = false
|
run = false
|
||||||
created = false
|
created = false
|
||||||
DeleteObject(table)
|
DeleteObject(table)
|
||||||
@@ -226,20 +263,25 @@ function StartRay2()
|
|||||||
until run == false
|
until run == false
|
||||||
end
|
end
|
||||||
|
|
||||||
ps.registerCallback('md-drugs:client:uncuff', function(data)
|
Bridge.Callback.Register('md-drugs:client:uncuff', function(data)
|
||||||
if not progressbar(data, 4000, 'uncuff') then return end
|
if not progressbar(data, 4000, 'uncuff') then return end
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterCommand('DrugRep', function()
|
RegisterCommand('DrugRep', function()
|
||||||
if not Config.TierSystem then return end
|
if not Config.TierSystem then return end
|
||||||
local rep = ps.callback('md-drugs:server:GetRep', false)
|
local rep = GetRep()
|
||||||
ps.menu('Drug Rep', 'Drug Rep', {
|
Bridge.Menu.Open({
|
||||||
{icon = "fa-solid fa-face-flushed", title = 'Cocaine: '..rep.coke},
|
id = 'drugrep',
|
||||||
{icon = "fa-solid fa-syringe", title = 'Heroin: '..rep.heroin},
|
title = 'Drug Reputation',
|
||||||
{icon = "fa-solid fa-vial", title = 'LSD: '..rep.lsd},
|
description = 'Your Current Drug Reputation Stats',
|
||||||
{icon = "fa-solid fa-plug", title = 'Dealer: '..rep.dealerrep},
|
options = {
|
||||||
{icon = "fa-solid fa-money-bill", title = 'Corner Selling: ' .. rep.cornerselling.rep, description = 'Rank: ' .. rep.cornerselling.label }
|
{icon = "fa-solid fa-face-flushed", title = 'Cocaine: '..rep.coke},
|
||||||
|
{icon = "fa-solid fa-syringe", title = 'Heroin: '..rep.heroin},
|
||||||
|
{icon = "fa-solid fa-vial", title = 'LSD: '..rep.lsd},
|
||||||
|
{icon = "fa-solid fa-plug", title = 'Dealer: '..rep.dealerrep},
|
||||||
|
{icon = "fa-solid fa-money-bill", title = 'Corner Selling: ' .. rep.cornerselling.rep, description = 'Rank: ' .. rep.cornerselling.label }
|
||||||
|
}
|
||||||
})
|
})
|
||||||
end, false)
|
end, false)
|
||||||
|
|
||||||
|
|||||||
+62
-16
@@ -1,61 +1,67 @@
|
|||||||
|
|
||||||
local started = false
|
local started = false
|
||||||
local hit = 0
|
local hit = 0
|
||||||
local location = ps.callback('md-drugs:server:GetLeanLocs')
|
local leanCar = nil
|
||||||
|
local location = GlobalState.MDDrugsLocations.Lean
|
||||||
|
|
||||||
local function SpawnCarPedChase()
|
local function SpawnCarPedChase(loc)
|
||||||
local stoploc = vector3(-1157.63, -3056.71, 13.94)
|
local stoploc = vector3(-1157.63, -3056.71, 13.94)
|
||||||
local start = location.StartLoc[math.random(1,#location.StartLoc)]
|
local start = location.StartLoc[math.random(1,#location.StartLoc)]
|
||||||
|
|
||||||
if started then Bridge.Notify.SendNotify(Bridge.Language.Locale('lean.alreadyChasing'), 'error') return end
|
if started then Bridge.Notify.SendNotify(Bridge.Language.Locale('lean.alreadyChasing'), 'error') return end
|
||||||
started = true
|
started = true
|
||||||
|
|
||||||
ps.callback('md-drugs:server:RegisterLean')
|
|
||||||
requestModel("pounder", 30000)
|
requestModel("pounder", 30000)
|
||||||
requestModel("ig_priest", 30000)
|
requestModel("ig_priest", 30000)
|
||||||
requestModel("cargobob3", 30000)
|
requestModel("cargobob3", 30000)
|
||||||
|
|
||||||
local leancar = CreateVehicle("pounder", start.x+3, start.y-2, start.z-1, 52.0, true, false)
|
leanCar = CreateVehicle("pounder", start.x+3, start.y-2, start.z-1, 52.0, true, false)
|
||||||
local driver = CreatePed(26, "ig_priest", start.x, start.y, start.z, 268.9422, false, false)
|
local driver = CreatePed(26, "ig_priest", start.x, start.y, start.z, 268.9422, false, false)
|
||||||
local pilot2 = CreatePed(26, "ig_priest", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false)
|
local pilot2 = CreatePed(26, "ig_priest", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false)
|
||||||
|
local can = Bridge.Callback.Trigger('md-drugs:server:registerLean', loc, NetworkGetNetworkIdFromEntity(leanCar))
|
||||||
|
|
||||||
|
if not can then
|
||||||
|
Bridge.Notify.SendNotify(Bridge.Language.Locale('lean.cantStart'), 'error')
|
||||||
|
DeleteVehicle(leanCar)
|
||||||
|
DeleteEntity(driver)
|
||||||
|
DeleteEntity(pilot2)
|
||||||
|
started = false
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
SetPedIntoVehicle(pilot2, leanCar, 1)
|
||||||
|
FreezeEntityPosition(driver, true)
|
||||||
FreezeEntityPosition(pilot2, true)
|
FreezeEntityPosition(pilot2, true)
|
||||||
SetEntityInvincible(pilot2, true)
|
SetEntityInvincible(pilot2, true)
|
||||||
SetEntityAsMissionEntity(leancar)
|
SetEntityAsMissionEntity(leanCar)
|
||||||
AddBlipForEntity(leancar)
|
AddBlipForEntity(leanCar)
|
||||||
SetPedIntoVehicle(driver, leancar, -1)
|
SetPedIntoVehicle(driver, leanCar, -1)
|
||||||
SetPedFleeAttributes(driver,false)
|
SetPedFleeAttributes(driver,false)
|
||||||
TaskVehicleDriveToCoordLongrange(driver, leancar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0)
|
TaskVehicleDriveToCoordLongrange(driver, leanCar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0)
|
||||||
SetPedKeepTask(driver, true)
|
SetPedKeepTask(driver, true)
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
Wait(1000)
|
Wait(1000)
|
||||||
until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0
|
until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0
|
||||||
|
|
||||||
RemoveBlip(leancar)
|
RemoveBlip(leanCar)
|
||||||
|
|
||||||
if GetEntityHealth(driver) == 0 then
|
if GetEntityHealth(driver) == 0 then
|
||||||
Bridge.Target.AddLocalEntity(leancar, {
|
Bridge.Target.AddLocalEntity(leanCar, {
|
||||||
{
|
{
|
||||||
name = 'leancar',
|
name = 'leancar',
|
||||||
icon = 'fa-solid fa-car',
|
icon = 'fa-solid fa-car',
|
||||||
label = Bridge.Language.Locale('lean.stealFromTruck'),
|
label = Bridge.Language.Locale('lean.stealFromTruck'),
|
||||||
action = function()
|
action = function()
|
||||||
hit = hit + 1
|
|
||||||
if not minigame() then return end
|
if not minigame() then return end
|
||||||
TriggerServerEvent('md-drugs:server:givelean')
|
TriggerServerEvent('md-drugs:server:givelean')
|
||||||
started = false
|
started = false
|
||||||
if math.random(1,100) <= 30 or hit == 4 then
|
|
||||||
hit = 0
|
|
||||||
DeleteVehicle(leancar)
|
|
||||||
DeleteEntity(driver)
|
DeleteEntity(driver)
|
||||||
DeleteEntity(pilot2)
|
DeleteEntity(pilot2)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
DeleteVehicle(leancar)
|
|
||||||
DeleteEntity(driver)
|
DeleteEntity(driver)
|
||||||
DeleteEntity(pilot2)
|
DeleteEntity(pilot2)
|
||||||
end
|
end
|
||||||
@@ -80,3 +86,43 @@ for k, v in pairs (location.SyrupVendor) do
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function concat(tbl)
|
||||||
|
local str = ""
|
||||||
|
for k, v in pairs (tbl) do
|
||||||
|
str = str .. v.item .. " X " .. v.amount .. " \n "
|
||||||
|
end
|
||||||
|
return str
|
||||||
|
end
|
||||||
|
|
||||||
|
local function getDisabled(recipe)
|
||||||
|
for k, v in pairs (recipe.ingredients) do
|
||||||
|
local count = Bridge.Inventory.GetItemCount(v.item)
|
||||||
|
if count < v.amount then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
RegisterNetEvent("md-drugs:client:makeLean", function()
|
||||||
|
local menu = {}
|
||||||
|
for k, v in pairs (GlobalState.MDDrugsRecipes.Lean) do
|
||||||
|
menu[#menu+1] = {
|
||||||
|
title = Bridge.Inventory.GetItemInfo(v.item).label,
|
||||||
|
description = concat(v.ingredients),
|
||||||
|
icon = Bridge.Inventory.GetItemInfo(v.item).image,
|
||||||
|
disabled = getDisabled(v),
|
||||||
|
onSelect = function()
|
||||||
|
if not progressbar(Bridge.Language.Locale('lean.makingLean'), 4000, 'uncuff') then return end
|
||||||
|
TriggerServerEvent('md-drugs:server:makeLean', k)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
Bridge.Menu.Open({
|
||||||
|
id = 'makeLeanMenu',
|
||||||
|
title = Bridge.Language.Locale('lean.makeLeanMenuTitle'),
|
||||||
|
description = Bridge.Language.Locale('lean.makeLeanMenuDesc'),
|
||||||
|
options = menu
|
||||||
|
})
|
||||||
|
end)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
local badTrip = 100
|
local badTrip = 100
|
||||||
|
local locations = GlobalState.MDDrugsLocations.Mescaline
|
||||||
local function AlienEffect()
|
local function AlienEffect()
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
StartScreenEffect("DrugsMichaelAliensFightIn", 3.0, 0)
|
StartScreenEffect("DrugsMichaelAliensFightIn", 3.0, 0)
|
||||||
@@ -13,7 +13,7 @@ local function AlienEffect()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
local locations = GlobalState.MDDrugsLocations.Mescaline
|
|
||||||
for k, v in pairs (locations.DryOutMescaline) do
|
for k, v in pairs (locations.DryOutMescaline) do
|
||||||
Bridge.Target.AddBoxZone('dryoutMesc'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0,{
|
Bridge.Target.AddBoxZone('dryoutMesc'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0,{
|
||||||
{
|
{
|
||||||
|
|||||||
+90
-25
@@ -1,12 +1,12 @@
|
|||||||
local exploded, drying = false, false
|
local exploded, drying = false, false
|
||||||
local locations = ps.callback('md-drugs:server:GetWeedLocs')
|
local locations, recipes = GlobalState.MDDrugsLocations.Weed, GlobalState.MDDrugsRecipes.Weed
|
||||||
for k, v in pairs (locations.WeedDry) do
|
for k, v in pairs (locations.WeedDry) do
|
||||||
ps.boxTarget('weed_dry'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
|
Bridge.Target.AddBoxZone('weed_dry'..k, v.loc, vector3(v.l or 1.0, v.w or 1.0, 1.0), v.loc.w or 180.0, {
|
||||||
{
|
{
|
||||||
icon = 'fa-solid fa-cannabis',
|
icon = 'fa-solid fa-cannabis',
|
||||||
label = Bridge.Language.Locale('weed.targetDry'),
|
label = Bridge.Language.Locale('weed.targetDry'),
|
||||||
action = function()
|
action = function()
|
||||||
if not ps.hasItem('wetcannabis', 1) then
|
if not Bridge.Inventory.HasItem( "wetcannabis") then
|
||||||
Bridge.Notify.SendNotify(Bridge.Language.Locale('weed.noDry'), "error")
|
Bridge.Notify.SendNotify(Bridge.Language.Locale('weed.noDry'), "error")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -25,7 +25,7 @@ for k, v in pairs (locations.WeedDry) do
|
|||||||
action = function()
|
action = function()
|
||||||
DeleteEntity(weedplant)
|
DeleteEntity(weedplant)
|
||||||
drying = false
|
drying = false
|
||||||
TriggerServerEvent('md-drugs:server:dryoutweed')
|
TriggerServerEvent('md-drugs:server:dryoutweed', k)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -39,7 +39,7 @@ for k, v in pairs (locations.WeedDry) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
for k, v in pairs (locations.WeedTele) do
|
for k, v in pairs (locations.WeedTele) do
|
||||||
ps.boxTarget('weed_tele'..k, v.inside, {length = v.l, width = v.w, heading = v.rot}, {
|
Bridge.Target.AddBoxZone('weed_tele'..k, v.inside, vector3(v.l or 1.0, v.w or 1.0, 1.0), v.rot or 180.0, {
|
||||||
{
|
{
|
||||||
icon = 'fa-solid fa-door-open',
|
icon = 'fa-solid fa-door-open',
|
||||||
label = Bridge.Language.Locale('weed.teleportOut'),
|
label = Bridge.Language.Locale('weed.teleportOut'),
|
||||||
@@ -48,7 +48,7 @@ for k, v in pairs (locations.WeedTele) do
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
ps.boxTarget('weed_teleout'..k, v.outside, {length = v.l, width = v.w, heading = v.rot}, {
|
Bridge.Target.AddBoxZone('weed_teleout'..k, v.outside, vector3(v.l or 1.0, v.w or 1.0, 1.0), v.rot or 180.0, {
|
||||||
{
|
{
|
||||||
icon = 'fa-solid fa-door-closed',
|
icon = 'fa-solid fa-door-closed',
|
||||||
label = Bridge.Language.Locale('weed.teleportIn'),
|
label = Bridge.Language.Locale('weed.teleportIn'),
|
||||||
@@ -83,30 +83,34 @@ local function AlienEffect()
|
|||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent("md-drugs:client:dodabs", function()
|
RegisterNetEvent("md-drugs:client:dodabs", function()
|
||||||
if not ps.progressbar(Bridge.Language.Locale('weed.dabs'), 4000, 'bong2') then AlienEffect() return end
|
if not progressbar(Bridge.Language.Locale('weed.dabs'), 4000, 'bong2') then AlienEffect() return end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName)
|
local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName)
|
||||||
local options = {}
|
local options = {}
|
||||||
local items = ps.callback('md-drugs:server:GetWeedRecipe', tableName)
|
|
||||||
for k, v in pairs(items) do
|
for k, v in pairs(recipes[tableName]) do
|
||||||
local label = {}
|
local label = {}
|
||||||
local item = ''
|
local item = ''
|
||||||
for m, d in pairs(v.take) do table.insert(label, ps.getLabel(m) .. ' X ' .. d) end
|
for m, d in pairs(v.take) do table.insert(label, Bridge.Inventory.GetItemInfo(m).label .. ' X ' .. d .. ' \n ') end
|
||||||
for m, d in pairs(v.give) do item = m end
|
for m, d in pairs(v.give) do item = m end
|
||||||
|
local itemData = Bridge.Inventory.GetItemInfo(item)
|
||||||
options[#options + 1] = {
|
options[#options + 1] = {
|
||||||
icon = ps.getImage(item),
|
icon = itemData.image,
|
||||||
description = table.concat(label, ", "),
|
description = table.concat(label, " "),
|
||||||
title = ps.getLabel(item),
|
title = itemData.label,
|
||||||
action = function()
|
onSelect = function()
|
||||||
if not minigame() then return end
|
if not minigame() then return end
|
||||||
if not ps.progressbar(eventLabelPrefix .. ps.getLabel(item), 4000, 'uncuff') then return end
|
if not progressbar(eventLabelPrefix .. itemData.label, 4000, 'uncuff') then return end
|
||||||
TriggerServerEvent('md-drugs:server:MakeWeedItems', {item = item, recipe = 'weed', num = k, table = tableName})
|
TriggerServerEvent('md-drugs:server:MakeWeedItems', {item = item, recipe = 'weed', num = k, table = tableName})
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
ps.sorter(options, 'title')
|
Bridge.Menu.Open({
|
||||||
ps.menu(contextTitle, contextTitle, options)
|
id = contextId,
|
||||||
|
title = contextTitle,
|
||||||
|
options = options,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent('md-drugs:client:makeBluntWrap', function(data)
|
RegisterNetEvent('md-drugs:client:makeBluntWrap', function(data)
|
||||||
@@ -128,28 +132,33 @@ for k, v in pairs (locations.WeedSalesman) do
|
|||||||
icon = "fa-solid fa-cannabis",
|
icon = "fa-solid fa-cannabis",
|
||||||
label = Bridge.Language.Locale('weed.targetSales'),
|
label = Bridge.Language.Locale('weed.targetSales'),
|
||||||
action = function()
|
action = function()
|
||||||
local itemList = ps.callback('md-drugs:server:getWeedItems')
|
|
||||||
local options = {}
|
local options = {}
|
||||||
for m, d in pairs (itemList) do
|
for m, d in pairs (recipes.weedStore) do
|
||||||
|
local itemInfo = Bridge.Inventory.GetItemInfo(m)
|
||||||
options[#options + 1] = {
|
options[#options + 1] = {
|
||||||
icon = ps.getImage(m),
|
icon = itemInfo.image,
|
||||||
title = ps.getLabel(m),
|
title = itemInfo.label,
|
||||||
description = '$' .. d,
|
description = '$' .. d,
|
||||||
action = function()
|
onSelect = function()
|
||||||
local input = ps.input('Amount To Buy',{
|
local input = Bridge.Input.Open('Amount To Buy',{
|
||||||
{type = 'number', title = 'How Many To Buy', min = 1, max = 1000}
|
{type = 'number', title = 'How Many To Buy', min = 1, max = 1000}
|
||||||
})
|
})
|
||||||
if not input and input[1] then return end
|
if not input and input[1] then return end
|
||||||
if not ps.progressbar(Bridge.Language.Locale('weed.buying', ps.getLabel(m)), 2000, 'uncuff') then return end
|
if not progressbar(Bridge.Language.Locale('weed.buying', Bridge.Inventory.GetItemInfo(m).label), 2000, 'uncuff') then return end
|
||||||
TriggerServerEvent('md-drugs:server:buyWeedItem', k, m, input[1])
|
TriggerServerEvent('md-drugs:server:buyWeedItem', k, m, input[1])
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
ps.menu('Weed Shop', 'Weed Shop', options)
|
Bridge.Menu.Open({
|
||||||
|
id = 'weedDude',
|
||||||
|
title = 'Weed Salesman',
|
||||||
|
options = options,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local props = {}
|
local props = {}
|
||||||
|
|
||||||
for locationKey, locationData in pairs (locations.MakeButter) do
|
for locationKey, locationData in pairs (locations.MakeButter) do
|
||||||
@@ -158,6 +167,34 @@ for locationKey, locationData in pairs (locations.MakeButter) do
|
|||||||
props[#props+1] = CreateObject(locationData.prop, locationData.loc.x, locationData.loc.y, locationData.loc.z - 1.0, false, false, false)
|
props[#props+1] = CreateObject(locationData.prop, locationData.loc.x, locationData.loc.y, locationData.loc.z - 1.0, false, false, false)
|
||||||
FreezeEntityPosition(props[#props], true)
|
FreezeEntityPosition(props[#props], true)
|
||||||
SetEntityHeading(props[#props], locationData.loc.w)
|
SetEntityHeading(props[#props], locationData.loc.w)
|
||||||
|
Bridge.Target.AddLocalEntity(props[#props], {
|
||||||
|
{
|
||||||
|
icon = "fa-solid fa-cannabis",
|
||||||
|
label = Bridge.Language.Locale('weed.targetMakeButter'),
|
||||||
|
action = function()
|
||||||
|
local options = {}
|
||||||
|
for k, v in pairs (recipes.makeButter) do
|
||||||
|
local itemInfo = Bridge.Inventory.GetItemInfo(k)
|
||||||
|
local label = {}
|
||||||
|
for m, d in pairs(v.recipe) do table.insert(label, Bridge.Inventory.GetItemInfo(m).label .. ' X ' .. d .. ' \n ') end
|
||||||
|
options[#options + 1] = {
|
||||||
|
icon = itemInfo.image,
|
||||||
|
title = itemInfo.label,
|
||||||
|
description = table.concat(label, " "),
|
||||||
|
onSelect = function()
|
||||||
|
if not progressbar(Bridge.Language.Locale('weed.making', itemInfo.label), 2000, 'uncuff') then return end
|
||||||
|
TriggerServerEvent('md-drugs:server:MakeWeedItems', 'makeButter', k, locationKey)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
Bridge.Menu.Open({
|
||||||
|
id = 'weedMakeButter',
|
||||||
|
title = Bridge.Language.Locale('weed.makeButter'),
|
||||||
|
options = options,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for locationKey, locationData in pairs (locations.MakeOil) do
|
for locationKey, locationData in pairs (locations.MakeOil) do
|
||||||
@@ -166,5 +203,33 @@ for locationKey, locationData in pairs (locations.MakeOil) do
|
|||||||
props[#props+1] = CreateObject(locationData.prop, locationData.loc.x, locationData.loc.y, locationData.loc.z - 1.0, false, false, false)
|
props[#props+1] = CreateObject(locationData.prop, locationData.loc.x, locationData.loc.y, locationData.loc.z - 1.0, false, false, false)
|
||||||
FreezeEntityPosition(props[#props], true)
|
FreezeEntityPosition(props[#props], true)
|
||||||
SetEntityHeading(props[#props], locationData.loc.w)
|
SetEntityHeading(props[#props], locationData.loc.w)
|
||||||
|
Bridge.Target.AddLocalEntity(props[#props], {
|
||||||
|
{
|
||||||
|
icon = "fa-solid fa-cannabis",
|
||||||
|
label = Bridge.Language.Locale('weed.targetMakeOil'),
|
||||||
|
action = function()
|
||||||
|
local options = {}
|
||||||
|
for k, v in pairs (recipes.makeOil) do
|
||||||
|
local itemInfo = Bridge.Inventory.GetItemInfo(k)
|
||||||
|
local label = {}
|
||||||
|
for m, d in pairs(v.recipe) do table.insert(label, Bridge.Inventory.GetItemInfo(m).label .. ' X ' .. d .. ' \n ') end
|
||||||
|
options[#options + 1] = {
|
||||||
|
icon = itemInfo.image,
|
||||||
|
title = itemInfo.label,
|
||||||
|
description = table.concat(label, " "),
|
||||||
|
onSelect = function()
|
||||||
|
if not progressbar(Bridge.Language.Locale('weed.making', itemInfo.label), 2000, 'uncuff') then return end
|
||||||
|
TriggerServerEvent('md-drugs:server:MakeWeedItems', 'makeOil', k, locationKey)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
Bridge.Menu.Open({
|
||||||
|
id = 'weedMakeButter',
|
||||||
|
title = Bridge.Language.Locale('weed.makeButter'),
|
||||||
|
options = options,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+36
-31
@@ -1,12 +1,12 @@
|
|||||||
local prop = nil
|
local prop = nil
|
||||||
local function animation(color)
|
local function animation(color)
|
||||||
local coords = GetEntityCoords(PlayerPedId())
|
local coords = GetEntityCoords(PlayerPedId())
|
||||||
ps.requestAnim('mp_player_intdrink')
|
Bridge.Anim.RequestDict('mp_player_intdrink')
|
||||||
requestModel(color)
|
requestModel(color)
|
||||||
prop = CreateObject(GetHashKey(color), coords.x, coords.y, coords.z, true, true, true)
|
prop = CreateObject(GetHashKey(color), coords.x, coords.y, coords.z, true, true, true)
|
||||||
AttachEntityToEntity(prop, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 18905), 0.087000, -0.130001, 0.138999, 63.630001, 3.299881, -21.000000, true, true, false, true, 1, true)
|
AttachEntityToEntity(prop, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 18905), 0.087000, -0.130001, 0.138999, 63.630001, 3.299881, -21.000000, true, true, false, true, 1, true)
|
||||||
TaskPlayAnim(PlayerPedId(), 'mp_player_intdrink', 'loop_bottle', 8.0, -8.0, -1, 49, 0, false, false, false)
|
TaskPlayAnim(PlayerPedId(), 'mp_player_intdrink', 'loop_bottle', 8.0, -8.0, -1, 49, 0, false, false, false)
|
||||||
if ps.progressbar('Inhaling Nitrous', 5000, false) then
|
if progressbar('Inhaling Nitrous', 5000, false) then
|
||||||
ClearPedTasks(PlayerPedId())
|
ClearPedTasks(PlayerPedId())
|
||||||
DetachEntity(prop, true, true)
|
DetachEntity(prop, true, true)
|
||||||
DeleteEntity(prop)
|
DeleteEntity(prop)
|
||||||
@@ -28,7 +28,7 @@ local function blur(duration)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
ps.registerCallback('md-drugs:client:useWhippit', function(color)
|
Bridge.Callback.Register('md-drugs:client:useWhippit', function(color)
|
||||||
if animation(color) then
|
if animation(color) then
|
||||||
blur(30000)
|
blur(30000)
|
||||||
return true
|
return true
|
||||||
@@ -38,39 +38,44 @@ ps.registerCallback('md-drugs:client:useWhippit', function(color)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
local function spawnShops()
|
local function spawnShops()
|
||||||
local locations = ps.callback('md-drugs:server:getWhippitLocations')
|
|
||||||
for k, v in pairs(locations) do
|
for k, v in pairs(GlobalState.MDDrugsLocations.Whippit) do
|
||||||
requestModel(v.ped)
|
requestModel(v.ped)
|
||||||
local ped = CreatePed(5, GetHashKey(v.ped), v.loc.x, v.loc.y, v.loc.z, v.loc.w, true, true)
|
local ped = CreatePed(5, GetHashKey(v.ped), v.loc.x, v.loc.y, v.loc.z, v.loc.w, true, true)
|
||||||
FreezeEntityPosition(ped, true)
|
FreezeEntityPosition(ped, true)
|
||||||
SetEntityInvincible(ped, true)
|
SetEntityInvincible(ped, true)
|
||||||
SetBlockingOfNonTemporaryEvents(ped, true)
|
SetBlockingOfNonTemporaryEvents(ped, true)
|
||||||
--Bridge.Target.AddLocalEntity(ped, {
|
Bridge.Target.AddLocalEntity(ped, {
|
||||||
-- {
|
{
|
||||||
-- label = Bridge.Language.Locale('Whippit.targetShop'),
|
label = Bridge.Language.Locale('Whippit.targetShop'),
|
||||||
-- icon = 'fa-solid fa-cart-shopping',
|
icon = 'fa-solid fa-cart-shopping',
|
||||||
-- action = function()
|
action = function()
|
||||||
-- local menu = {}
|
local menu = {}
|
||||||
-- local items = ps.callback('md-drugs:server:getwhippitShop')
|
for item, price in pairs (GlobalState.MDDrugsRecipes.Whippit.shop) do
|
||||||
-- for item, price in pairs (items) do
|
local itemInfo = Bridge.Inventory.GetItemInfo(item)
|
||||||
-- menu[#menu + 1] = {
|
Bridge.Prints.Debug(itemInfo)
|
||||||
-- title = ps.getLabel(item),
|
menu[#menu + 1] = {
|
||||||
-- icon = ps.getImage(item),
|
title = itemInfo.label,
|
||||||
-- description = '$' .. price,
|
icon = itemInfo.image,
|
||||||
-- action = function()
|
description = '$' .. price,
|
||||||
-- local amount = ps.input(ps.getLabel(item), {
|
onSelect = function()
|
||||||
-- {type = 'number', label = 'Amount', name = 'amount', min = 1, max = 100, default = 1}
|
local amount = Bridge.Input.Open(itemInfo.label, {
|
||||||
-- })
|
{type = 'number', label = 'Amount', name = 'amount', min = 1, max = 100, default = 1}
|
||||||
-- if amount and amount[1] then
|
})
|
||||||
-- TriggerServerEvent('md-drugs:server:buyWhippitItem', k, item, amount[1])
|
if amount and amount[1] then
|
||||||
-- end
|
TriggerServerEvent('md-drugs:server:buyWhippitItem', k, item, amount[1])
|
||||||
-- end
|
end
|
||||||
-- }
|
end
|
||||||
-- end
|
}
|
||||||
-- ps.menu(Bridge.Language.Locale('Whippit.shopHeader'), Bridge.Language.Locale('Whippit.shopHeader'), menu)
|
end
|
||||||
-- end
|
Bridge.Menu.Open({
|
||||||
-- },
|
id = 'whippitShop',
|
||||||
--})
|
title = Bridge.Language.Locale('Whippit.shopHeader'),
|
||||||
|
options = menu
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -150,23 +150,23 @@ xanax = { anim = 'pill', effect = 'none', add = { stress = -40
|
|||||||
}
|
}
|
||||||
|
|
||||||
for k, v in pairs(Consume) do
|
for k, v in pairs(Consume) do
|
||||||
ps.createUseable(k, function(source, item)
|
Bridge.Callback.Register(k, function(source, item)
|
||||||
if not ps.hasItem(source, k, 1) then return end
|
if not Bridge.Inventory.HasItem(source, k, 1) then return end
|
||||||
local time = v.time or Consumables.defaulttime
|
local time = v.time or Consumables.defaulttime
|
||||||
local effect = v.effect or 0
|
local effect = v.effect or 0
|
||||||
local anim = v.anim or Consumables.defaultanim
|
local anim = v.anim or Consumables.defaultanim
|
||||||
local progressbartext = v.progressbartext or Consumables.defaultprogresstext
|
local progressbartext = v.progressbartext or Consumables.defaultprogresstext
|
||||||
local add = v.add or {hunger = 0}
|
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
|
if done then
|
||||||
ps.removeItem(source, k, 1)
|
Bridge.Inventory.RemoveItem(source, k, 1)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
|
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
|
||||||
local src = source
|
local src = source
|
||||||
local Player = ps.getPlayer(src)
|
local Player = Bridge.Framework.GetPlayer(src)
|
||||||
if GetResourceState('es_extended') == 'started' then return end
|
if GetResourceState('es_extended') == 'started' then return end
|
||||||
local hunger, thirst = Player.PlayerData.metadata.hunger, Player.PlayerData.metadata.thirst
|
local hunger, thirst = Player.PlayerData.metadata.hunger, Player.PlayerData.metadata.thirst
|
||||||
if stat == "thirst" then
|
if stat == "thirst" then
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ local function getLoc(src, ped)
|
|||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
Bridge.Callback.Register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, ped)
|
Bridge.Callback.Register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, ped)
|
||||||
local src = source
|
local src = source
|
||||||
local rep = getRep(source, 'cornerselling')
|
local rep = getRep(source, 'cornerselling')
|
||||||
@@ -269,19 +270,17 @@ RegisterNetEvent('md-drugs:server:getBackRobbed', function(peds)
|
|||||||
RobbedDrugs[src] = nil
|
RobbedDrugs[src] = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
ps.registerCommand('cornersell', {
|
|
||||||
help = Bridge.Language.Locale('Cornerselling.comDes'),
|
RegisterCommand('cornersell', function(source, args, raw)
|
||||||
params = {
|
|
||||||
},
|
|
||||||
}, function(source, args, raw)
|
|
||||||
local src = source
|
local src = source
|
||||||
local jobCount = ps.getJobTypeCount('leo')
|
local jobCount = Bridge.Framework.GetPlayersByJob('police')
|
||||||
if jobCount < cornsellConfig.policeRequired then
|
if #jobCount < cornsellConfig.policeRequired then
|
||||||
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.noCops'), 'error')
|
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.noCops'), 'error')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
TriggerClientEvent('md-drugs:client:cornerselling', src)
|
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()
|
RegisterServerEvent('md-drugs:server:cornerselling:stop', function()
|
||||||
local src = source
|
local src = source
|
||||||
|
|||||||
+1
-1
@@ -91,7 +91,7 @@ for k, v in pairs (cokecut) do
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if Bridge.Inventory.HasItem(src,item.name) then
|
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 not check then return end
|
||||||
if Bridge.Inventory.RemoveItem(src, k, 1) and Bridge.Inventory.RemoveItem(src, 'bakingsoda', 1) then
|
if Bridge.Inventory.RemoveItem(src, k, 1) and Bridge.Inventory.RemoveItem(src, 'bakingsoda', 1) then
|
||||||
Bridge.Inventory.AddItem(src, 'crackrock', v)
|
Bridge.Inventory.AddItem(src, 'crackrock', v)
|
||||||
|
|||||||
@@ -235,6 +235,7 @@ ps.registerCommand("deletedealer", {
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
RegisterNetEvent('md-drugs:server:buyItemDealer', function(num, loc)
|
RegisterNetEvent('md-drugs:server:buyItemDealer', function(num, loc)
|
||||||
local src = source
|
local src = source
|
||||||
local itemData = Products[num]
|
local itemData = Products[num]
|
||||||
@@ -249,7 +250,7 @@ RegisterNetEvent('md-drugs:server:buyItemDealer', function(num, loc)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
Bridge.Inventory.AddItem(src, itemData.name, 1)
|
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)
|
end)
|
||||||
|
|
||||||
Dealers = MySQL.query.await('SELECT * FROM dealers')
|
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')
|
return Bridge.Framework.GetPlayersByJob('police')
|
||||||
end)
|
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)
|
local rep = GetAllRep(source)
|
||||||
return rep
|
return rep
|
||||||
end)
|
end)
|
||||||
|
|||||||
+90
-22
@@ -1,6 +1,7 @@
|
|||||||
|
Locations = Locations or {}
|
||||||
|
Recipes = Recipes or {}
|
||||||
local onRun = {}
|
local onRun = {}
|
||||||
local leanLocs = {
|
Locations.Lean = {
|
||||||
MakeLean = {
|
MakeLean = {
|
||||||
{
|
{
|
||||||
loc = vector3(2635.81, 4240.57, 45.32),
|
loc = vector3(2635.81, 4240.57, 45.32),
|
||||||
@@ -22,10 +23,28 @@ local leanLocs = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
ps.registerCallback('md-drugs:server:GetLeanLocs', function(source)
|
GlobalState.MDDrugsLocations = Locations
|
||||||
return leanLocs
|
Recipes.Lean = {
|
||||||
end)
|
{
|
||||||
|
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)
|
local function setTimeout(identifier)
|
||||||
if onRun[identifier] then
|
if onRun[identifier] then
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
@@ -36,21 +55,33 @@ local function setTimeout(identifier)
|
|||||||
end
|
end
|
||||||
RegisterServerEvent('md-drugs:server:givelean', function()
|
RegisterServerEvent('md-drugs:server:givelean', function()
|
||||||
local src = source
|
local src = source
|
||||||
local amount = math.random(1,5)
|
if not onRun[src] then
|
||||||
if not onRun[ps.getIdentifier(src)] then return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('lean.notOnRun'), "error") end
|
return
|
||||||
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)
|
|
||||||
end
|
end
|
||||||
if onRun[ps.getIdentifier(src)] >= 4 then
|
local veh = onRun[src].vehicle
|
||||||
onRun[ps.getIdentifier(src)] = nil
|
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
|
||||||
end)
|
end)
|
||||||
|
|
||||||
exports.ps_lib:registerCrafter({
|
exports.ps_lib:registerCrafter({
|
||||||
loc = leanLocs.MakeLean,
|
loc = Locations.Lean.MakeLean,
|
||||||
recipes = {
|
recipes = {
|
||||||
cupoflean = {
|
cupoflean = {
|
||||||
amount = 1,
|
amount = 1,
|
||||||
@@ -80,14 +111,51 @@ exports.ps_lib:registerCrafter({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
ps.registerCallback('md-drugs:server:RegisterLean', function(source)
|
Bridge.Callback.Register('md-drugs:server:registerLean', function(source, loc, vehicleNetId)
|
||||||
local identifier = ps.getIdentifier(source)
|
local src = source
|
||||||
if not identifier then return false end
|
if onRun[src] then
|
||||||
if onRun[identifier] then
|
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
onRun[identifier] = 0
|
if not checkDistance(src, Locations.Lean.SyrupVendor[loc].loc, 5.0) then
|
||||||
setTimeout(identifier)
|
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
|
return true
|
||||||
end
|
end
|
||||||
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
|
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 = ""},
|
{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 = ""},
|
{loc = vector4(1030.77, -3203.18, -38.2, 262.37), ped = 'a_m_m_farmer_01', gang = ""},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Recipes.Weed = {
|
||||||
local weedStore = {
|
|
||||||
weedgrinder =25,
|
|
||||||
mdbutter =25,
|
|
||||||
flour =25,
|
|
||||||
chocolate =25,
|
|
||||||
butane =25,
|
|
||||||
butanetorch =2,
|
|
||||||
dabrig =2,
|
|
||||||
mdwoods =2,
|
|
||||||
}
|
|
||||||
|
|
||||||
local weed = {
|
|
||||||
blunts = {
|
blunts = {
|
||||||
blunt = {take = {bluntwrap = 1, grindedweed = 1}, give = {blunt = 1}},
|
blunt = {take = {bluntwrap = 1, grindedweed = 1}, give = {blunt = 1}},
|
||||||
chewyblunt = {take = {bluntwrap = 1, grindedweed = 1, loosecoke = 1}, give = {chewyblunt = 1}},
|
chewyblunt = {take = {bluntwrap = 1, grindedweed = 1, loosecoke = 1}, give = {chewyblunt = 1}},
|
||||||
@@ -40,106 +31,8 @@ local weed = {
|
|||||||
bluntwrap = {
|
bluntwrap = {
|
||||||
leanbluntwrap = {take = {bluntwrap = 5, mdlean = 1}, give = {leanbluntwrap = 5}},
|
leanbluntwrap = {take = {bluntwrap = 5, mdlean = 1}, give = {leanbluntwrap = 5}},
|
||||||
dextrobluntwrap = {take = {bluntwrap = 5, mdreddextro = 1}, give = {dextrobluntwrap = 5}},
|
dextrobluntwrap = {take = {bluntwrap = 5, mdreddextro = 1}, give = {dextrobluntwrap = 5}},
|
||||||
}
|
},
|
||||||
}
|
makeButter= {
|
||||||
|
|
||||||
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 = {
|
|
||||||
cannabutter = {
|
cannabutter = {
|
||||||
amount = 1,
|
amount = 1,
|
||||||
time = 4000,
|
time = 4000,
|
||||||
@@ -186,13 +79,8 @@ exports['ps_lib']:registerCrafter({
|
|||||||
flour = 1
|
flour = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
}
|
makeOil = {
|
||||||
})
|
|
||||||
|
|
||||||
exports['ps_lib']:registerCrafter({
|
|
||||||
loc = weedLocs.MakeOil,
|
|
||||||
recipes = {
|
|
||||||
shatter = {
|
shatter = {
|
||||||
amount = 1,
|
amount = 1,
|
||||||
time = 4000,
|
time = 4000,
|
||||||
@@ -202,7 +90,128 @@ exports['ps_lib']:registerCrafter({
|
|||||||
grindedweed = 1
|
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 @@
|
|||||||
|
Locations, Recipes = Locations or {}, Recipes or {}
|
||||||
local itemCraft = {
|
Recipes.Whippit = {
|
||||||
cracker = {
|
cracker = {
|
||||||
{color = 'blue', item = 'blue_uninflated_balloon'},
|
{color = 'blue', item = 'blue_uninflated_balloon'},
|
||||||
{color = 'green', item = 'green_uninflated_balloon'},
|
{color = 'green', item = 'green_uninflated_balloon'},
|
||||||
@@ -8,48 +8,45 @@ local itemCraft = {
|
|||||||
{color = 'red', item = 'red_uninflated_balloon'},
|
{color = 'red', item = 'red_uninflated_balloon'},
|
||||||
{color = 'white', item = 'white_uninflated_balloon'},
|
{color = 'white', item = 'white_uninflated_balloon'},
|
||||||
{color = 'yellow', item = 'yellow_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' },
|
{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)
|
GlobalState.MDDrugsLocations = Locations
|
||||||
return itemShop
|
GlobalState.MDDrugsRecipes = Recipes
|
||||||
end)
|
|
||||||
|
|
||||||
RegisterServerEvent('md-drugs:server:buyWhippitItem', function(loc, item,amount)
|
RegisterServerEvent('md-drugs:server:buyWhippitItem', function(loc, item,amount)
|
||||||
local src = source
|
local src = source
|
||||||
if not ps.checkDistance(src, store[loc].loc, 3.0) then return end
|
if not ps.checkDistance(src, Locations.Whippit[loc].loc, 3.0) then return end
|
||||||
if not itemShop[item] then return end
|
if not Recipes.Whippit.shop[item] then return end
|
||||||
local price = itemShop[item] * amount
|
local price = Recipes.Whippit.shop[item] * amount
|
||||||
if not ps.removeMoney(src, 'cash', price, 'whippit-shop') then
|
if not Bridge.Framework.RemoveAccountBalance(src, 'cash', price, 'whippit-shop') then
|
||||||
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.notEnoughMoney', price), 'error')
|
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.notEnoughMoney', price), 'error')
|
||||||
end
|
end
|
||||||
ps.addItem(src, item, amount)
|
Bridge.Inventory.AddItem(src, item, amount)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
ps.createUseable('cracker', function(source)
|
Bridge.Framework.RegisterUsableItem('cracker', function(source)
|
||||||
local src = source
|
local src = source
|
||||||
if not ps.hasItem(src, 'cracker', 1) then return end
|
if not Bridge.Inventory.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, 'whipped_cream_cannister', 1) then return end
|
||||||
local balloonItem, balloonColor = nil, nil
|
local balloonItem, balloonColor = nil, nil
|
||||||
for _, balloon in pairs(itemCraft['cracker']) do
|
for _, balloon in pairs(Recipes.Whippit.cracker) do
|
||||||
if ps.hasItem(src, balloon.item, 1) then
|
if Bridge.Inventory.HasItem(src, balloon.item, 1) then
|
||||||
balloonItem = balloon.item
|
balloonItem = balloon.item
|
||||||
balloonColor = 'ate_balloon_' .. balloon.color
|
balloonColor = 'ate_balloon_' .. balloon.color
|
||||||
break
|
break
|
||||||
@@ -59,11 +56,11 @@ ps.createUseable('cracker', function(source)
|
|||||||
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.needBalloon'), 'error')
|
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.needBalloon'), 'error')
|
||||||
end
|
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')
|
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.needCanister'), 'error')
|
||||||
end
|
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')
|
return ps.warn(src, 'Failed to remove balloon', 'error')
|
||||||
end
|
end
|
||||||
ps.callback('md-drugs:client:useWhippit', src, balloonColor)
|
Bridge.Callback.Trigger('md-drugs:client:useWhippit', src, balloonColor)
|
||||||
end)
|
end)
|
||||||
Reference in new issue
Block a user