that's the odd thing, it always returns falseCode:function Player:hasExhaustion(value) return self:getExhaustion(value) >= os.time() end
that's the odd thing, it always returns false
Change os.time to 0that's the odd thing, it always returns false
The accuracy of this exhaust is +/- 999ms. Consider changing os.time to os.mtime. Not sure if mtime is implemented though as standard C lua dosn't seem to have it.
And if the integer value is to big to be stored perhaps just strip away a static 50 years or so from the timestamp.
@Znote
what the difference between os.time and os.mtime ?
local storage = self:getStorageValue(value)
if storage <= 0 then
return 0
end
if storage - os.time() <= 0 then
The only time storage will be less than zero is when it's not initialized, or you set it yourself to be less than zero. Your change will work fine and is better because you won't get negative values as time goes on.This script has me confused as for how it would work. Could someone explain this to me? From looking at the script, the only time when the storage changes is when you set it yourself. Thus, how could
ever compute as true, unless you set it to <= 0 yourself?Code:local storage = self:getStorageValue(value) if storage <= 0 then return 0 end
With this change, it works fine for me:
Code:if storage - os.time() <= 0 then
However, I'm curious; is there something I'm missing that makes the original script work the same way?
Why would you do that?is possible to make this function to c++ ?
cuz I'm working on a little system that improve the loot of monsters, but I want to change the message that is sended to the player when kill some monster
exemple:
normal kill:
loot of a rat: gold coin
bonus loot kill:
loot of a rat: gold coin, Lucky Bonus: cheese
I already have onKill script, but seems that now I got it I have an idea to change the message, but I do not have compiled tfs in my computer to test, but when possible I'll test, thanks!Then use onKill.
I mean I have been out of the game for awhile, but I'm pretty sure thats still there.
Also if you were "working on a little system" then why not just ask for help learning. If you thought you would need to change the source code to send that message, then you are clearly lost my friend. This community is great for helping. The general consensus for help seems to be that no one wants to help someone who doesn't want to learn tho.
OFC it's possible in C++is possible to make this function to c++ ?
The accuracy of this exhaust is +/- 999ms. Consider changing os.time to os.mtime. Not sure if mtime is implemented though as standard C lua dosn't seem to have it.
And if the integer value is to big to be stored perhaps just strip away a static 50 years or so from the timestamp.
transform the number to a stringHello sir I replaced os.time() with os.mtime() and as you said the number gets way too so that the function stops working. What would be the best way to make the number smaller so that we can use it? Since I need to check the milliseconds.