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

TFS 1.X+ Gesior Acc 1.x show wrong players online number

Joined
Jun 25, 2018
Messages
40
Reaction score
8
Hello everyone in Otland, I'm having the following problem: the number of players displayed on the website is incorrect. Initially, it's at zero. When a player logs in, it increases to 1. The same player logs out and logs back in, and the number increases to 2. When the player logs out, he logs back in and increases to 3 and so on.

I've checked everything that causes that and I have this script in CreatureScripts called Login.lua
This is SLQ Command that insert the playerID into Players_online mysql table:
LUA:
db.query('INSERT INTO `players_online` (`player_id`) VALUES (' .. playerIds .. ')')

Note: the mysql table structure is only a Column with name players_online, But i cant see other CreatureScript event that DETELE FROM * the value of player when log-out in these table.

And this is part of Layout lines that check and show the players online from player_online table:
PHP:
<?php
        
                                    if ( ! session_id() ) @ session_start();
        
                                    $last = null;
                                    if (!isset($_SESSION)) {
                                        $_SESSION = [];
                                    }
        
                                    if (isset($_SESSION['server_status_last_check'])) {
                                        $last = $_SESSION['server_status_last_check'];
                                    }
                                    if ($last == null || time() > $last + 30) {
                                        $_SESSION['server_status_last_check'] = time();
                                        $_SESSION['server_status'] = $config['status']['serverStatus_online'];
                                    }
                                    
                                    $infobar = Website::getWebsiteConfig()->getValue('info_bar_active');
        
                                    if($_SESSION['server_status'] == 1){
                                        $qtd_players_online = $SQL->query("SELECT count(*) as total from `players_online`")->fetch();
                                        if($qtd_players_online["total"] == "1"){
                                            $players_online = ($infobar ? $qtd_players_online["total"].' Player Online' : $qtd_players_online["total"].'<br/>Player Online');
                                        }else{
                                            $players_online = ($infobar ? $qtd_players_online["total"].' Players Online' : $qtd_players_online["total"].'<br/>Players Online');
                                        }
                                    }
                                    else{
                                        $players_online = ($infobar ? 'Server ONLINE' : 'Server<br/>ONLINE');
                                    }
                                    ?>
                                    <?php if(Website::getWebsiteConfig()->getValue('info_bar_active')){?>


Im using Gesior AAC TFS 1.x for the web and sources TFS 1.3 downgrade 8.60.

Extra note idk if is relevant but: im using this config.lua because my server is online right now while making test (7171 and 7172 already used by my oficial ot)
LUA:
loginProtocolPort = 7174
gameProtocolPort = 7175
statusProtocolPort = 7174


Thanks in advance if someone can guide me to solve this issue.
 
PHP:
<?php
    if (!session_id()) @session_start();

    $last = null;
    if (!isset($_SESSION)) {
        $_SESSION = [];
    }

    if (isset($_SESSION['server_status_last_check'])) {
        $last = $_SESSION['server_status_last_check'];
    }
    if ($last == null || time() > $last + 30) {
        $_SESSION['server_status_last_check'] = time();
        $_SESSION['server_status'] = $config['status']['serverStatus_online'];
    }
    
    $infobar = Website::getWebsiteConfig()->getValue('info_bar_active');

    if($_SESSION['server_status'] == 1){
        $qtd_players_online = $SQL->query("SELECT count(*) as total from `players_online`")->fetch();
        if($qtd_players_online["total"] == "1"){
            $players_online = ($infobar ? $qtd_players_online["total"].' Player Online' : $qtd_players_online["total"].'<br/>Player Online');
        }else{
            $players_online = ($infobar ? $qtd_players_online["total"].' Players Online' : $qtd_players_online["total"].'<br/>Players Online');
        }
    }
    else{
        $players_online = ($infobar ? 'Server ONLINE' : 'Server<br/>ONLINE');
    }
?>
<?php if(Website::getWebsiteConfig()->getValue('info_bar_active')){?>
    <!-- Content for when info bar is active would go here -->
<?php } ?>
Post automatically merged:

LUA:
loginProtocolPort = 7171
gameProtocolPort = 7172
statusProtocolPort = 7171
 
PHP:
<?php
    if (!session_id()) @session_start();

    $last = null;
    if (!isset($_SESSION)) {
        $_SESSION = [];
    }

    if (isset($_SESSION['server_status_last_check'])) {
        $last = $_SESSION['server_status_last_check'];
    }
    if ($last == null || time() > $last + 30) {
        $_SESSION['server_status_last_check'] = time();
        $_SESSION['server_status'] = $config['status']['serverStatus_online'];
    }
   
    $infobar = Website::getWebsiteConfig()->getValue('info_bar_active');

    if($_SESSION['server_status'] == 1){
        $qtd_players_online = $SQL->query("SELECT count(*) as total from `players_online`")->fetch();
        if($qtd_players_online["total"] == "1"){
            $players_online = ($infobar ? $qtd_players_online["total"].' Player Online' : $qtd_players_online["total"].'<br/>Player Online');
        }else{
            $players_online = ($infobar ? $qtd_players_online["total"].' Players Online' : $qtd_players_online["total"].'<br/>Players Online');
        }
    }
    else{
        $players_online = ($infobar ? 'Server ONLINE' : 'Server<br/>ONLINE');
    }
?>
<?php if(Website::getWebsiteConfig()->getValue('info_bar_active')){?>
    <!-- Content for when info bar is active would go here -->
<?php } ?>
Post automatically merged:

LUA:
loginProtocolPort = 7171
gameProtocolPort = 7172
statusProtocolPort = 7171
Yes there have content below.
 
I've checked everything that causes that and I have this script in CreatureScripts called Login.lua
TFS since 1.0 has code to insert/delete player GUID in C++:
and database structure of table players_online has player_id as primary key, so player GUID cannot be added twice to that table:

Check, if you have same code in C++. Maybe login.lua duplicates this code and adds player ID, not GUID, so it's new ID with each relog.
Remove that SQL query from login.lua and check, if it still works.
 
Hello friend, how i can do that? my server want to be 8.60, this tfs 1.6 allow 8.60 version with all news features?
Post automatically merged:

TFS since 1.0 has code to insert/delete player GUID in C++:
and database structure of table players_online has player_id as primary key, so player GUID cannot be added twice to that table:

Check, if you have same code in C++. Maybe login.lua duplicates this code and adds player ID, not GUID, so it's new ID with each relog.
Remove that SQL query from login.lua and check, if it still works.
Hello my friend, i have check only login.lua and they insert sql player_id value that i post but in table Players_online has values like e.x 123456, then logout and nothing removes the value, login again and the value is e.x 123457 . This not insert the real value of Player ID e.x player id GOD is 6 but they insert others values cuz script login.lua has others lines that modified the player id with others storages.

I already remove this part of code that insert the value but then the Web show 0 online players :'v
 
Last edited:
Hello friend, how i can do that? my server want to be 8.60, this tfs 1.6 allow 8.60 version with all news features?
Post automatically merged:


Hello my friend, i have check only login.lua and they insert sql player_id value that i post but in table Players_online has values like e.x 123456, then logout and nothing removes the value, login again and the value is e.x 123457 . This not insert the real value of Player ID e.x player id GOD is 6 but they insert others values cuz script login.lua has others lines that modified the player id with others storages.

I already remove this part of code that insert the value but then the Web show 0 online players :'v
then add it in player destructor lol

ps: it is originally added in onRemoveCreature in player.cpp
 
???
is this topic about my acc or gesior?
Hello friend, how i can do that? my server want to be 8.60, this tfs 1.6 allow 8.60 version with all news features?
Post automatically merged:


Hello my friend, i have check only login.lua and they insert sql player_id value that i post but in table Players_online has values like e.x 123456, then logout and nothing removes the value, login again and the value is e.x 123457 . This not insert the real value of Player ID e.x player id GOD is 6 but they insert others values cuz script login.lua has others lines that modified the player id with others storages.

I already remove this part of code that insert the value but then the Web show 0 online players :'v
 
???
is this topic about my acc or gesior?

its a tfs functionality not gesior or myaac, AAC's mission in this is showing data of players by GUID from players_online database SQL table, so the problem is the manager of players_online (which is TFS originally) handled by iologindata called by onRemoveCreature using updateOnlineStatus as a toggle if existed remove if not add.
 
???
is this topic about my acc or gesior?

OMG looks amazing!

but have tutorial for compile on Debian 12? my dedic was purchased by 1 year paid service but not windows
Post automatically merged:

then add it in player destructor lol

ps: it is originally added in onRemoveCreature in player.cpp
OMG looks amazing!

but have tutorial for compile on Debian 12? my dedic was purchased by 1 year paid service but not windows

sorry double reply before reply was wrong user.
 
Back
Top