[Release] Total Online Time Fixed

f0und

Active Member
Joined
Aug 18, 2009
Messages
269
Reaction score
119
Ето как да си направим Най Много време онлайн

Влизате в query analyzer Добавяте тези 2 кода в MuOnline
Code:
[B]alter table Character add TotalTime int not null default 0  
alter table MEMB_STAT add TotalTime int not null default 0[/B]

След това влизате в MuOnline Процедурите търсите WZ_DISCONNECT_MEMB и замествате с тази процедура

Code:
[B]CREATE PROCEDURE WZ_DISCONNECT_MEMB
@memb___id varchar(10)
 AS
Begin    
set nocount on
    Declare  @find_id varchar(10)    
   Declare  @con_tm DATETIME
    Declare @ConnectStat tinyint
    Set @ConnectStat = 0     
    Set @find_id = 'NOT'
    select @find_id = S.memb___id, @con_tm = S.ConnectTM from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id COLLATE DATABASE_DEFAULT
           where I.memb___id = @memb___id
    if( @find_id <> 'NOT' )    
    begin        
        update MEMB_STAT set ConnectStat = @ConnectStat, DisConnectTM = getdate(), TotalTime = TotalTime+(DATEDIFF(mi,ConnectTM,getdate()))
         where memb___id = @memb___id
            -- TIMEONLINE MOD by john_d
         update character set TotalTime = TotalTime+(DATEDIFF(mi,@con_tm,getdate())) 
         from character as c INNER join AccountCharacter as ac ON 
         c.Name = ac.GameIDC where c.accountid = @memb___id
    end
end


GO[/B]

И Вече имате Най много олнйан класация :)

А ето ви и класация.
PHP:
<?

$top_rank=addslashes(stripslashes(htmlspecialchars(secure($_POST['100'], ENT_NOQUOTES))));
$top_rank=clean_var(addslashes(stripslashes(htmlspecialchars(secure(100), ENT_NOQUOTES))));

if (empty($top_rank)) { echo "<table class='mss2' width='450' border='1' cellpadding='0' cellspacing='0' align='center'><tr><td class='left'>Please Select Rank!</td></tr><br />"; $error=1; }

if($error !=1) {

$select = "Select Top 25 memb___id,TotalTime,ConnectStat From MEMB_STAT Order By TotalTime desc";
$result = mssql_query($select);

echo '<br /><table class="mss2" width="450" border="1" cellpadding="0" cellspacing="0" align="center"><thead><tr><td><b><center>:: Top <font color="#d2288c">25</font> Total Online Time ::</center></b>
</td></tr></thead></table><br />
<table class="mss2" width="450" border="1" cellpadding="3" cellspacing="4" align="center">
<thead>               
<tr>
<td align="center"><span class="rankings_text">#</span></td>
<td align="center"><span class="rankings_text">Name</span></td>
<td align="center"><span class="rankings_text_reset">Total Online Time</span></td>
<td align="center">Status</td>
</tr></thead>';

for($i=0;$i < mssql_num_rows($result);++$i)
{
$row = mssql_fetch_row($result);
$rank = $i+1;

$accountinfo = mssql_query("Select GameIDC From AccountCharacter where id='$row[0]'");
$infos = mssql_fetch_array($accountinfo);

$mins = $row[1];
$hours = floor($mins/60);
$days = floor($hours/24);
$hours = $hours % 24;
$mins = $row[1] % 60;


$statusaq = mssql_query("select * from MEMB_STAT where memb___id='".$row['0']."' and connectstat='1'");
$statusa = mssql_num_rows($statusaq);

if($statusa != 0)
{ $status = "<font color=green>Online</font>"; }
else { $status="<font color=red>Offline</font>"; }



/*if($infos['ConnectStat'] == 1) { $status ='<font color=green><b>Online</b>'; }
else { $status='<font color=red><b>Offline</b></a>'; }

*/


//Class
if ($row['0'] == 0) { $row[0] = "Dark Wizard"; }
if ($row['0'] == 1) { $row[0] = "Soul Master"; }
if ($row['0'] == 16) { $row[0] = "Dark Knight"; }
if ($row['0'] == 17) { $row[0] = "Blade Knight"; }
if ($row['0'] == 32) { $row[0] = "Elf"; }
if ($row['0'] == 33) { $row[0] = "Muse Elf"; }
if ($row['0'] == 48) { $row[0] = "Magic Gladiator"; }

//Location
if ($proverkata['4'] == 0) { $proverkata[4] = 'Lorencia'; }
if ($proverkata['4'] == 1) { $proverkata[4] = 'Dungeon'; }
if ($proverkata['4'] == 2) { $proverkata[4] = 'Davias'; }
if ($proverkata['4'] == 3) { $proverkata[4] = 'Noria'; }
if ($proverkata['4'] == 4) { $proverkata[4] = 'Lost tower'; }
if ($proverkata['4'] == 5) { $proverkata[4] = 'Excile'; }
if ($proverkata['4'] == 6) { $proverkata[4] = 'Arena'; }
if ($proverkata['4'] == 7) { $proverkata[4] = 'Atlans'; }
if ($proverkata['4'] == 8) { $proverkata[4] = 'Tarkan'; }
if ($proverkata['4'] == 9) { $proverkata[4] = 'Devil Square'; }
if ($proverkata['4'] == 32) { $proverkata[4] = 'Devil Square'; }
if ($proverkata['4'] == 10) { $proverkata[4] = 'Icarus'; }

if($i%2) { $colors = "#232323";} else { $colors="#100c0d"; }

echo "<tbody>
<tr bgcolor='$colors'>
<td align='center'><span class='rankings_text'>$rank.</span></td>
<td align='center'><span class='rankings_text'><a href='index.php?page=character&character=$infos[GameIDC]'>$infos[GameIDC]</span></td>
<td align='center'><span class='rankings_text'><font color=red>$days days, <font color=white>$hours hours, <font color=green>$mins minutes</span></td>
<td align='center'>$status</td>

</tr>
</tbody>";
}
 }
