90%
This commit is contained in:
1 parent
66934fd68a
commit
df9584711a
16 files changed
+537
-291
No files matched your search
@@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
ps.registerCallback('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item)
|
||||
if not ps.progressbar(progresstext .. ps.getLabel(item).. "!", time, anim ) then return end
|
||||
Bridge.Callback.Register('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item)
|
||||
if not progressbar(progresstext .. Bridge.Inventory.GetItemInfo(item).label.. "!", time, anim ) then return end
|
||||
for k, v in pairs (status) do
|
||||
if k == 'health' then
|
||||
local cur = GetEntityHealth(PlayerPedId())
|
||||
|
||||
@@ -185,6 +185,10 @@ local function Cornersell()
|
||||
end
|
||||
|
||||
RegisterNetEvent('md-drugs:client:cornerselling', function()
|
||||
if inZone then
|
||||
Bridge.Notify.SendNotify(Bridge.Language.Locale('Cornerselling.inNoSellZone'), 'error')
|
||||
return
|
||||
end
|
||||
if sell then
|
||||
sell = false
|
||||
Bridge.HelpText.HideHelpText()
|
||||
@@ -198,7 +202,17 @@ end)
|
||||
|
||||
CreateThread(function()
|
||||
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,
|
||||
onEnter = function() inZone = true end, onExit = function() inZone = false end})
|
||||
Bridge.Point.Register(
|
||||
'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)
|
||||
@@ -1,6 +1,6 @@
|
||||
--TODO: Make dealers better
|
||||
local isActive = false
|
||||
local dealer = {}
|
||||
--TODO: Finish Dealers
|
||||
local function SpawnDealer()
|
||||
if #dealer >= 1 then
|
||||
for k,v in pairs (dealer) do
|
||||
|
||||
+60
-18
@@ -97,7 +97,7 @@ function minigame()
|
||||
end
|
||||
|
||||
function GetRep()
|
||||
local rep = ps.callback('md-drugs:server:GetRep')
|
||||
local rep = Bridge.Callback.Trigger('md-drugs:server:GetRep')
|
||||
return rep
|
||||
end
|
||||
|
||||
@@ -124,7 +124,7 @@ end
|
||||
|
||||
function GetCops(number)
|
||||
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
|
||||
end
|
||||
|
||||
@@ -136,6 +136,43 @@ function Freeze(entity, toggle, head)
|
||||
SetBlockingOfNonTemporaryEvents(entity, toggle)
|
||||
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 heading = 180.0
|
||||
function StartRay()
|
||||
@@ -144,10 +181,10 @@ function StartRay()
|
||||
requestModel('v_ret_ml_tablea', 30000)
|
||||
local table = CreateObject('v_ret_ml_tablea', pedcoord.x, pedcoord.y, pedcoord.z+1, heading, false, false)
|
||||
repeat
|
||||
local hit, endCoords, surfaceNormal, entityHit = ps.raycast()
|
||||
local hit, endCoords, surfaceNormal, entityHit = ray()
|
||||
if not created then
|
||||
created = true
|
||||
ps.drawText([[[E] To Place
|
||||
Bridge.HelpText.ShowHelpText([[[E] To Place
|
||||
[DEL] To Cancel
|
||||
[<-] To Move Left
|
||||
[->] To Move Right]])
|
||||
@@ -164,7 +201,7 @@ function StartRay()
|
||||
heading = heading + 2
|
||||
end
|
||||
if IsControlPressed(0, 38) then
|
||||
ps.hideText()
|
||||
Bridge.HelpText.HideHelpText()
|
||||
run = false
|
||||
DeleteObject(table)
|
||||
created = false
|
||||
@@ -172,7 +209,7 @@ function StartRay()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 178) then
|
||||
ps.hideText()
|
||||
Bridge.HelpText.HideHelpText()
|
||||
run = false
|
||||
created = false
|
||||
DeleteObject(table)
|
||||
@@ -188,10 +225,10 @@ function StartRay2()
|
||||
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)
|
||||
repeat
|
||||
local hit, endCoords, surfaceNormal, entityHit = ps.raycast()
|
||||
local hit, endCoords, surfaceNormal, entityHit = ray()
|
||||
if not created then
|
||||
created = true
|
||||
ps.drawText([[[E] To Place
|
||||
Bridge.HelpText.ShowHelpText([[[E] To Place
|
||||
[DEL] To Cancel
|
||||
[<-] To Move Left
|
||||
[->] To Move Right]])
|
||||
@@ -208,7 +245,7 @@ function StartRay2()
|
||||
heading = heading + 2
|
||||
end
|
||||
if IsControlPressed(0, 38) then
|
||||
ps.hideText()
|
||||
Bridge.HelpText.HideHelpText()
|
||||
run = false
|
||||
DeleteObject(table)
|
||||
created = false
|
||||
@@ -216,7 +253,7 @@ function StartRay2()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 178) then
|
||||
ps.hideText()
|
||||
Bridge.HelpText.HideHelpText()
|
||||
run = false
|
||||
created = false
|
||||
DeleteObject(table)
|
||||
@@ -226,20 +263,25 @@ function StartRay2()
|
||||
until run == false
|
||||
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
|
||||
return true
|
||||
end)
|
||||
|
||||
RegisterCommand('DrugRep', function()
|
||||
if not Config.TierSystem then return end
|
||||
local rep = ps.callback('md-drugs:server:GetRep', false)
|
||||
ps.menu('Drug Rep', 'Drug Rep', {
|
||||
{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 }
|
||||
local rep = GetRep()
|
||||
Bridge.Menu.Open({
|
||||
id = 'drugrep',
|
||||
title = 'Drug Reputation',
|
||||
description = 'Your Current Drug Reputation Stats',
|
||||
options = {
|
||||
{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)
|
||||
|
||||
|
||||
+63
-17
@@ -1,61 +1,67 @@
|
||||
|
||||
local started = false
|
||||
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 start = location.StartLoc[math.random(1,#location.StartLoc)]
|
||||
|
||||
if started then Bridge.Notify.SendNotify(Bridge.Language.Locale('lean.alreadyChasing'), 'error') return end
|
||||
started = true
|
||||
|
||||
ps.callback('md-drugs:server:RegisterLean')
|
||||
requestModel("pounder", 30000)
|
||||
requestModel("ig_priest", 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 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)
|
||||
SetEntityInvincible(pilot2, true)
|
||||
SetEntityAsMissionEntity(leancar)
|
||||
AddBlipForEntity(leancar)
|
||||
SetPedIntoVehicle(driver, leancar, -1)
|
||||
SetEntityAsMissionEntity(leanCar)
|
||||
AddBlipForEntity(leanCar)
|
||||
SetPedIntoVehicle(driver, leanCar, -1)
|
||||
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)
|
||||
|
||||
repeat
|
||||
Wait(1000)
|
||||
until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0
|
||||
|
||||
RemoveBlip(leancar)
|
||||
RemoveBlip(leanCar)
|
||||
|
||||
if GetEntityHealth(driver) == 0 then
|
||||
Bridge.Target.AddLocalEntity(leancar, {
|
||||
Bridge.Target.AddLocalEntity(leanCar, {
|
||||
{
|
||||
name = 'leancar',
|
||||
icon = 'fa-solid fa-car',
|
||||
label = Bridge.Language.Locale('lean.stealFromTruck'),
|
||||
action = function()
|
||||
hit = hit + 1
|
||||
if not minigame() then return end
|
||||
TriggerServerEvent('md-drugs:server:givelean')
|
||||
started = false
|
||||
if math.random(1,100) <= 30 or hit == 4 then
|
||||
hit = 0
|
||||
DeleteVehicle(leancar)
|
||||
DeleteEntity(driver)
|
||||
DeleteEntity(pilot2)
|
||||
end
|
||||
end
|
||||
}
|
||||
})
|
||||
else
|
||||
DeleteVehicle(leancar)
|
||||
DeleteEntity(driver)
|
||||
DeleteEntity(pilot2)
|
||||
end
|
||||
@@ -79,4 +85,44 @@ for k, v in pairs (location.SyrupVendor) do
|
||||
end
|
||||
},
|
||||
})
|
||||
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 locations = GlobalState.MDDrugsLocations.Mescaline
|
||||
local function AlienEffect()
|
||||
CreateThread(function()
|
||||
StartScreenEffect("DrugsMichaelAliensFightIn", 3.0, 0)
|
||||
@@ -13,7 +13,7 @@ local function AlienEffect()
|
||||
end)
|
||||
end
|
||||
|
||||
local locations = GlobalState.MDDrugsLocations.Mescaline
|
||||
|
||||
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,{
|
||||
{
|
||||
|
||||
+90
-25
@@ -1,12 +1,12 @@
|
||||
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
|
||||
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',
|
||||
label = Bridge.Language.Locale('weed.targetDry'),
|
||||
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")
|
||||
return
|
||||
end
|
||||
@@ -25,7 +25,7 @@ for k, v in pairs (locations.WeedDry) do
|
||||
action = function()
|
||||
DeleteEntity(weedplant)
|
||||
drying = false
|
||||
TriggerServerEvent('md-drugs:server:dryoutweed')
|
||||
TriggerServerEvent('md-drugs:server:dryoutweed', k)
|
||||
end,
|
||||
}
|
||||
})
|
||||
@@ -39,7 +39,7 @@ for k, v in pairs (locations.WeedDry) do
|
||||
end
|
||||
|
||||
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',
|
||||
label = Bridge.Language.Locale('weed.teleportOut'),
|
||||
@@ -48,7 +48,7 @@ for k, v in pairs (locations.WeedTele) do
|
||||
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',
|
||||
label = Bridge.Language.Locale('weed.teleportIn'),
|
||||
@@ -83,30 +83,34 @@ local function AlienEffect()
|
||||
end
|
||||
|
||||
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)
|
||||
|
||||
local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName)
|
||||
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 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
|
||||
local itemData = Bridge.Inventory.GetItemInfo(item)
|
||||
options[#options + 1] = {
|
||||
icon = ps.getImage(item),
|
||||
description = table.concat(label, ", "),
|
||||
title = ps.getLabel(item),
|
||||
action = function()
|
||||
icon = itemData.image,
|
||||
description = table.concat(label, " "),
|
||||
title = itemData.label,
|
||||
onSelect = function()
|
||||
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})
|
||||
end
|
||||
}
|
||||
end
|
||||
ps.sorter(options, 'title')
|
||||
ps.menu(contextTitle, contextTitle, options)
|
||||
Bridge.Menu.Open({
|
||||
id = contextId,
|
||||
title = contextTitle,
|
||||
options = options,
|
||||
})
|
||||
end
|
||||
|
||||
RegisterNetEvent('md-drugs:client:makeBluntWrap', function(data)
|
||||
@@ -128,28 +132,33 @@ for k, v in pairs (locations.WeedSalesman) do
|
||||
icon = "fa-solid fa-cannabis",
|
||||
label = Bridge.Language.Locale('weed.targetSales'),
|
||||
action = function()
|
||||
local itemList = ps.callback('md-drugs:server:getWeedItems')
|
||||
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] = {
|
||||
icon = ps.getImage(m),
|
||||
title = ps.getLabel(m),
|
||||
icon = itemInfo.image,
|
||||
title = itemInfo.label,
|
||||
description = '$' .. d,
|
||||
action = function()
|
||||
local input = ps.input('Amount To Buy',{
|
||||
onSelect = function()
|
||||
local input = Bridge.Input.Open('Amount To Buy',{
|
||||
{type = 'number', title = 'How Many To Buy', min = 1, max = 1000}
|
||||
})
|
||||
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])
|
||||
end
|
||||
}
|
||||
end
|
||||
ps.menu('Weed Shop', 'Weed Shop', options)
|
||||
Bridge.Menu.Open({
|
||||
id = 'weedDude',
|
||||
title = 'Weed Salesman',
|
||||
options = options,
|
||||
})
|
||||
end
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local props = {}
|
||||
|
||||
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)
|
||||
FreezeEntityPosition(props[#props], true)
|
||||
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
|
||||
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)
|
||||
FreezeEntityPosition(props[#props], true)
|
||||
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
|
||||
+36
-31
@@ -1,12 +1,12 @@
|
||||
local prop = nil
|
||||
local function animation(color)
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
ps.requestAnim('mp_player_intdrink')
|
||||
Bridge.Anim.RequestDict('mp_player_intdrink')
|
||||
requestModel(color)
|
||||
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)
|
||||
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())
|
||||
DetachEntity(prop, true, true)
|
||||
DeleteEntity(prop)
|
||||
@@ -28,7 +28,7 @@ local function blur(duration)
|
||||
end)
|
||||
end
|
||||
|
||||
ps.registerCallback('md-drugs:client:useWhippit', function(color)
|
||||
Bridge.Callback.Register('md-drugs:client:useWhippit', function(color)
|
||||
if animation(color) then
|
||||
blur(30000)
|
||||
return true
|
||||
@@ -38,39 +38,44 @@ ps.registerCallback('md-drugs:client:useWhippit', function(color)
|
||||
end)
|
||||
|
||||
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)
|
||||
local ped = CreatePed(5, GetHashKey(v.ped), v.loc.x, v.loc.y, v.loc.z, v.loc.w, true, true)
|
||||
FreezeEntityPosition(ped, true)
|
||||
SetEntityInvincible(ped, true)
|
||||
SetBlockingOfNonTemporaryEvents(ped, true)
|
||||
--Bridge.Target.AddLocalEntity(ped, {
|
||||
-- {
|
||||
-- label = Bridge.Language.Locale('Whippit.targetShop'),
|
||||
-- icon = 'fa-solid fa-cart-shopping',
|
||||
-- action = function()
|
||||
-- local menu = {}
|
||||
-- local items = ps.callback('md-drugs:server:getwhippitShop')
|
||||
-- for item, price in pairs (items) do
|
||||
-- menu[#menu + 1] = {
|
||||
-- title = ps.getLabel(item),
|
||||
-- icon = ps.getImage(item),
|
||||
-- description = '$' .. price,
|
||||
-- action = function()
|
||||
-- local amount = ps.input(ps.getLabel(item), {
|
||||
-- {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])
|
||||
-- end
|
||||
-- end
|
||||
-- }
|
||||
-- end
|
||||
-- ps.menu(Bridge.Language.Locale('Whippit.shopHeader'), Bridge.Language.Locale('Whippit.shopHeader'), menu)
|
||||
-- end
|
||||
-- },
|
||||
--})
|
||||
Bridge.Target.AddLocalEntity(ped, {
|
||||
{
|
||||
label = Bridge.Language.Locale('Whippit.targetShop'),
|
||||
icon = 'fa-solid fa-cart-shopping',
|
||||
action = function()
|
||||
local menu = {}
|
||||
for item, price in pairs (GlobalState.MDDrugsRecipes.Whippit.shop) do
|
||||
local itemInfo = Bridge.Inventory.GetItemInfo(item)
|
||||
Bridge.Prints.Debug(itemInfo)
|
||||
menu[#menu + 1] = {
|
||||
title = itemInfo.label,
|
||||
icon = itemInfo.image,
|
||||
description = '$' .. price,
|
||||
onSelect = function()
|
||||
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])
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
Bridge.Menu.Open({
|
||||
id = 'whippitShop',
|
||||
title = Bridge.Language.Locale('Whippit.shopHeader'),
|
||||
options = menu
|
||||
})
|
||||
end
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user