- add whippits :)

This commit is contained in:
Mustache Dom committed 2025-10-11 23:18:48 -07:00
1 parent ec5e4f0e15
commit 3ba3c5bc9d
33 files changed
+324 -86

No files matched your search

+52 -20
View File
@@ -1,37 +1,69 @@
local itemCraft = {
cracker = {
'blue_uninflated_balloon',
'green_uninflated_balloon',
'orange_uninflated_balloon',
'purple_uninflated_balloon',
'red_uninflated_balloon',
'white_uninflated_balloon',
'yellow_uninflated_balloon'
{color = 'blue', item = 'blue_uninflated_balloon'},
{color = 'green', item = 'green_uninflated_balloon'},
{color = 'orange', item = 'orange_uninflated_balloon'},
{color = 'purple', item = 'purple_uninflated_balloon'},
{color = 'red', item = 'red_uninflated_balloon'},
{color = 'white', item = 'white_uninflated_balloon'},
{color = 'yellow', item = 'yellow_uninflated_balloon'}
}
}
local store = {
{loc =vector4(1695.47, 4872.98, 42.16, 288.86), ped = 'ig_priest' },
}
ps.registerCallback('md-drugs:server:getWhippitLocations', function(source)
return store
end)
local itemShop = {
blue_uninflated_balloon = 5,
green_uninflated_balloon = 5,
orange_uninflated_balloon = 5,
purple_uninflated_balloon = 5,
red_uninflated_balloon = 5,
white_uninflated_balloon = 5,
yellow_uninflated_balloon = 5,
cracker = 500,
whipped_cream_cannister = 10
}
ps.registerCallback('md-drugs:server:getwhippitShop', function(source)
return itemShop
end)
RegisterServerEvent('md-drugs:server:buyWhippitItem', function(loc, item,amount)
local src = source
if not ps.checkDistance(src, store[loc].loc, 3.0) then return end
if not itemShop[item] then return end
local price = itemShop[item] * amount
if not ps.removeMoney(src, 'cash', price, 'whippit-shop') then
return ps.notify(src, ps.lang('Whippit.notEnoughMoney', price), 'error')
end
ps.addItem(src, item, amount)
end)
ps.createUseable('cracker', function(source)
local src = source
if not itemCraft['cracker'] then return end
if not ps.hasItem(src, 'cracker') then return end
if not ps.hasItem(src, 'whipped_cream_cannister') then return end
local hasBalloon = nil
for _, balloon in pairs(itemCraft['cracker'].optionalColors) do
if ps.getItemCount(src, balloon) >= 1 then
hasBalloon = balloon
if not ps.hasItem(src, 'cracker', 1) then return end
if not ps.hasItem(src, 'whipped_cream_cannister', 1) then return end
local balloonItem, balloonColor = nil, nil
for _, balloon in pairs(itemCraft['cracker']) do
if ps.hasItem(src, balloon.item, 1) then
balloonItem = balloon.item
balloonColor = 'ate_balloon_' .. balloon.color
break
end
end
if not hasBalloon then
return ps.notify(src, 'You do not have a balloon to use the cracker on', 'error')
if not balloonItem then
return ps.notify(src, ps.lang('Whippit.needBalloon'), 'error')
end
if not ps.removeItem(src, 'whipped_cream_cannister', 1) then
return ps.notify(src, 'Failed to remove whipped cream canister', 'error')
return ps.notify(src, ps.lang('Whippit.needCanister'), 'error')
end
if not ps.removeItem(src, hasBalloon, 1) then
return ps.notify(src, 'Failed to remove balloon', 'error')
if not ps.removeItem(src, balloonItem, 1) then
return ps.warn(src, 'Failed to remove balloon', 'error')
end
--TODO: Add animation callback
ps.callback('md-drugs:client:useWhippit', src, balloonColor)
end)