90%
This commit is contained in:
1 parent
66934fd68a
commit
df9584711a
16 files changed
+537
-291
No files matched your search
+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