avatar_Барклай

Webscrips для отображения ТОП 10 игроков, гильдий и ГМ-ов в MU Online

Автор Барклай, 2009 Авг. 21, 18:10

« назад - далее »

0 Пользователи и 1 гость просматривают эту тему.

Ключевые слова [SEO] mu onlineВеб-сайтыphpигрокигмгильдиитоп 10webscrips

Барклай

Function needed to each table
without it would work none of tables.
Add it to your index.php


PHP Code:
function isnickonline($nick){
$db2 = new DB_MSSQL;
$db2->query("SELECT ConnectStat FROM dbo.MEMB_STAT WHERE memb___id =(SELECT Id FROM dbo.AccountCharacter WHERE GameIDC='$nick')");
if ($db2->next_record())
if($db2->f('ConnectStat') == 1) return true;
else return false;
else return false;
}

Now The GM's ON table code. Add in index.php if you want this

PHP Code:
$db = new DB_MSSQL;
$db->query('SELECT Name FROM dbo.Character WHERE CtlCode = 8 OR CtlCode = 32');
while ($db->next_record()){
$gmnick = $db->f('Name');
if (isnickonline($gmnick)){
$gmoncontent =("$gmoncontent<tr><td>$gmnick</td></tr>");
$yra = true;  }
}
if ($yra)    $gmsonline =("<table width='167' border='0' bordercolor='#000000' cellpadding='1' cellspacing='0' style='font:Verdana, Arial, Helvetica, sans-serif; font-size:14px; color:#00FF00;'>
<tbody align='center'>
<tr><th>GM's ON:</th></tr>$gmoncontent</tbody></table>");
$smarty->assign('gmsonline',$gmsonline);

Code to show this table: Add in index.html(the place where you want see this table)

Code:
{$gmsonline}<br />
And you have you GM's ON :busted_co
Now TOP players table: Add in index.php

PHP Code:
$howmuch = 10; /* How may top players to show */
$query =("SELECT TOP $howmuch Name,Reset FROM dbo.Character ORDER BY Reset desc , cLevel desc;");
$skaic = 1;
$top5 = array();
$db = new DB_MSSQL($query);
while ($db->next_record()){
$nick = $db->f('Name');
$reset = $db->f('Reset');
if(isnickonline($nick))  $spalva =("style='color:#00FF00;'");
else $spalva =("style='color:#CCCCCC;'");
$top5content=("$top5content<tr $spalva><td>$skaic</td><td>$nick</td><td>$reset</td></tr><div>");
$skaic++;
}
$tablewithtops=("<table width='167' border='0' bordercolor='#000000' cellpadding='1' cellspacing='0' style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'>
<tbody align='center'>
<tr style='color:#CCCCCC'><th>Nr.</th><th>Nick</th><th>Reset</th></tr>$top5content</tbody></table>");
$smarty->assign('tablewithtops',$tablewithtops);

Code to show this table: Add in index.html(the place where you want see this table). P.s. Change this: Stipriausi TOP 10 to what name you want.

Code:
<font color="#CCCCCC" ><center><strong>Stipriausi TOP 10</strong></center><br /></font>
{$tablewithtops}
<br />
And you have you TOP Players :busted_co
And TOP guilds table: Add in index.php

PHP Code:
$howmuch = 10; /* How may top players to show */
$db = new DB_MSSQL;
$db->query("SELECT TOP $howmuch G_Name,G_Score FROM dbo.Guild ORDER BY G_score desc");
$i2 = 1;
$db2 = new DB_MSSQL;
while ($db->next_record())
{
$guild = $db->f('G_Name');
$gpoints= $db->f('G_Score');
$stabdis= true;
$db2->query("SELECT Name FROM dbo.GuildMember WHERE G_Name='$guild'");
while($db2->next_record() AND $stabdis){
$nick = $db2->f('Name');
if (isnickonline($nick)) {$guildon = true; $stabdis =false;} else $guildon = false;
}
if ($guildon) $spalva =("style='color:#00FF00;'"); else $spalva =("style='color:#CCCCCC;'");
$top5guildcontent =("$top5guildcontent<tr $spalva><td>$i2</td><td>$guild</td><td>$gpoints</td></tr>");
$i2++;
}
$topguildtable =("<table width='167' border='0' bordercolor='#000000' cellpadding='1' cellspacing='0' style='font:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#CCCCCC;'>
<tbody align='center'>
<tr><th>Nr.</th><th>Guild</th><th>Points</th></tr>$top5guildcontent</tbody></table>");
$smarty->assign('topguildtable',$topguildtable);

Code to show this table: Add in index.html(the place where you want see this table)

Code:
{$topguildtable}
Credits:Doker






Похожие темы (5)