• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Script reset storage [TFS 1.2]

jackl90

Member
Joined
Jul 25, 2017
Messages
249
Reaction score
12
How can i do a script to reset a player with xxx,x storage after 24 houres?

For example: if player have 2000,2 storage, after 24 houres change to 2000,1, this is possible?
 
I find it very funny when someone asks for a way to do a particular thing in programming.
Look, are you really sure this is the only way to do what you want? It's way easier to specify what you really want to do instead of giving a bias to everyone that will think see and think about your problem.

A clever way would be to do like this:

player:setStorageValue(2000, os.time() + (24 * 60 * 60))

and checking this:

if player:getStorageValue(2000) <= os.time() then


just for the record: I'm saving the current timestamp in seconds (a integer) plus (24 * 3600), which is 24 hours in seconds.
After that I'm checking if the number I've stored is lower to the current timestamp in seconds generated in the moment you execute the check.
 
I find it very funny when someone asks for a way to do a particular thing in programming.
Look, are you really sure this is the only way to do what you want? It's way easier to specify what you really want to do instead of giving a bias to everyone that will think see and think about your problem.
I agree with this.
If you are asking or requesting for help, you basically want to say;

This is what I want to happen..
This is what I've tried.. however I'm getting these results.
What am I doing wrong?
---
I don't really have anything new to contribute to the thread though.
I'd probably do it the same as above.

Cheers.
 
Back
Top