Ir para conteúdo

[Encerrado] Contagem Errada de Players - Modern AAC


PokemonFS

Posts Recomendados

Olá pessoal estou com problema na contagem de players no meu site vou dar um exemplo com imagens.
Está mostrando que tem 73 player online mas na verdade só tem 1, então a cada 1 player online está contando como se tivesse contando 73 players
 

erro.png

Link para o comentário
Compartilhar em outros sites



 

<?php
// A class contributed from the VAPus PHP project
$serverOnline = array();
$serverPlayers = array();
$serverUptime = array();
$serverMax = array();
$serverPeak = array();
$serverMotd = array();
$serverClient = array();
$serverNPCs = array();
$serverMonsters = array();

class OTConnect {
    var $errno = 0;
    var $errstr = '';
    var $data = '';
    var $xml = NULL;
    function connect($address, $port) {
        $this->sock = @fsockopen($address, $port, $this->errno, $this->errstr, 1);
    
        if($this->sock) {
            fwrite($this->sock, chr(6).chr(0).chr(255).chr(255).'info');
         while (!feof($this->sock))
            $this->data .= fgets($this->sock, 1024);
         fclose($this->sock);
            $this->xml = simplexml_load_string($this->data);
        }
    }
    function getUptime() {
        return (int)$this->xml->serverinfo->attributes()->uptime;    
    }
    function getClientVersion() {
        return (float)str_replace('x', '', $this->xml->serverinfo->attributes()->client);    
    }
    function getPlayers() {
        return @(int)$this->xml->players->attributes()->online;    
    }
    function getMotd() {
        return $this->xml->motd;
    }
    function getPeak() {
        return (int)$this->xml->players->attributes()->peak;    
    }
    function getMax() {
        return (int)$this->xml->players->attributes()->max;    
    }
    function getServer() {
        return $this->xml->serverinfo->attributes()->server;    
    }
    function getServerVersion() {
        return $this->xml->serverinfo->attributes()->version;    
    }
    function getMonsters() {
        return (int)$this->xml->monsters->attributes()->total;    
    }
    function getNPCs() {
        return (int)@$this->xml->npcs->attributes()->uptime;    
    }
    function getMapHeight() {
        return (int)$this->xml->map->attributes()->height;    
    }
    function getMapWidth() {
        return (int)$this->xml->map->attributes()->width;    
    }
    function getMapName() {
        return $this->xml->map->attributes()->name;    
    }
    function getMapAuthor() {
        return $this->xml->map->attributes()->author;    
    }
    function getName() {
        return $this->xml->serverinfo->attributes()->name;
    }
    function getLocation() {
        return $this->xml->serverinfo->attributes()->location;
    }
    function getURL() {
        return $this->xml->serverinfo->attributes()->url;
    }
    function getOwner() {
        return $this->xml->owner->attributes()->owner;
    }
}
$xml = array();
require_once('config.php');
global $config;
if(@filemtime(FCPATH.'/cache/status') < time() - $config['statusTimeout']) {
    foreach($config['servers'] as $worldID=>$server) {
        // Make a connection in order to see if it's on
        $serv = new OTConnect();
        $serv->connect($server['address'], $server['port']);
        $xml[$worldID] = $serv->data;
    }
    file_put_contents(FCPATH.'/cache/status', json_encode($xml));
} else {

    $xml = json_decode(file_get_contents(FCPATH.'/cache/status'), true);    
}
$serv = new OTConnect();
foreach($xml as $worldID=>$code) {    
    if($code) {
        $serv->xml = simplexml_load_string($code);
        $serverPlayers[$worldID] = $serv->getPlayers();
        $serverUptime[$worldID] = uptimeParse($serv->getUptime());
        $serverMax[$worldID] = $serv->getMax();
        $serverPeak[$worldID] = $serv->getPeak();
        $serverMotd[$worldID] = $serv->getMotd();
        $serverClient[$worldID] = $serv->getClientVersion();
        $serverNPCs[$worldID] = $serv->getNPCs();
        $serverMonsters[$worldID] = $serv->getMonsters();
        $serverOnline[$worldID] = true;
    } else {
        $serverOnline[$worldID] = false;
        $serverPlayers[$worldID] = 0;
        $serverUptime[$worldID] = 0;
        $serverMax[$worldID] = 0;
        $serverPeak[$worldID] = 0;
        $serverMotd[$worldID] = 0;
        $serverClient[$worldID] = 0;
        $serverNPCs[$worldID] = 0;
        $serverMonsters[$worldID] = 0;
    }
}
?>

