• 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!

Znote TFS 1.4 premium_ends_at

Watchdog87

Member
Joined
Mar 2, 2014
Messages
30
Solutions
1
Reaction score
5
Hello! I'm using this GitHub - Znote/ZnoteAAC at v2 (https://github.com/Znote/ZnoteAAC/tree/v2)

I can't figure out how to add premium days in phpMyAdmin under "premium_ends_at". There's no "premdays" row and I have tried to add different values to "premium_ends_at" but there's no result. I'm thinking there's like a date or something? I tried adding different dates, but still nothing. Thanks!
 
Solution
premium_ends_at stores the date when premium ends at, in unix_timestamp numeric format.

To get the value that represents "right now", you can use any of these functions:

In SQL queries, UNIX_TIMESTAMP()
SQL:
SELECT
	CONCAT('Current unix_timestamp is: ', UNIX_TIMESTAMP())

In Lua, os.time():
Lua:
print("Current unix_timestamp is: ".. os.time())

In PHP, time():
PHP:
echo "Current unix_timestamp is: " . time();

You can add seconds to this, or remove seconds from it to calculate time backwards and forwards.
Etc 7 days = 604800 seconds, so if you set premium_ends_at at current timestamp + 604800, they will have a week of premium.

This SQL query will set all accounts to have 1 week of premium:
SQL:
UPDATE...
Its unix time - number of seconds since january 01 1970.
Current time is 1637861006
Add 86400 to this number for each day of pacc u want.
 
premium_ends_at stores the date when premium ends at, in unix_timestamp numeric format.

To get the value that represents "right now", you can use any of these functions:

In SQL queries, UNIX_TIMESTAMP()
SQL:
SELECT
	CONCAT('Current unix_timestamp is: ', UNIX_TIMESTAMP())

In Lua, os.time():
Lua:
print("Current unix_timestamp is: ".. os.time())

In PHP, time():
PHP:
echo "Current unix_timestamp is: " . time();

You can add seconds to this, or remove seconds from it to calculate time backwards and forwards.
Etc 7 days = 604800 seconds, so if you set premium_ends_at at current timestamp + 604800, they will have a week of premium.

This SQL query will set all accounts to have 1 week of premium:
SQL:
UPDATE `accounts`
	SET `premium_ends_at` = UNIX_TIMESTAMP() + 604800

This SQL query will give 1 week of premium to everybody, if they already have premium, their premium will be extended by 1 week:
SQL:
UPDATE `accounts`
	SET `premium_ends_at` = CASE WHEN `premium_ends_at` > UNIX_TIMESTAMP()
    	THEN `premium_ends_at` + 604800
        ELSE UNIX_TIMESTAMP() + 604800
    END
 
Solution
Back
Top