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.
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
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.
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.
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.