?></table>
 
Last edited:
а php модула да дадеш, защото го имаше в някакъв пост, ама не мога да го открия

ПП: с php модула се оправих, но ако някой даде малко инфо как да го наглася да отчита например ето така : 3 hours, 24 minutes ще съм много благодарен
 
Last edited:
<?php include("config/config.php"); ?>
<?php
echo '<center><TABLE border=0 cellPadding=2 cellSpacing=2>
<table width="400" align="center">
<tr><td align="center" class="asd"> ActiveMu :: Online Time Ranking</td></tr>
<tr><td>&nbsp;</td></tr>
<br><br>
<table id="mutable" class="asd" height=50 border="1" bordercolor="333333" cellpadding="0" cellspacing="1" >
<center><tr>
<td align=left width=1%><font color=#fffffff><center><b>&nbsp;&nbsp;ID&nbsp;&nbsp;</b></center></font></td>
<td align=left><font color=#fffffff><center><b>&nbsp;&nbsp;Character&nbsp;&nbsp;</b></center></font></td>

<td width="30%" align=left><font color=#ffffff><center><b>&nbsp;&nbsp;Player Online Time&nbsp;&nbsp;</b></center></font></td>
<td align=left><font color=#ffffff><center><b>&nbsp;&nbsp;Status&nbsp;&nbsp;</b></center></font></td>
</tr></center>';
$query = mssql_query("Select Top 10 memb___id,TotalTime,ConnectStat From MEMB_STAT Order By TotalTime desc");
for($i=0;$i < mssql_num_rows($query);++$i)
{
$row = mssql_fetch_row($query);
if($row[2]==1){ $stat="<font color='green'>Online</font>"; }elseif($row[2]==0){ $stat="<font color='red'>Offline</font>";}
$querychar = "Select GameIDC From AccountCharacter where Id='$row[0]'";
$resultchar = mssql_query($querychar);
$accchar = mssql_fetch_row($resultchar);

$querychar = "Select Name,Class,MapNumber,clevel,resets,ctlcode,adminlevel From Character where Name='$accchar[0]'";
$resultchar = mssql_query($querychar);
$charr = mssql_fetch_row($resultchar);

$mins = $row[1];
$hours = floor($mins/60);
$days = floor($hours/24);
$hours = $hours % 24;
$mins = $row[1] % 60;

if ($charr[1] == 0) { $class = "Dark Wizard"; }
if ($charr[1] == 1) { $class = "Soul Master"; }
if ($charr[1] == 2) { $class = "Grand Master"; }
if ($charr[1] == 3) { $class = "Grand Master"; }
if ($charr[1] == 16) { $class = "Dark Knight"; }
if ($charr[1] == 17) { $class = "Blade Knight"; }
if ($charr[1] == 18) { $class = "Blade Master"; }
if ($charr[1] == 19) { $class = "Blade Master"; }
if ($charr[1] == 32) { $class = "Elf"; }
if ($charr[1] == 33) { $class = "Muse Elf"; }
if ($charr[1] == 34) { $class = "High Elf"; }
if ($charr[1] == 35) { $class = "High Elf"; }
if ($charr[1] == 48) { $class = "Magic Gladiator"; }
if ($charr[1] == 49) { $class = "Duel Master"; }
if ($charr[1] == 50) { $class = "Duel Master"; }
if ($charr[1] == 64) { $class = "Dark Lord"; }
if ($charr[1] == 65) { $class = "Lord Emperor"; }
if ($charr[1] == 66) { $class = "Lord Emperor"; }
if ($charr[1] == 80) { $class = "Summoner"; }
if ($charr[1] == 81) { $class = "Bloody Summoner"; }
if ($charr[1] == 82) { $class = "Dimension Master"; }
if ($charr[1] == 83) { $class = "Dimension Master"; }
if ($charr[1] == 96) { $class = "Rage Fighter"; }
if ($charr[1] == 97) { $class = "First Master"; }
if ($charr[1] == 98) { $class = "First Master"; }



$chara = mssql_query("SELECT * FROM AccountCharacter WHERE AccountID = '$row[0]'");
while($char = mssql_fetch_array($chara)) {
$char .= "$member[GameIDC]";
}


$rank = $i+1;
echo "<center><tr>
<td align=left><font size=1 color=#fffffff><b><center>$rank</center></b></font></td>

<td align=left><font size=1 color=#999999><b><center>$accchar[0]</a></center></b></td>
<td align=left><font size=1 color=#FFFFFF><b><center>$days days, $hours hours, $mins minutes</center></b></td>
<td align=left><font size=1 color=#999999><b><center>$stat</a></center></b></td>
</center></tr>
";
}