Link para o comentário
Compartilhar em outros sites

  • Diretor

Analisei o teu servidor... Vai em index.tpl e troque:

{if $serverOnline[0]}

Por:

{if $serverOnline[$id]}

e procure por:

Jogadores: {$serverPlayers[0]}/</font><font color="green">1000</font> </b><br />

E troque por:

Jogadores: {$serverPlayers[$id]}/{$serverMax[$id]}</font></b><br />

Troca esse também: 

Jogadores online {$serverPlayers[0]}

Por:

Jogadores online {$serverPlayers[$id]}

Após ter feito isso, vai na pasta htdocs/cache/ e exclui o arquivo status.

 

Bom creio que talvez não resolva, mas o que custa tentar né... Vê se o IP no seu config.php está certinho

Editado por nedroesdoksdja
Link para o comentário
Compartilhar em outros sites

@Yan Liima

Vou te postar meu index.tpl aqui :

 

 

 


 

<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<meta http-equiv="Content-Language" content="pt-br">
<title>Pokemon FS </title>
<meta name="robots" content="index,follow">
<meta http-equiv="CONTENT-LANGUAGE" content="pt,ptb,pt-br">
<meta name="title" content="Pokemon FS ">
<meta name="domain" content="pokemonfs.com">
<meta name="url" content="pokemonfs.com">
<meta name="keywords" content="Pokemon Online, Pokemon, Tibia Pokemon, Jogue Pokemon, Pokemon Online, Tibia Pokemon, Jogue Pokemon, Jogar Pokemon Online">
<meta name="description" content="O maior e melhor servidor de Tibia Pokemon do Brasil, um MMORPG que Mistura Tibia com Pokemon uma aventura incrivel">
<meta name="autor" content="PokemonFS">
<meta name="company" content="pokemonfs">
<meta name="revisit-after" content="5">
<script type="text/javascript">
</script>
{$head}        
<link rel="stylesheet" href="{$path}/templates/pokemon/system/style.css" type="text/css" />
<link type="text/css" href="{$path}/htdocs/public/css/system.css" rel="stylesheet" /><link type="text/css" href="{$path}/htdocs/public/css/smoothness/jquery-ui-1.7.2.custom.css" rel="stylesheet" /><script type="text/javascript" src="{$path}/htdocs/public/js/jquery-1.4.2.min.js"></script><script type="text/javascript" src="{$path}/htdocs/public/js/jquery.ui.datetimepicker.js"></script><script type="text/javascript" src="{$path}/htdocs/public/js/system.js"></script><script type="text/javascript" src="{$path}/htdocs/public/js/jquery-ui-1.8.custom.min.js"></script><link rel="stylesheet" href="{$path}/htdocs/public/css/tipsy.css" type="text/css" /><script type="text/javascript" src="{$path}/htdocs/public/js/jquery.tipsy.js"></script><link rel="stylesheet" type="text/css" href="{$path}/htdocs/public/css/tooltip.css" /> <script type="text/javascript" src="{$path}/htdocs/public/js/tooltip.js"></script>


<link rel="shortcut icon" href="{$path}/templates/pokemon/icone.ico">        

<script type="text/javascript" src="{$path}/templates/pokemon/system/js.js"></script>
        
