• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

how do time storages in tfs 1.0?

pitis91

Member
Joined
Dec 24, 2009
Messages
136
Reaction score
13
setPlayerStorageValue(cid, 100, os.time() + 10 * 60 *1000) this doesn't work...
 
local storageNr = 12345 -- do not use 100, best use between 30100 and 65534
local neuTime = os.time() + 10*60*100
Player(cid):setStorageValue(storageNr, neuTime)
 
when i make it it give the storage, but. never go less...
why?

local storageNr = 12345

local neuTime = os.time() + 24*60*60
Player(cid):setStorageValue(storageNr, neuTime)

on navicat i go to table and says
player_storage
player_id 4 key 12345 / value 1392816630
 
What is the problem?
By using os.time() + extra time you set the current time + de extra time as storagevalue like andypsylon posted.
Then when you check for the storagevalue, compare it with os.time(), when the extra time is over, os.time() will be higher than the storagevalue, this way you can set time based storage.

You can also use the default exhaustion functions from other servers (it works the same way).
http://pastebin.com/dQR8fNwX

Code:
exhaustion.check(cid, storage) -- example: if exhaustion.check(cid, storage) then
exhaustion.get(cid, storage) -- gets the time that is left
exhaustion.set(cid, storage, time) -- time in seconds
 

Similar threads

Back
Top