[Release] xnVending (ESX/vRP/Standalone)


xnVending

This adds workable vending machines around the map for ESX, walk up to any vending machine that is configured in the config.lua and press E to purchase. Included in this release is a bonus vending machine model I made which is a weed vending machine, currently it is not placed anywhere on the map, you must do that yourself. I won’t be telling you how, it’s easy enough to google how to add custom things to the map.

Installation

Copy xnVending to your resources folder and add start xnVending to your server.cfg

Config

Edit the top section to choose your framework, ESX, ESXNew (which is to support the changes to inventories), vRP or Standalone! Just simply uncomment the one you want to use and comment the others!

If you are running the latest ESX version and you’re getting this error @xnVending/server/server.lua:23: attempt to compare nil with number then change Config.NewESX to true in the config

In the config are the animations for the vending machine (audio is part of the animation, so I wouldn’t recommend changing it) Config.DispenseDict

There is also the animations for putting the item in the users pocket, there is probably a better one somewhere Config.PocketAnims

Last thing is the config for the vending machines and the items here is an example;

[`prop_vend_soda_01`] = {			-- Machine model
	item =  {"ecola"}, 				-- Database item names
	name =  {"E-Cola"}, 			-- Friendly display names
	prop =  {`prop_ecola_can`}, 	-- Props to spawn falling in machine
	price = {1}					-- Purchase prices
},

Note: The items likely won’t exist in your database by default so it probably won’t work immediately, it’s up to you to add these items and make them usable.

It’s pretty self explanatory. No coordinates need to be added for vending machines as it uses a searching native to find the closest model of type. So this will work for any new types you have on your server without any configuration.

Dependencies

Obviously this needs ESX

Download and Source

Videos

Note: Weed effects aren’t included in this mod

22 Likes

Nice release >:smiley:


i got this error, then i try change the item in config and give the other error

That means the items don’t exist in your database. You need to add them.

so i can change the items? need to add them?

ew an esx release

Does this work with vrp?

both, read the config section of the first post specifically the database item

i use yours scripts jesus is amazing you’re a excelent programmer i can send ask in private?

I think it only works with the standalone framework

running very high at 0.40ms

Looking very good ! Will help you with optimisation when i got time :slight_smile:

guys in the title it says esx so its for esx :slight_smile:

Awesome script Smallo. Good job!

Yeah object searching natives aren’t particularly efficient. There is probably some stuff I could do to make it better. I’ll look into it.

1 Like

Thanks for the PR, saves me the trouble. Merged it. Everyone here I suggest updating for the improved performance.

Np :slight_smile:

Doesn’t work. E doesn’t show up

1 Like

I have the same problem

client.lua line 90 delete this—>> break – Not tested