diff --git a/client/whippit.lua b/client/whippit.lua new file mode 100644 index 0000000..00a4fe5 --- /dev/null +++ b/client/whippit.lua @@ -0,0 +1,77 @@ +local prop = nil +local function animation(color) + local coords = GetEntityCoords(PlayerPedId()) + ps.requestAnim('mp_player_intdrink') + ps.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 + ClearPedTasks(PlayerPedId()) + DetachEntity(prop, true, true) + DeleteEntity(prop) + prop = nil + return true + else + ClearPedTasks(PlayerPedId()) + DetachEntity(prop, true, true) + DeleteEntity(prop) + prop = nil + return false + end +end +local function blur(duration) + CreateThread(function() + TriggerScreenblurFadeIn(1000) + Wait(duration) + TriggerScreenblurFadeOut(1000) + end) +end + +ps.registerCallback('md-drugs:client:useWhippit', function(color) + if animation(color) then + blur(30000) + return true + else + return false + end +end) + +local function spawnShops() + local locations = ps.callback('md-drugs:server:getWhippitLocations') + for k, v in pairs(locations) do + ps.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) + ps.entityTarget(ped, { + { + label = ps.lang('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(ps.lang('Whippit.shopHeader'), ps.lang('Whippit.shopHeader'), menu) + end + }, + }) + end +end + +spawnShops() \ No newline at end of file diff --git a/items_install/images/whippit/blue_uninflated_balloon.png b/items_install/images/whippit/blue_uninflated_balloon.png new file mode 100644 index 0000000..83f1587 Binary files /dev/null and b/items_install/images/whippit/blue_uninflated_balloon.png differ diff --git a/items_install/images/whippit/cracker.png b/items_install/images/whippit/cracker.png new file mode 100644 index 0000000..48182c8 Binary files /dev/null and b/items_install/images/whippit/cracker.png differ diff --git a/items_install/images/whippit/green_uninflated_balloon.png b/items_install/images/whippit/green_uninflated_balloon.png new file mode 100644 index 0000000..7e5a490 Binary files /dev/null and b/items_install/images/whippit/green_uninflated_balloon.png differ diff --git a/items_install/images/whippit/orange_uninflated_balloon.png b/items_install/images/whippit/orange_uninflated_balloon.png new file mode 100644 index 0000000..7c1b408 Binary files /dev/null and b/items_install/images/whippit/orange_uninflated_balloon.png differ diff --git a/items_install/images/whippit/purple_uninflated_balloon.png b/items_install/images/whippit/purple_uninflated_balloon.png new file mode 100644 index 0000000..244b0a1 Binary files /dev/null and b/items_install/images/whippit/purple_uninflated_balloon.png differ diff --git a/items_install/images/whippit/red_uninflated_balloon.png b/items_install/images/whippit/red_uninflated_balloon.png new file mode 100644 index 0000000..b8d4f7e Binary files /dev/null and b/items_install/images/whippit/red_uninflated_balloon.png differ diff --git a/items_install/images/whippit/whipped_cream_cannister.png b/items_install/images/whippit/whipped_cream_cannister.png new file mode 100644 index 0000000..174269f Binary files /dev/null and b/items_install/images/whippit/whipped_cream_cannister.png differ diff --git a/items_install/images/whippit/white_uninflated_balloon.png b/items_install/images/whippit/white_uninflated_balloon.png new file mode 100644 index 0000000..83f2d92 Binary files /dev/null and b/items_install/images/whippit/white_uninflated_balloon.png differ diff --git a/items_install/images/whippit/yellow_uninflated_balloon.png b/items_install/images/whippit/yellow_uninflated_balloon.png new file mode 100644 index 0000000..53a4267 Binary files /dev/null and b/items_install/images/whippit/yellow_uninflated_balloon.png differ diff --git a/items_install/item_names/ox_inventory.md b/items_install/item_names/ox_inventory.md index 4fbf55e..264f9e9 100644 --- a/items_install/item_names/ox_inventory.md +++ b/items_install/item_names/ox_inventory.md @@ -2078,4 +2078,76 @@ image = "kitty_orange4.png" }, }, + ["blue_uninflated_balloon"] = { + label = 'Blue Uninflated Balloon', + description = "", + weight = 100, + stack = true, + close = true, + client = { image = 'blue_uninflated_balloon.png' } +}, +["cracker"] = { + label = 'Cracker', + description = "", + weight = 100, + stack = true, + close = true, + client = { image = 'cracker.png' } +}, +["green_uninflated_balloon"] = { + label = 'Green Uninflated Balloon', + description = "", + weight = 100, + stack = true, + close = true, + client = { image = 'green_uninflated_balloon.png' } +}, +["orange_uninflated_balloon"] = { + label = 'Orange Uninflated Balloon', + description = "", + weight = 100, + stack = true, + close = true, + client = { image = 'orange_uninflated_balloon.png' } +}, +["purple_uninflated_balloon"] = { + label = 'Purple Uninflated Balloon', + description = "", + weight = 100, + stack = true, + close = true, + client = { image = 'purple_uninflated_balloon.png' } +}, +["red_uninflated_balloon"] = { + label = 'Red Uninflated Balloon', + description = "", + weight = 100, + stack = true, + close = true, + client = { image = 'red_uninflated_balloon.png' } +}, +["whipped_cream_cannister"] = { + label = 'Whipped Cream Cannister', + description = "", + weight = 100, + stack = true, + close = true, + client = { image = 'whipped_cream_cannister.png' } +}, +["white_uninflated_balloon"] = { + label = 'White Uninflated Balloon', + description = "", + weight = 100, + stack = true, + close = true, + client = { image = 'white_uninflated_balloon.png' } +}, +["yellow_uninflated_balloon"] = { + label = 'Yellow Uninflated Balloon', + description = "", + weight = 100, + stack = true, + close = true, + client = { image = 'yellow_uninflated_balloon.png' } +}, ``` \ No newline at end of file diff --git a/items_install/item_names/qb-inventory.md b/items_install/item_names/qb-inventory.md index a8ee625..6cd7fe3 100644 --- a/items_install/item_names/qb-inventory.md +++ b/items_install/item_names/qb-inventory.md @@ -261,4 +261,15 @@ orange_cats2 = {name = "orange_cats2", label = "orange cats", weight = 100, type = "item", image = "kitty_orange2.png", unique = false, useable = true, shouldClose = true, combinable = nil, description = ""}, orange_cats3 = {name = "orange_cats3", label = "orange cats", weight = 100, type = "item", image = "kitty_orange3.png", unique = false, useable = true, shouldClose = true, combinable = nil, description = ""}, orange_cats4 = {name = "orange_cats4", label = "orange cats", weight = 100, type = "item", image = "kitty_orange4.png", unique = false, useable = true, shouldClose = true, combinable = nil, description = ""}, + blue_uninflated_balloon = { name = 'blue_uninflated_balloon', label = 'Blue Uninflated Balloon', weight = 100, type = 'item', image = 'blue_uninflated_balloon.png', unique = false, useable = true, shouldClose = true, description = "" }, +cracker = { name = 'cracker', label = 'Cracker', weight = 100, type = 'item', image = 'cracker.png', unique = false, useable = true, shouldClose = true, description = "" }, +green_uninflated_balloon = { name = 'green_uninflated_balloon', label = 'Green Uninflated Balloon', weight = 100, type = 'item', image = 'green_uninflated_balloon.png', unique = false, useable = true, shouldClose = true, description = "" }, +orange_uninflated_balloon = { name = 'orange_uninflated_balloon', label = 'Orange Uninflated Balloon', weight = 100, type = 'item', image = 'orange_uninflated_balloon.png', unique = false, useable = true, shouldClose = true, description = "" }, +purple_uninflated_balloon = { name = 'purple_uninflated_balloon', label = 'Purple Uninflated Balloon', weight = 100, type = 'item', image = 'purple_uninflated_balloon.png', unique = false, useable = true, shouldClose = true, description = "" }, +red_uninflated_balloon = { name = 'red_uninflated_balloon', label = 'Red Uninflated Balloon', weight = 100, type = 'item', image = 'red_uninflated_balloon.png', unique = false, useable = true, shouldClose = true, description = "" }, +whipped_cream_cannister = { name = 'whipped_cream_cannister', label = 'Whipped Cream Cannister', weight = 100, type = 'item', image = 'whipped_cream_cannister.png', unique = false, useable = true, shouldClose = true, description = "" }, +white_uninflated_balloon = { name = 'white_uninflated_balloon', label = 'White Uninflated Balloon', weight = 100, type = 'item', image = 'white_uninflated_balloon.png', unique = false, useable = true, shouldClose = true, description = "" }, +yellow_uninflated_balloon = { name = 'yellow_uninflated_balloon', label = 'Yellow Uninflated Balloon', weight = 100, type = 'item', image = 'yellow_uninflated_balloon.png', unique = false, useable = true, shouldClose = true, description = "" }, + + ``` \ No newline at end of file diff --git a/locales/DJ.lua b/locales/DJ.lua index 24d24d2..b0f74d4 100644 --- a/locales/DJ.lua +++ b/locales/DJ.lua @@ -258,5 +258,10 @@ Lang.xtc = { Lang.merchant = { targetOpen = 'Open merchant menu, LET’S GOOOO!', } - +Lang.Whippit = { + targetShop = 'Open Whippit Shop, PARTY TIME!', + needBalloon = 'Need a balloon for this, HYPE!', + needCanister = 'Need a canister for this, WOO!', + shopHeader = 'Whippit Shop, LET’S GO!', +} return Lang diff --git a/locales/cs.lua b/locales/cs.lua index 5167f7f..e4bb1f7 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -259,5 +259,10 @@ Lang.xtc = { Lang.merchant = { targetOpen = 'Otevřít obchodní nabídku', } - +Lang.Whippit = { + targetShop = 'Otevřít obchod Whippit', + needBalloon = 'Potřebujete balón pro tuto akci', + needCanister = 'Potřebujete kanister pro tuto akci', + shopHeader = 'Obchod Whippit', +} return Lang \ No newline at end of file diff --git a/locales/de.lua b/locales/de.lua index 3d64977..83ab615 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -259,5 +259,10 @@ Lang.xtc = { Lang.merchant = { targetOpen = 'Händlermenü öffnen', } - +Lang.Whippit = { + targetShop = 'Whippit Shop öffnen', + needBalloon = 'Du brauchst einen Ballon für diese Aktion', + needCanister = 'Du brauchst einen Kanister für diese Aktion', + shopHeader = 'Whippit Shop', +} return Lang \ No newline at end of file diff --git a/locales/dovahzul.lua b/locales/dovahzul.lua index 9df94a0..a744b6f 100644 --- a/locales/dovahzul.lua +++ b/locales/dovahzul.lua @@ -258,5 +258,10 @@ Lang.xtc = { Lang.merchant = { targetOpen = 'Open merchant menu' } - +Lang.Whippit = { + targetShop = 'Open Whippit Shop', + needBalloon = 'You Need A Balloon For This', + needCanister = 'You Need A Canister For This', + shopHeader = 'Whippit Shop' +} return Lang diff --git a/locales/en.lua b/locales/en.lua index f333824..5fd14af 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -260,4 +260,11 @@ Lang.merchant = { targetOpen = 'Open Merchant Menu', } +Lang.Whippit = { + targetShop = 'Open Whippit Shop', + needBalloon = 'You Need A Balloon For This', + needCanister = 'You Need A Canister For This', + shopHeader = 'Whippit Shop', +} + return Lang \ No newline at end of file diff --git a/locales/es.lua b/locales/es.lua index 9340ed9..f55d8b9 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -260,4 +260,11 @@ Lang.merchant = { targetOpen = 'Abrir menú de comerciante', } +Lang.Whippit = { + targetShop = 'Abrir tienda Whippit', + needBalloon = 'Necesitas un globo para esto', + needCanister = 'Necesitas un bote para esto', + shopHeader = 'Tienda Whippit', +} + return Lang \ No newline at end of file diff --git a/locales/fr.lua b/locales/fr.lua index 5e3ef65..eda439a 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -260,4 +260,10 @@ Lang.merchant = { targetOpen = 'Ouvrir le menu du marchand', } +Lang.Whippit = { + targetShop = 'Ouvrir la boutique Whippit', + needBalloon = 'Vous avez besoin d’un ballon pour ça', + needCanister = 'Vous avez besoin d’un bidon pour ça', + shopHeader = 'Boutique Whippit', +} return Lang \ No newline at end of file diff --git a/locales/gungan.lua b/locales/gungan.lua index d192a0c..45c650c 100644 --- a/locales/gungan.lua +++ b/locales/gungan.lua @@ -260,4 +260,10 @@ Lang.merchant = { targetOpen = 'Openin da merchant menu', } +Lang.Whippit = { + targetShop = 'Open Whippit Shop', + needBalloon = 'Yousa needin a balloon for dis', + needCanister = 'Yousa needin a canister for dis', + shopHeader = 'Whippit Shop', +} return Lang diff --git a/locales/klingon.lua b/locales/klingon.lua index 6cfa809..538866d 100644 --- a/locales/klingon.lua +++ b/locales/klingon.lua @@ -259,5 +259,10 @@ Lang.xtc = { Lang.merchant = { targetOpen = 'merchant mIch poSmoH', } - +Lang.Whippit = { + targetShop = 'Whippit Shop poSmoH', + needBalloon = 'DochvamvaD balloon DaHutlh', + needCanister = 'DochvamvaD canister DaHutlh', + shopHeader = 'Whippit Shop', +} return Lang diff --git a/locales/meanieweenie.lua b/locales/meanieweenie.lua index 04e2b57..881dacb 100644 --- a/locales/meanieweenie.lua +++ b/locales/meanieweenie.lua @@ -259,5 +259,11 @@ Lang.xtc = { Lang.merchant = { targetOpen = 'Open merchant menu, asshole', } +Lang.Whippit = { + targetShop = 'Open Whippit Shop', + needBalloon = 'You need a balloon for this, dumbass', + needCanister = 'You need a canister for this, moron', + shopHeader = 'Whippit Shop', +} return Lang diff --git a/locales/nl.lua b/locales/nl.lua index f70d27a..22c11bc 100644 --- a/locales/nl.lua +++ b/locales/nl.lua @@ -260,4 +260,10 @@ Lang.merchant = { targetOpen = 'Handelaarsmenu openen', } +Lang.Whippit = { + targetShop = 'Whippit-winkel openen', + needBalloon = 'Je hebt een ballon nodig voor dit proces', + needCanister = 'Je hebt een kanister nodig voor dit proces', + shopHeader = 'Whippit-winkel', +} return Lang \ No newline at end of file diff --git a/locales/piglatin.lua b/locales/piglatin.lua index c6007b1..d1ff108 100644 --- a/locales/piglatin.lua +++ b/locales/piglatin.lua @@ -260,4 +260,10 @@ Lang.merchant = { targetOpen = 'Openyay ErchantMay EnuMay', } +Lang.Whippit = { + targetShop = 'Openyay HippitWay OpShay', + needBalloon = 'ouYay Eednay Ayay AlloonBay Orfay isThay', + needCanister = 'ouYay Eednay Ayay AnisterCay Orfay isThay', + shopHeader = 'HippitWay OpShay', +} return Lang diff --git a/locales/pirate.lua b/locales/pirate.lua index d7bb569..bc1a560 100644 --- a/locales/pirate.lua +++ b/locales/pirate.lua @@ -260,4 +260,10 @@ Lang.merchant = { targetOpen = 'Open the trader’s menu', } +Lang.Whippit = { + targetShop = 'Open Whippit Shop', + needBalloon = 'Ye need a balloon fer this, matey', + needCanister = 'Ye need a canister fer this, swabbie', + shopHeader = 'Whippit Shop', +} return Lang diff --git a/locales/pt-br.lua b/locales/pt-br.lua index a3c281e..6803183 100644 --- a/locales/pt-br.lua +++ b/locales/pt-br.lua @@ -259,5 +259,10 @@ Lang.xtc = { Lang.merchant = { targetOpen = 'Abrir menu do comerciante', } - +Lang.Whippit = { + targetShop = 'Abrir loja Whippit', + needBalloon = 'Você precisa de um balão para isso', + needCanister = 'Você precisa de um recipiente para isso', + shopHeader = 'Loja Whippit', +} return Lang \ No newline at end of file diff --git a/locales/tr.lua b/locales/tr.lua index 3551d92..2dadcf9 100644 --- a/locales/tr.lua +++ b/locales/tr.lua @@ -260,4 +260,10 @@ Lang.merchant = { targetOpen = 'Tüccar menüsünü aç', } +Lang.Whippit = { + targetShop = 'Whippit Dükkanını Aç', + needBalloon = 'Bunun için bir balona ihtiyacın var', + needCanister = 'Bunun için bir bidona ihtiyacın var', + shopHeader = 'Whippit Dükkanı', +} return Lang \ No newline at end of file diff --git a/locales/uwu.lua b/locales/uwu.lua index 1b40830..5683a0f 100644 --- a/locales/uwu.lua +++ b/locales/uwu.lua @@ -257,4 +257,11 @@ Lang.xtc = { Lang.merchant = { targetOpen = 'Open Wopen Store', } + +Lang.Whippit = { + targetShop = 'Open Whippit Shop', + needBalloon = 'You need a balloon for this, cutie! 🎈', + needCanister = 'You need a canister for this, bby! 🛢️', + shopHeader = 'Whippit Shop 🥳', +} return Lang \ No newline at end of file diff --git a/locales/wookie.lua b/locales/wookie.lua index a000653..7e90b09 100644 --- a/locales/wookie.lua +++ b/locales/wookie.lua @@ -257,4 +257,11 @@ Lang.merchant = { targetOpen = 'Rraa raw!', } +Lang.Whippit = { + targetShop = 'Rraa Whippit!', + needBalloon = 'Rraa balloon!', + needCanister = 'Rraa canister!', + shopHeader = 'Whippit Rraa!', +} + return Lang \ No newline at end of file diff --git a/readme.md b/readme.md index 3e49985..a0aca62 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,7 @@ A fully customizable, immersive drug system for FiveM servers. - **Beta Testers:** Your invaluable feedback made this possible. - **[1of1 Servers](https://1of1servers.com/ ):** Top-notch hosting and support. Join their [Discord](https://discord.gg/1of1servers ). - **[Kamaryn](https://discord.gg/KPRmZqFS ):** For the [installation guide video](https://youtu.be/zvuYnUfrqaA?si=FGJuBO5krZMC14Nd). - +- **[Athena](https://discord.gg/mam8Nmg49d):** For the Balloon props :) ## 🎬 Preview 🎥 **[Watch Full Preview Video](https://www.youtube.com/watch?v=I_x7_oz_SAU)** @@ -163,4 +163,7 @@ A fully customizable, immersive drug system for FiveM servers. ### STEP 5 - Run SQL - if you dont know how, click this image below - - [![YouTube Video](https://img.youtube.com/vi/8QpFOluK_xo/hqdefault.jpg)](https://www.youtube.com/watch?v=8QpFOluK_xo) \ No newline at end of file + - [![YouTube Video](https://img.youtube.com/vi/8QpFOluK_xo/hqdefault.jpg)](https://www.youtube.com/watch?v=8QpFOluK_xo) + +### STEP 6 + - If you want whippits, take the folder `ate_balloon` and place that folder into the standalone folder like it was another script :) (or a [props] if you got it) \ No newline at end of file diff --git a/server/paintHuff.lua b/server/paintHuff.lua deleted file mode 100644 index 089a156..0000000 --- a/server/paintHuff.lua +++ /dev/null @@ -1,58 +0,0 @@ -local paintLocs = { - stores = { - {loc = vector4(2675.91, 3499.18, 53.3, 334.3), gang = ""}, - } -} - -local itemList = { - red_paint = 50, - blue_paint = 50, - yellow_paint = 50, - green_paint = 50, - black_paint = 50, - paper_bag = 2, -} - -ps.registerCallback('md-drugs:server:GetPaintLocs', function(source) - return paintLocs -end) - -ps.registerCallback('md-drugs:server:GetPaintItems', function(source) - return itemList -end) - -RegisterNetEvent("md-drugs:server:purchasePaint", function(loc, item) - local src = source - if not ps.checkDistance(src, paintLocs.stores[loc].loc, 10) then - ps.notify(src, ps.lang('Catches.notIn'), "error") - return - end - if not itemList[item] then - ps.notify(src, ps.lang('Catches.invalidItem'), "error") - return - end - if ps.removeMoney(src, 'cash', itemList[item]) then - ps.addItem(src, item, 1) - else - ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") - end -end) - -for k, v in pairs (itemList) do - if k == "paper_bag" then goto continue end - ps.createUseable(k, function(source, item) - local src = source - if ps.hasItem(src, "paper_bag", 1) then - if ps.removeItem(src, k, 1) and ps.removeItem(src, "paper_bag", 1) then - ps.addItem(src, "painted_"..k, 1) - ps.notify(src, ps.lang('paintHuff.used', {k}), 'success') - else - ps.notify(src, ps.lang('Catches.invalidItem'), "error") - end - else - ps.notify(src, ps.lang('paintHuff.noBag'), "error") - end - -- TODO: add usage here - end) - ::continue:: -end \ No newline at end of file diff --git a/server/whippit.lua b/server/whippit.lua index 0aa2736..e180e5b 100644 --- a/server/whippit.lua +++ b/server/whippit.lua @@ -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) \ No newline at end of file diff --git a/shared/config.lua b/shared/config.lua index 47d4756..e23c0f7 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -49,6 +49,7 @@ Config.Drugs = { -- want a drug turn on? keep it true, want it turned off, mark TravellingMerchant = true, weed = true, wholesale = false, + whippit = true, xtc = true, }