ESX Watercoolers

Allow people to press [E] and drink water cups from a watercooler.

Requirements

⦁ es_extended
⦁ esx_basicneeds

Installation:

  • Get esx_tgo_watercoolers folder and place it inside [ESX] directory folder.
  • Open server.cfg and add start esx_tgo_watercoolers

Github download: https://github.com/Nosmakos/ESX-WATERCOOLERS
The code is very smooth and clean. You are allowed to edit it as you pleased.

TEBEX (PAID SCRIPTS)

15 Likes

Where are these watercoolers located on the map?

There are no coords for specific watercoolers. It works on all watercoolers by getting the object.

2 Likes

So similar to xnVending if you’re familiar?

How intensive is this?

I am not very familiar with this but whatever i tried to have, didnt work very well so i made mine. I will also make vending machines if you guys are interested.

What do you actually mean? You mean if it causes any issues? Because, if you do, then no it doesnt you can also check on monitor.

I think he is asking what does the resmon show this script running at since it is checking for water coolers near you every tick. I am sure if you put in a sleep instead of Citizen.Wait(0) and changed changed the sleep = 0 depending on if they are close to a water cooler it would run a lot better over all.

example would be

Citizen.CreateThread(function()
    while true do
        sleep = 1500
         for i = 1, #waterCoolers do
                local watercooler = GetClosestObjectOfType(pos.x, pos.y, pos.z, 1.0, waterCoolers[i], false, false, false)
                if watercooler ~= 0 then
                        sleep = 0
                        run drawtext - drink code in here
                end
        end
    Citizen.Wait(sleep)
end)

Just something to think about to make it run a bit better… this could cause the player to have to wait upto 1.5 sec before they see the draw text… but most of the time they are moving to the object anyway so it wouldn’t seem off at all

SpikE

2 Likes

Oh yeah you’re right, i haven’t thought of this but i will make it when i get home. Thank you. This will improve the code.

1 Like

vrp_watercoolers.zip (3.7 KB)

I made a version for vrp 0.5 with a few more options

2 Likes

Lovely!

Works well, though I think it would be cool to have an animation to go with it. However, that would have to be crafted by you and then streamed. In other words it would be too much work.

Great release!

1 Like

hello, nice skript, a question! How can I assign a cost to use the dispenser disk?

1 Like

I havent assigned a cost because there is no cost either in real life for the watercoolers. If you really want a cost, you need to create a serverCallback by getting the players current balance and removing if its true.

if they know how much copper is true, but my idea would be to implement this system to the soda machines that there would be copper

I might make vending machines today so keep tuned, there will be cost for the food / drinks.

1 Like

~Updated~

I dont think this is needed anyways, i just added a Citizen.Wait(1500) if the player is no close to an object with a simple else statement.

excelent job

1 Like

Hi,

This is such a simple, yet needed script.

Just having a few issues, I just can’t seem to get the prompt to drink to stay, it flashes for a very brief split second, if I spam E I can just about get it every now and then.

I’ve played around with the times, but no luck.

Any suggestions?

Cheers

Chezza

1 Like