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

TFS 1.X+ [TFS1.4.2] Znote ACC free premium

Djivar

AKA Wickedviruz
Joined
Sep 28, 2009
Messages
1,641
Reaction score
19
Location
Sweden,edsbyn
Hi!

I am having some troubles with Znote acc and free premium.

I have activated free prem in config.lua
"freePremium = true"

And when an account is created on the website, the column "premium_ends_at" is set to 0.

i have tried to look at all possible ways. but i can not findout why it is not updated. i have checked the source code for the server, init.php, register.php but i can not find out why its not added as it should.

If you have any idea, where to look or want to see any scripts just tell me and i will post them!

this is the login check from init.php:
PHP:
$tfs_10_hasPremDays = true; // https://github.com/otland/forgottenserver/pull/2813

if (user_logged_in() === true) {
    $session_user_id = getSession('user_id');
    if ($config['ServerEngine'] !== 'OTHIRE') {
        if ($config['ServerEngine'] == 'TFS_10') {
            $hasPremDays = mysql_select_single("SHOW COLUMNS from `accounts` WHERE `Field` = 'premdays'");
            if ($hasPremDays === false) {
                $tfs_10_hasPremDays = false;
                $user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premium_ends_at');
                $user_data['premdays'] = ($user_data['premium_ends_at'] - time() > 0) ? floor(($user_data['premium_ends_at'] - time()) / 86400) : 0;
            } else {
                $user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
            }
        } else {
            $user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
        }
    } else
        $user_data = user_data($session_user_id, 'id', 'password', 'email', 'premend');
    $user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown', 'flag' ,'active_email');
}

echo "Debug: Premdays calculated as " . $user_data['premdays'] . " (Premium ends at: " . date("Y-m-d H:i:s", $user_data['premium_ends_at']) . ", Current time: " . date("Y-m-d H:i:s") . ")";


config.lua:
Lua:
-- Misc.
-- NOTE: classicAttackSpeed set to true makes players constantly attack at regular
-- intervals regardless of other actions such as item (potion) use. This setting
-- may cause high CPU usage with many players and potentially affect performance!
-- NOTE: forceMonsterTypesOnLoad loads all monster types on startup to validate them.
-- You can disable it to save some memory if you don't see any errors at startup.
allowChangeOutfit = true
freePremium = true
kickIdlePlayerAfterMinutes = 15
maxMessageBuffer = 4
emoteSpells = false
classicEquipmentSlots = true
classicAttackSpeed = false
showScriptsLogInConsole = false
showOnlineStatusInCharlist = true
yellMinimumLevel = 2
yellAlwaysAllowPremium = false
forceMonsterTypesOnLoad = true
cleanProtectionZones = false
luaItemDesc = false
showPlayerLogInConsole = true
 
Last edited:
if u only want it to show u have it u can do something like

Lua:
if (user_logged_in() === true) {
    $Premdays = 999;

    $session_user_id = getSession('user_id');
    if ($config['ServerEngine'] !== 'OTHIRE') {
        $user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', $Premdays);
    } else {
        $user_data = user_data($session_user_id, 'id', 'password', 'email', $Premdays);
        $user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown', 'flag' ,'active_email');
    }
}
 
if u only want it to show u have it u can do something like

Lua:
if (user_logged_in() === true) {
    $Premdays = 999;

    $session_user_id = getSession('user_id');
    if ($config['ServerEngine'] !== 'OTHIRE') {
        $user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', $Premdays);
    } else {
        $user_data = user_data($session_user_id, 'id', 'password', 'email', $Premdays);
        $user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown', 'flag' ,'active_email');
    }
}

I need the player to actually have it i suppose.

since some things in the server you have to have premium to use
 
Back
Top