?>
</table>
 
да, поне при мен бачка на 100% 10x много :) добра работа
 
<td width="30%" align=left><font color=#ffffff><center><b>&nbsp;&nbs;Player Online Time&nbsp;&nbsp;</b></center></font></td>
само дето на този ред от rankingа е извадило емотиконка ето го по долу да го сложите :)



<td width="30%" align=left><font color=#ffffff><center><b>&nbsp; Player Online Time&nbsp;&nbsp;</b></center></font></td>
 
Last edited:
Сега ще ви прикача php file totaltime
 
Code:
<?php

function vreme($number)
{
$num = 0;

while($number > 60)
{
   $number = $number - 60;
   $num++;
}

if($num == 1){
   $hour = 'chas';
} else {
   $hour = 'chasa';
}

if($number == 1){
   $min = 'minuta';
} else {
   $min = 'minuti';
}

echo("[$num] $hour i [$number] $min");
}

?>
<table class="alt5" id="mutable" width="100%">
<tr><td align="left"><b>#</b></td><td align="center"><b>Account</b></td><td align="right"><b>Online Time</b></td></tr>
<?php
$query = mssql_query("Select Top 50 memb___id,TotalTime From MEMB_STAT Order By TotalTime desc");
for($i=0;$i < mssql_num_rows($query);++$i)
{
	$row = mssql_fetch_row($query);
	$rank = $i+1;
?>
<tr><td align="left"><b><?php echo("$rank.");?></b></td><td align="center"><b><?php echo($row[0]); ?></b></td><td align="right"><b><?php vreme($row[1]); ?></b></td></tr>
<?
}
?>
</table>
:)
 
Last edited:
Ох забравих за него съжелявам Благодаря vankyy26
 
При мен работи благодаря само 1 въпросче как да направя така че Администраторите и ГМ-тата да не ги показва в ранка?
 
В началото съм сложил и ранк!
 
Last edited: