antiblock
Elveron
  • Chatbox

    You don't have permission to chat.
    Load More
Sign in to follow this  
Dr.Morais

[Php]Contagem De Jogadores Por Reino

3 posts in this topic

Boas Cyber-Gamers.org .. encontrei este code que é muito bom..
Para que serve isto?
Podem inserir numa tabela do vosso website de metin2 para terem a contagem em tempo real dos jogadores online em cada reino.

Code : 

<div id="info">

<table>
<?php
include("FICHEIRO DE CONFIGURAÇÃO DA BASE DA DADOS");
mysql_connect($dbhost,$dbuser,$dbpass); // MySQL ->
mysql_select_db("player");

$rotes = "SELECT COUNT (*) as count from play_index WHERE empire NOT LIKE '2%' and ampire NOT LIKE '3%' ";
$rotes_count = mysql_fetch_object ($rotes) -> count+1;
$blaues = "SELECT COUNT (*) as count from player_index WHERE empire NOT LIKE '1%' and empire NOT LIKE '2%';";
$blaues_count = mysql_fetch_object ($blaues) -> count+1;
$gelbes = "SELECT COUNT (*) from player_index WHERE empire NOT LIKE '1%' and empire NOT LIKE '3%';";
$gelbes_count = mysql_fetch_object ($gelbes) -> count+1;
$online_count = $gelbes_count + $blaues_count + $rotes_count;

echo "<tr>";

echo "<div class='info'>";

echo "<tr><th><p>Reino Vermelho: </th><th><b style='color:#BB232B'>$rotes_count</b></th></p></tr>";

echo "</div>";

echo "<br />";

echo "<tr><th><p>Reino Azul: </th><th><b style='color:#0022FF'>$blaues_count</b></th></p></tr>";

echo "<br />";

echo "<tr><th><p>Reino Amarelo: </th><th><b style='color:#FFD500'>$blaues_count</b></th></p></tr>";

echo "<div class='acleear'>";

echo "<hr noshade width='100' size='1' align='left' color='#726E56'>";

echo "</div>";

echo "<br />";

echo "<tr><th><h1 style='color:#A0A0A0'>Total: </th><th><b style='color:#A0A0A0'>$online_count</b></th></h1></tr>";

echo "</tr>";
?>

</table>
</div>



Cada número associado à contagem tem a sua respetiva cor(exemplo: azul->azul, vermelho-> vermlho, amarelo->amarelo)

Para por o script a funcionar basta introduzirem o directório do ficheiro da configuração da vossa conecção à base de dados.

Exemplo:

include("config_server.php");


Créditos:
vBanex            

Share this post


Link to post
Share on other sites
antiblock
Elveron

Muito bom, Obrigado pela Partilha

:+1:

Share this post


Link to post
Share on other sites

Se o ficheiro faz ligação ao ficheiro de configurações á db, acho que não seria necessario isto:

mysql_connect($dbhost,$dbuser,$dbpass); // MySQL ->
mysql_select_db("player");

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this