<script type="text/javascript">
        var url = 0; var url = "http://www.pokemonfs.com";
    </script>
<script>
!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){
js=d.createElement(s);
js.id=id;js.src="//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);}
}
(document,"script","twitter-wjs");
</script> 
<body>
<div class="page">
<div class="mainbody">
<a href="{$path}"><div class="header"><div class="dex" style="background-image:url('{$path}/templates/pokemon/images/dex/darkrai.gif')"></div></div></a>
<div class="navbar">
<a href="{$path}"><div class="navbar_link">| Principal | </div></a>
<a href="{$path}/index.php/account/create"><div class="navbar_link">| Criar conta | </div></a>
<a href="{$path}/index.php/p/v/gallery"><div class="navbar_link">| Mapa | </div></a>
<a href="/index.php/p/v/downloads"><div class="navbar_link">| Download Cliente 1.0 |</div></a>
<a href="{$path}/index.php/highscores"><div class="navbar_link">| Ranking | </div></a>
<a href="{$path}/index.php/houses/main"><div class="navbar_link">| Houses | </div></a>
<a href="{$path}/index.php/character/online"><div class="navbar_link">|    Jogadores online {$serverPlayers[0]}   |</div></a>
</div> 
<div class="slider">
<div class="slider_bg">
<center>
<link rel="stylesheet" href="{$path}/templates/pokemon/system/slider/orbit.css">
<!--[if IE]>
<style type="text/css">
.timer { 
display: none !important; 
}
div.caption {
    background:transparent;
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000);
    zoom: 1; 
}
</style>
        <![endif]-->
 
<script src="{$path}/templates/pokemon/system/slider/jquery.min.js" type="text/javascript"></script>
<script src="{$path}/templates/pokemon/system/slider/jquery.orbit.min.js" type="text/javascript"></script>
</head>
<body>
<div id="featured">
<img src="{$path}/templates/pokemon/system/slider/pics/jpg/1.jpg" alt="pokemonfs"/>
<img src="{$path}/templates/pokemon/system/slider/pics/jpg/2.jpg" alt="pokemonfs"/>
<img src="{$path}/templates/pokemon/system/slider/pics/jpg/3.jpg" alt="pokemonfs"/>
<img src="{$path}/templates/pokemon/system/slider/pics/jpg/4.jpg" alt="pokemonfs"/>
<img src="{$path}/templates/pokemon/system/slider/pics/jpg/5.jpg" alt="pokemonfs"/>
<img src="{$path}/templates/pokemon/system/slider/pics/jpg/6.jpg" alt="pokemonfs"/>
<img src="{$path}/templates/pokemon/system/slider/pics/jpg/7.jpg" alt="pokemonfs"/>
<img src="{$path}/templates/pokemon/system/slider/pics/jpg/8.jpg" alt="pokemonfs"/>
<img src="{$path}/templates/pokemon/system/slider/pics/jpg/9.jpg" alt="pokemonfs"/>
</div>
 
<script type="text/javascript">
     $(window).load(function() {
         $("#featured").orbit();
     });
</script>
<!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
<script>
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = 'https://connect.facebook.net/pt_BR/sdk/xfbml.customerchat.js';
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<!-- Your customer chat code -->
<div class="fb-customerchat"
  attribution=setup_tool
  page_id="348518902271231"
  theme_color="#ffc300">
</div>
</center>
</div>
<div class="navbox_right">
<a href="https://www.facebook.com/pokefs/" target="_blank"><div class="twt_button"></div></a>
<a target="_blank" href="https://www.facebook.com/pokefs/"><div class="fb_button"></div></a>
<div class="acc_box">
<div class="box_cont">
<div class="pOnline" align="center">
<font style="background-color: #3399FF;" color="#3399FF">**</font>
<font color="#00FF00">{$serverPlayers[0]}</font>
</center></div><a href="/index.php/account/create"><div class="accbox_button">Criar Conta</div></a><a href="/index.php/p/v/downloads"><div class="accbox_button_"> Download Cliente 1.0</div></a>
</div>
</div>
</div>
<div class="newscont">
    {$main}
    {$admin}
