View Single Post
nosoop
Veteran Member
Join Date: Aug 2014
Old 02-24-2017 , 08:19   Re: [Any] Daily Rewards
Reply With Quote #3

Add a column last_day_claimed.

When the reward is claimed, set the account's last reward claim day to TO_DAYS(NOW());, then you can check that the daily reward for the day hasn't been claimed by selecting from the table WHERE last_day_claimed >= TO_DAYS(NOW()); (you'll get zero rows if the reward hasn't been claimed).

Daily rollover dependent on your MySQL instance, I think.

For SQLite, I think you can use cast(julianday('now') as int) instead.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 02-24-2017 at 08:32.
nosoop is offline