Price
$100.00A script by MarKz
Price
$100.00
Buy any map and script you want and use it on your server to show off how cool it is.
Config = {}
Config.Debug = false
Config.RenderDistance = 40.0
Config.DefaultInteractionDistance = 2.0 -- If a vending does not provide a distance this will be used as the default
Config.NoFramework = false -- if set to true, ignore framework dependencies; use this parameter if no framework is used (obviously the items and actual usability are not implemented without any framework)
Config.UseOxLibMenuIfFound = false -- set to false if you don't want to use OxLib if found
Config.Blips = true -- set to false if you don't want to see blips on the minimap
Config.Target = false -- set to true if you want to use ox-target or qb-target as interaction
Config.AudiosVolumes = {
["buttonClicked"] = 0.15,
["coffeMachine"] = 0.25,
["snackDoorPickup"] = 0.04,
["snackDroppingItem"] = 0.05,
["waterPouring"] = 0.05,
["sodaBottleDropped"] = 0.05,
["snackSprings"] = 0.01,
}
Config.Translations = {
-- %s will be replaced with selected_product_price if a product is selected
["vending_menu_helper"] = "Please enter the code of a product.\n%s\n~INPUT_SELECT_WEAPON~ Switch camera\n~INPUT_CELLPHONE_SELECT~ Confirm selection\n~INPUT_CELLPHONE_CANCEL~ Exit",
["selected_product_price"] = "%s - ~g~%s$~w~ \n",
["invalid_product"] = "~r~Invalid product.~w~",
["selection_not_valid"] = "~r~The code that you entered is not valid, please enter a valid stand code.",
["not_enough_money"] = "~r~You don't have enough money to buy this product.",
["already_used"] = "~r~The vending machine is being used by another player.",
}
-- These "objects" are used by vending machines for providing human-readable names in menus, models for items, and handling payment.
-- item_name = {
-- price = number (price of the item for payment)
-- label = string (name displayed in menus, e.g., in the ox lib menu)
-- model = string (model used to populate vending machines capable of displaying items; see snack or soda for details)
-- }
-- !! "item_name" Should match the item in your inventory exactly !!
Config.Items = {
--#region coffee
coffee = { -- Used only for payment and to give the item
price = 100
},
--#endregion
--#region water
water = { -- Used only for payment and to give the item
price = 0,
ignoreGive = true
},
--#endregion
--#region snack
chips_cheese = {
label = "Chips: Big Cheese",
model = "mxc_vend_prop_item_chips1",
price = 100
},
chips_paprika = {
label = "Chips: Paprika",
model = "mxc_vend_prop_item_chips2",
price = 100
},
chips_ribs = {
label = "Chips: Sticky Ribs",
model = "mxc_vend_prop_item_chips3",
price = 100
},
chips_salt = {
label = "Chips: Salt & Sauce",
model = "mxc_vend_prop_item_chips4",
price = 100
},
chips_supersalt = {
label = "Chips: Super Salt",
model = "mxc_vend_prop_item_chips5",
price = 100
},
chips_habanero = {
label = "Chips: Habanero",
model = "mxc_vend_prop_item_chips6",
price = 100
},
chocolate_meteorite = {
label = "Candy: Meteorite",
model = "mxc_vend_prop_item_chocolate1",
price = 100
},
chocolate_captain = {
label = "Candy: Captain's Log",
model = "mxc_vend_prop_item_chocolate2",
price = 100
},
condom = {
label = "Condom: Soth Lags",
model = "mxc_vend_prop_item_preservatives",
price = 100,
zoffset = -0.02
},
candy_zebra = {
label = "Candy: Zebrabar",
model = "mxc_vend_prop_item_candybar1",
price = 100
},
candy_psqs = {
label = "Candy: P's & Q's",
model = "mxc_vend_prop_item_candybar2",
price = 100
},
medicine_laxmax = {
label = "Medicine: Lax to the Max",
model = "mxc_vend_prop_item_medical1",
price = 100
},
medicine_alcopatch = {
label = "Medicine: AlcoPatch",
model = "mxc_vend_prop_item_medical2",
price = 100
},
medicine_mollis = {
label = "Medicine: Mollis",
model = "mxc_vend_prop_item_medical3",
price = 100
},
medicine_betta = {
label = "Medicine: Betta",
model = "mxc_vend_prop_item_medical4",
price = 100
},
gum_peppermint = {
label = "Gum: Peppermint",
model = "mxc_vend_prop_item_gum1",
price = 100
},
gum_cinnamon = {
label = "Gum: Cinnamon",
model = "mxc_vend_prop_item_gum2",
price = 100
},
gum_spearmint = {
label = "Gum: Spearmint",
model = "mxc_vend_prop_item_gum3",
price = 100
},
--#endregion
--#region soda
bottle_cola = {
label = "Cola",
model = "mxc_vend_prop_item_bottle1",
price = 100
},
bottle_junk = {
label = "Junk",
model = "mxc_vend_prop_item_bottle2",
price = 100
},
bottle_orang = {
label = "Orang Tang",
model = "mxc_vend_prop_item_bottle3",
price = 100
},
bottle_tonic = {
label = "Tonic",
model = "mxc_vend_prop_item_bottle4",
price = 100
},
bottle_water = {
label = "Water",
model = "mxc_vend_prop_item_bottle5",
price = 100
},
bottle_sprunk = {
label = "Sprunk",
model = "mxc_vend_prop_item_bottle6",
price = 100
},
can_cola = {
label = "Cola Can",
model = "mxc_vend_prop_item_cansoda1",
price = 100
},
can_orang = {
label = "Orang Tang Can",
model = "mxc_vend_prop_item_cansoda2",
price = 100
},
can_junk = {
label = "Junk Can",
model = "mxc_vend_prop_item_cansoda3",
price = 100
},
can_sprunk = {
label = "Sprunk Can",
model = "mxc_vend_prop_item_cansoda4",
price = 100
},
can_logger = {
label = "Logger Can",
model = "mxc_vend_prop_item_canbeer1",
price = 100
},
can_blarneys = {
label = "Blarneys Can",
model = "mxc_vend_prop_item_canbeer2",
price = 100
},
can_hoplivion = {
label = "Hoplivion Can",
model = "mxc_vend_prop_item_canbeer3",
price = 100
},
can_cerbeza = {
label = "Cerbeza Can",
model = "mxc_vend_prop_item_canbeer4",
price = 100
},
--#endregion
--#region svapo
svapo_vaporglow1a = {
label = "Vaporglow 2",
model = "mxc_smoking_prop_vaporglow_1a",
price = 100
},
svapo_vaporglow1b = {
label = "Vaporglow 1",
model = "mxc_smoking_prop_vaporglow_1b",
price = 100
},
svapo_vaporglow1c = {
label = "Vaporglow 1",
model = "mxc_smoking_prop_vaporglow_1c",
price = 100
},
svapo_vaporglow1d = {
label = "Vaporglow 1",
model = "mxc_smoking_prop_vaporglow_1d",
price = 100
},
svapo_vaporglow1e = {
label = "Vaporglow 1",
model = "mxc_smoking_prop_vaporglow_1e",
price = 100
},
svapo_vaporglow1f = {
label = "Vaporglow 1",
model = "mxc_smoking_prop_vaporglow_1f",
price = 100
},
--
svapo_evape1a = {
label = "E-Vape 1",
model = "mxc_smoking_prop_evape_1a",
price = 100
},
svapo_evape1b = {
label = "E-Vape 1",
model = "mxc_smoking_prop_evape_1b",
price = 100
},
svapo_evape1c = {
label = "E-Vape 1",
model = "mxc_smoking_prop_evape_1c",
price = 100
},
svapo_evape1d = {
label = "E-Vape 1",
model = "mxc_smoking_prop_evape_1d",
price = 100
},
svapo_evape1e = {
label = "E-Vape 1",
model = "mxc_smoking_prop_evape_1e",
price = 100
},
svapo_evape1f = {
label = "E-Vape 1",
model = "mxc_smoking_prop_evape_1f",
price = 100
},
--
svapo_evape2a = {
label = "E-Vape 2",
model = "mxc_smoking_prop_evape_2a",
price = 100
},
svapo_evape2b = {
label = "E-Vape 2",
model = "mxc_smoking_prop_evape_2b",
price = 100
},
svapo_evape2c = {
label = "E-Vape 2",
model = "mxc_smoking_prop_evape_2c",
price = 100
},
svapo_evape2d = {
label = "E-Vape 2",
model = "mxc_smoking_prop_evape_2d",
price = 100
},
svapo_evape2e = {
label = "E-Vape 2",
model = "mxc_smoking_prop_evape_2e",
price = 100
},
svapo_evape2f = {
label = "E-Vape 2",
model = "mxc_smoking_prop_evape_2f",
price = 100
},
--
svapo_smoke1a = {
label = "Smoke 1",
model = "mxc_smoking_prop_smoke_1a",
price = 100
},
svapo_smoke1b = {
label = "Smoke 1",
model = "mxc_smoking_prop_smoke_1b",
price = 100
},
svapo_smoke1c = {
label = "Smoke 1",
model = "mxc_smoking_prop_smoke_1c",
price = 100
},
svapo_smoke1d = {
label = "Smoke 1",
model = "mxc_smoking_prop_smoke_1d",
price = 100
},
svapo_smoke1e = {
label = "Smoke 1",
model = "mxc_smoking_prop_smoke_1e",
price = 100
},
svapo_smoke1f = {
label = "Smoke 1",
model = "mxc_smoking_prop_smoke_1f",
price = 100
},
--
svapo_evape_box = {
label = "E-Vape Box",
model = "mxc_smoking_prop_evapebox",
price = 100
},
svapo_evape2_box = {
label = "E-Vape 2 Box",
model = "mxc_smoking_prop_evape2box",
price = 100
},
svapo_smoke_box = {
label = "Smoke Box",
model = "mxc_smoking_prop_smokebox",
price = 100
},
svapo_sumo_box = {
label = "Sumo Box",
model = "mxc_smoking_prop_sumobox",
price = 100
},
svapo_vaporglow_box = {
label = "Vaporglow Box",
model = "mxc_smoking_prop_vaporglowbox",
price = 100
},
--#endregion
cigs_redwood = {
label = "Cigarettes: Redwood",
model = "v_ret_ml_cigs",
price = 100
},
cigs_redwood2 = {
label = "Cigarettes: Redwood2",
model = "v_ret_ml_cigs2",
price = 100
},
cigs_debonaireb = {
label = "Cigarettes: Debonaire Blue",
model = "v_ret_ml_cigs3",
price = 100
},
cigs_debonaireg = {
label = "Cigarettes: Debonaire Green",
model = "v_ret_ml_cigs4",
price = 100
},
cigs_cardiaque = {
label = "Cigarettes: Cardiaque",
model = "v_ret_ml_cigs5",
price = 100
},
cigs_69brand = {
label = "Cigarettes: 69Brand",
model = "v_ret_ml_cigs6",
price = 100
},
cigs_cok = {
label = "Cigarettes: CoK",
model = "mxc_vend_prop_item_cigs1",
price = 100
},
cigs_estancia = {
label = "Cigars: Estancia",
model = "prop_cigar_pack_01",
price = 100
}
}
-- Here you can enter model and coordinates to spawn new vending machines around the map, the last value of the vector is the heading
Config.PlaceVendings = {
prop_vend_snak_01 = {
vec4(459.8792, -992.0368, 23.9149, 93.7301)
},
mxc_vend_prop_svapo_01 = {
vec4(-497.4405, 277.5, 82.3123, 353.80)
},
}
-- Settings for individual vending machines, if you want to disable the blip for an individual vending machine simply delete that entire section.
Config.Vendings = {
["snack"] = {
models = {`prop_vend_snak_01`},
interaction = {
vanilla = {
notify = "Press {E} to buy something from the vending machine",
distance = 0.35
},
target = {
label = "Buy something",
icon = "fa-solid fa-drumstick-bite",
distance = 3.0
}
},
blip = {
sprite = 772,
color = 0,
size = 0.5
},
-- This section is for choosing which items (from the Config.Items list) to show for each individual stand.
-- You can follow the visual tags on the in-game model to figure out where you are putting things
exhibition = {
a1 = "chips_cheese",
a2 = "chips_paprika",
a3 = "chips_ribs",
a4 = "chips_salt",
b1 = "chips_supersalt",
b2 = "chips_habanero",
b3 = "chips_cheese",
b4 = "chips_paprika",
c1 = "chocolate_meteorite",
c2 = "chocolate_captain",
c3 = "condom",
c4 = "candy_zebra",
d1 = "candy_psqs",
d2 = "gum_peppermint",
d3 = "gum_cinnamon",
d4 = "gum_spearmint",
e1 = "medicine_laxmax",
e2 = "medicine_alcopatch",
e3 = "medicine_mollis",
e4 = "medicine_betta",
},
--#region Advanced
Near = function(self, obj, dbId)
PopulateSnackVending(self, obj)
end,
Far = function(self, obj, dbId)
ClearSnackVending(self, obj)
end,
OnInteraction = function(self, obj, dbId)
local selection = nil
-- OxLib input dialog
if lib and Config.UseOxLibMenuIfFound then
selection = DisplayOxLibMenu(self)
else
selection = DisplayInteractiveMenu(self, obj)
end
if selection then
Config.Functions.TryToBuy(self, selection, dbId, function()
SelectItemSnackVending(self, obj, selection)
end)
else
Server.SetVendingUsed(dbId, false)
end
end
--#endregion
},
["soda"] = {
models = {`prop_vend_soda_01`},
interaction = {
vanilla = {
notify = "Press {E} to buy something from the vending machine",
distance = 1.0
},
target = {
label = "Buy something",
icon = "fa-solid fa-wine-bottle",
distance = 3.0
}
},
blip = {
sprite = 827,
color = 1,
size = 0.5
},
-- This section is for choosing which items (from the Config.Items list) to show for each individual stand.
-- You can follow the visual tags on the in-game model to figure out where you are putting things
exhibition = {
a1 = "bottle_cola",
a2 = "bottle_cola",
a3 = "bottle_junk",
a4 = "bottle_junk",
a5 = "bottle_tonic",
a6 = "bottle_tonic",
b1 = "bottle_orang",
b2 = "bottle_orang",
b3 = "bottle_sprunk",
b4 = "bottle_sprunk",
b5 = "bottle_water",
b6 = "bottle_water",
c1 = "can_cola",
c2 = "can_cola",
c3 = "can_orang",
c4 = "can_orang",
c5 = "can_sprunk",
c6 = "can_junk",
d1 = "can_logger",
d2 = "can_logger",
d3 = "can_blarneys",
d4 = "can_blarneys",
d5 = "can_hoplivion",
d6 = "can_cerbeza",
},
--#region Advanced
Near = function(self, obj, dbId)
PopulateSodaVending(self, obj, "mxc_vend_prop_soda_shelf")
end,
Far = function(self, obj, dbId)
ClearSodaVending(self, obj)
end,
OnInteraction = function(self, obj, dbId)
local selection = nil
-- OxLib input dialog
if lib and Config.UseOxLibMenuIfFound then
selection = DisplayOxLibMenu(self)
else
selection = DisplayInteractiveMenu(self, obj)
end
if selection then
Config.Functions.TryToBuy(self, selection, dbId, function()
SelectItemSodaVending(self, obj, selection)
end)
else
Server.SetVendingUsed(dbId, false)
end
end
--#endregion
},
["coffee"] = {
item = "coffee", -- Vending machines without exhibition can set an item to be sold here (as always from Config.Items)
models = {`prop_vend_coffe_01`},
interaction = {
vanilla = {
notify = "Press {E} to get a coffee from the vending machine",
distance = 1.1
},
target = {
label = "Get a coffee",
icon = "fa-solid fa-mug-hot",
distance = 3.0
}
},
blip = {
sprite = 89,
color = 31,
size = 0.5
},
--#region Advanced
OnInteraction = function(self, obj, dbId)
Config.Functions.TryToBuy(self, self.item, dbId, function()
StartCoffeeVending(self, obj, true)
end)
end
--#endregion
},
["water"] = {
item = "water", -- Vending machines without exhibition can set an item to be sold here (as always from Config.Items)
models = {`prop_watercooler`},
interaction = {
vanilla = {
notify = "Press {E} to get a water cup",
distance = 1.2
},
target = {
label = "Refresh your mouth",
icon = "fa-solid fa-glass-water",
distance = 3.0
}
},
blip = {
sprite = 499,
color = 3,
size = 0.5
},
--#region Advanced
OnInteraction = function(self, obj, dbId)
Config.Functions.TryToBuy(self, self.item, dbId, function()
StartWaterVending(self, obj)
end)
end
--#endregion
},
["svapo"] = {
parent = "snack", -- Vending machines can set a parent vending machine, this allows you to inherit all the other vending settings with the ability to override them
models = {`mxc_vend_prop_svapo_01`},
blip = {
sprite = 772,
color = 0,
size = 0.5
},
exhibition = {
a1 = "svapo_evape_box",
a2 = "svapo_evape2_box",
a3 = "svapo_smoke_box",
a4 = "svapo_vaporglow_box",
b1 = "svapo_smoke1a",
b2 = "svapo_smoke1b",
b3 = "svapo_smoke1c",
b4 = "svapo_smoke1d",
c1 = "svapo_evape1a",
c2 = "svapo_evape1b",
c3 = "svapo_evape1c",
c4 = "svapo_evape1d",
d1 = "svapo_vaporglow1a",
d2 = "svapo_vaporglow1b",
d3 = "svapo_vaporglow1c",
d4 = "svapo_vaporglow1d",
e1 = "svapo_sumo_box",
e2 = "svapo_sumo_box",
e3 = "svapo_sumo_box",
e4 = "svapo_sumo_box",
},
},
["cigarettes"] = {
models = {`prop_vend_fags_01`},
interaction = {
vanilla = {
notify = "Press {E} to buy a pack of cigarettes",
distance = 0.4
},
target = {
label = "Buy something",
icon = "fa-solid fa-smoking",
distance = 3.0
}
},
-- For this vending, this will only be used for the menu, it will not create any model
exhibition = {
a1 = "cigs_redwood",
a2 = "cigs_redwood2",
a3 = "cigs_estancia",
a4 = "cigs_69brand",
a5 = "cigs_debonaireb",
a6 = "cigs_debonaireg",
b1 = "cigs_cardiaque",
b2 = "cigs_cok",
},
blip = {
sprite = 205,
color = 22,
size = 0.5
},
--#region Advanced
OnInteraction = function(self, obj, dbId)
local selection = nil
-- OxLib input dialog
if lib and Config.UseOxLibMenuIfFound then
selection = DisplayOxLibMenu(self)
else
selection = DisplayInteractiveMenu(self, obj)
end
if selection then
Config.Functions.TryToBuy(self, selection, dbId, function()
SelectItemCigarettesVending(self, obj, selection)
end)
else
Server.SetVendingUsed(dbId, false)
end
end
--#endregion
},
["soda_2"] = {
parent = "soda",
models = {`prop_vend_soda_02`},
interaction = {
vanilla = {
notify = "Press {E} to buy something from the vending machine",
distance = 1.0
},
target = {
label = "Buy something",
icon = "fa-solid fa-wine-bottle",
distance = 3.0
}
},
blip = {
sprite = 827,
color = 2,
size = 0.5
},
-- This section is for choosing which items (from the Config.Items list) to show for each individual stand.
-- You can follow the visual tags on the in-game model to figure out where you are putting things
exhibition = {
a1 = "bottle_sprunk",
a2 = "bottle_sprunk",
a3 = "bottle_junk",
a4 = "bottle_junk",
a5 = "bottle_tonic",
a6 = "bottle_tonic",
b1 = "bottle_orang",
b2 = "bottle_orang",
b3 = "bottle_cola",
b4 = "bottle_cola",
b5 = "bottle_water",
b6 = "bottle_water",
c1 = "can_cola",
c2 = "can_cola",
c3 = "can_orang",
c4 = "can_orang",
c5 = "can_sprunk",
c6 = "can_junk",
d1 = "can_logger",
d2 = "can_logger",
d3 = "can_blarneys",
d4 = "can_blarneys",
d5 = "can_hoplivion",
d6 = "can_cerbeza",
},
--#region Advanced
Near = function(self, obj, dbId)
PopulateSodaVending(self, obj, "mxc_vend_prop_soda_shelf2")
end,
Far = function(self, obj, dbId)
ClearSodaVending(self, obj)
end,
OnInteraction = function(self, obj, dbId)
local selection = nil
-- OxLib input dialog
if lib and Config.UseOxLibMenuIfFound then
selection = DisplayOxLibMenu(self)
else
selection = DisplayInteractiveMenu(self, obj)
end
if selection then
Config.Functions.TryToBuy(self, selection, dbId, function()
SelectItemSodaVending(self, obj, selection)
end)
else
Server.SetVendingUsed(dbId, false)
end
end
--#endregion
},
}
Config.Functions = {
--#region Server
StartFramework = function()
if GetResourceState("es_extended") ~= "missing" then
ESX = exports["es_extended"]:getSharedObject()
elseif GetResourceState("qb-core") ~= "missing" then
QBCore = exports["qb-core"]:GetCoreObject()
end
end,
GiveItem = function(source, itemName, count)
-- https://utility-library.github.io/documentation/server/esx_integration/xplayer/AddItem/
AddItem(source, itemName, count)
end,
HaveMoney = function(source, type, amount)
if amount == 0 then return true end
-- https://utility-library.github.io/documentation/server/esx_integration/xplayer/HaveMoney/
return HaveMoney(source, type, amount)
end,
RemoveMoney = function(source, type, amount)
if amount <= 0 then return end
-- https://utility-library.github.io/documentation/server/esx_integration/xplayer/RemoveMoney/
RemoveMoney(source, type, amount)
end,
--#endregion
--#region Client
TryToBuy = function(self, selection, dbId, success)
if Server.CanBuySnackFromVending(self.name, selection) then
Server.SetVendingUsed(dbId, true)
success()
Server.SetVendingUsed(dbId, false)
if not Config.NoFramework then
Server.BuySnackFromVending(self.name, selection)
end
else
ButtonFor(Config.Translations["not_enough_money"], 2000)
Server.SetVendingUsed(dbId, false)
end
end,
PlaySound = function(name, url, volume, loop)
exports["xsound"]:PlayUrl(name, url, volume, loop)
end
--#endregion
}
by MarKz (me)
Sightings(Space Restaurant)
Smoking(Vape Store)
Blaine County Branches(Bank Branches)
South Seas Motel(Paleto Motel)
Dream View Motel(Paleto Motel)
by XenoS (MXC team)
Utility Bank
Utility Pause Menu
Utility Weapons
| Code is accessible | No |
| Subscription-based | No |
| Lines (approximately) | 1000 |
| Requirements | utility_lib |
| Support | Yes |
See what others are saying about this script.
Share your experience and help others.