<div class="addthis_toolbox addthis_32x32_style addthis_default_style">
<a class="addthis_button_favorites"></a>
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_orkut"></a>
<a class="addthis_button_live"></a>
</div>
<div id="twitter_div">
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = 'https://connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v3.2';
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<h1 class="sidebar-title">Novidades PokemonFS : facebook.com/pokefs</h2>
<center><div class="fb-like-box" data-href="https://www.facebook.com/Pokefs/" data-width="690" data-height="690" data-show_border="false" data-show-faces="false" data-stream="true" data-header="true"></div></div>
<script type="text/javascript" src="templates/s7.addthis.com/js/250/addthis_widget.js#username=ratoextreme"></script>
</center>
<div class="copyrights">
PokemonFS BRASIL Site 2019
<br/><small> 1995-2019 Nintendo/Creatures Inc./GAME FREAK inc. Pokemon and Pokemon character names are trademarks of Nintendo.</small>
<br>
</div>
</div>
<div class="menu_nav">
<div id="community_button"></div>
<div class="nav_links"><a href="/index.php/account/create">+Criar Conta</a></br><a href="/index.php/account/lost">+Recuperar Conta</a>
</br><a href="/index.php/p/v/downloads">Download Cliente</a>
</br><a href="{$path}/index.php/p/v/gallery">Mapa FS</a>
</br><a href="/index.php/highscores">Ranking</a>
</br><a href="/index.php/video/main">Videos</a>
</br><a href="{$path}/index.php/character/online">Jogadores Online</a>
</br><a href="{$path}/index.php/p/v/deaths">Ultimas Mortes</a>
</br><a href="/index.php/character/view">Personagens</a>
</br><a href="/index.php/p/v/gifts">+VIP Shop</a>
</br><a href="/index.php/p/v/pagseguro">+Fazer Doacao</a>
</div>
<div id="navigation_button"></div>
<div class="nav_links">
{if $logged == 1}<a href="/index.php/admin">Administration</a>
<br/><a href="/index.php/account">Gerenciar Account</a>
<br/><a href="/index.php/character/create_character">Criar Personagem</a>
<br/><a href="/index.php/account/logout">Logout</a>
{/if}
{if $logged == 0}
<form action="{$path}/index.php/account/login.ide" method="post">
<center><input onFocus="javascript:this.value=''" type="text" class="input" name="name" value="account" onclick="clickclear(this, 'name')" onblur="clickrecall(this,'name')" />
<input onFocus="javascript:this.value=''" type="password" class="input" name="pass" value="password" onclick="clickclear(this, 'pass')" onblur="clickrecall(this,'pass')" /></center>       
<center><input type="Submit" class="loginbutton" name="Submit" value=""/></center>
</form>
{/if}
</div>
<div id="s1_h"></div>
<div class="nav_links">
{if $serverOnline[0]}
    <font color="green">Emerald Players: Online<br />
    Jogadores: {$serverPlayers[0]}/</font><font color="green">1000</font> </b><br />



    {else}
    {/if}
</div>
</font>
</body>


<script>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: "pt",
    floatPosition: google.translate.TranslateElement.FloatPosition.TOP_RIGHT
  });
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

 

 

 

Bom eu tentei colocar deu esse erro

 

errror.png

Editado por PokemonFS
Link para o comentário
Compartilhar em outros sites

  • Diretor

Bom, esquece a modificação que eu disse. Seu index ta configurado para ler [0]...

 

Tente apenas apagando o arquivo status da pasta cache. Ta bem dificil saber o que poderia ser

Editado por nedroesdoksdja
Link para o comentário
Compartilhar em outros sites

  • 1 month later...
A questão neste suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...