BrownDeveloper
Member
- 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:
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:
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)
Thanks in advance if someone can guide me to solve this issue.
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.