Koci1994
Banned User
- Joined
- Dec 27, 2008
- Messages
- 807
- Reaction score
- 1
Witam mam taki problem mam na stronie taką opcję most online i powergamers (gracze są czasami nawet po 8 godzin online a tam się nic nie zmienia pisze nadal ze każdy 0 godzin i 0 minut nawet jak oni wylogują a ja zapis serwera zrobię .) A powergamres pokaazuej tylko exp z dzisiejszego dnia . Nie zapisuje histori
mój plik : onlinetime.php
Tatm jeszcze pisze zeby zrobic taki login.lua ale ja mam juz do login.lua dodana arene w svar i nie weim gdzie to dodac
Moje login.lua
orgynalny temat : http://otland.net/f118/gesior-acc-maker-forgotten-server-0-3-powergamers-online-time-stats-8640/
mój plik : onlinetime.php
Code:
<?PHP
$limit = 300;
$type = $_REQUEST['type'];
function hours_and_minutes($value, $color = 1)
{
$hours = floor($value / 3600);
$value = $value - $hours * 3600;
$minutes = floor($value / 60);
if($color != 1)
return '<font color="black">'.$hours.'h '.$minutes.'m</font>';
else
if($hours >= 12)
return '<font color="red">'.$hours.'h '.$minutes.'m</font>';
elseif($hours >= 6)
return '<font color="black">'.$hours.'h '.$minutes.'m</font>';
else
return '<font color="green">'.$hours.'h '.$minutes.'m</font>';
}
if(empty($type))
$players = $SQL->query(' SELECT * FROM players ORDER BY `onlinetimetoday` DESC LIMIT '.$limit)->fetchAll();
elseif($type == "sum")
$players = $SQL->query(' SELECT * FROM players ORDER BY `players`.`onlinetime1`+`players`.`onlinetime2`+`players`.`onlinetime3`+`players`.`onlinetime4`+`players`.`onlinetime5`+`players`.`onlinetime6`+`players`.`onlinetime7`+`players`.`onlinetimetoday` DESC LIMIT '.$limit)->fetchAll();
elseif($type >= 1 && $type <= 7)
$players = $SQL->query(' SELECT * FROM players ORDER BY onlinetime'.(int) $type.' DESC LIMIT '.$limit)->fetchAll();
$main_content .= '<CENTER><H2>Ranking of no lifers</H2></CENTER><BR><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%></TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD WIDTH=10% CLASS=whites><B>Rank</B></TD><TD WIDTH=75% CLASS=whites><B>Name</B></TD>';
if($type == "sum")
$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=onlinetime&type=sum">All online time</a></center></B></TD>';
else
$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=onlinetime&type=sum">All online time</a></center></B></TD>';
for($i = 7; $i >= 2; $i--)
if($type == $i)
$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=onlinetime&type='.$i.'">'.$i.' Days Ago</a></center></B></TD>';
else
$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=onlinetime&type='.$i.'">'.$i.' Days Ago</a></center></B></TD>';
if($type == 1)
$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=onlinetime&type=1">1 Day Ago</a></center></B></TD>';
else
$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=onlinetime&type=1">1 Day Ago</a></center></B></TD>';
if(empty($type))
$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=onlinetime">Today</a></center></B></TD>';
else
$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=onlinetime">Today</a></center></B></TD>';
$main_content .= '</TR>';
foreach($players as $player)
{
if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center">'.$number_of_rows.'. </td>';
if($player['online'] == 1)
$main_content .= '<td><a href="?subtopic=characters&name='.urlencode($player['name']).'"><b><font color="green">'.$player['name'].'</font></b></a>';
else
$main_content .= '<td><a href="?subtopic=characters&name='.urlencode($player['name']).'"><b><font color="red">'.$player['name'].'</font></b></a>';
$main_content .= '<br />'.$player['level'].' '.$config_vocations[$player['vocation']].'</td><td align="right">'.hours_and_minutes($player['onlinetime1'] + $player['onlinetime2'] + $player['onlinetime3'] + $player['onlinetime4'] + $player['onlinetime5'] + $player['onlinetime6'] + $player['onlinetime7'] + $player['onlinetimetoday'], 0).'</td>';
$main_content .= '<td align="right">'.hours_and_minutes($player['onlinetime7']).'</td><td align="right">'.hours_and_minutes($player['onlinetime6']).'</td><td align="right">'.hours_and_minutes($player['onlinetime5']).'</td><td align="right">'.hours_and_minutes($player['onlinetime4']).'</td><td align="right">'.hours_and_minutes($player['onlinetime3']).'</td><td align="right">'.hours_and_minutes($player['onlinetime2']).'</td><td align="right">'.hours_and_minutes($player['onlinetime1']).'</td><td align="right">'.hours_and_minutes($player['onlinetimetoday']).'</td></tr>';
}
$main_content .= '</TABLE>';
?>
Code:
function onLogin(cid)
if(InitHistory == 0) then
local historyPage = addEvent(historyPage, 60000, {})
InitHistory = historyPage
end
registerCreatureEvent(cid, "PlayerDeath")
return TRUE
end
function historyPage(parameters)
local historyPage = addEvent(historyPage, 60000, {})
if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
db.executeQuery("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;")
db.executeQuery("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;")
end
db.executeQuery("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;")
end
Moje login.lua
Code:
function onLogin(cid)
registerCreatureEvent(cid, "PlayerKill")
registerCreatureEvent(cid, "BountyHunter")
if (InitArenaScript ~= 0) then
InitArenaScript = 1
-- make arena rooms free
for i = 42300, 42309 do
setGlobalStorageValue(i, 0)
setGlobalStorageValue(i+100, 0)
end
end
-- if he did not make full arena 1 he must start from zero
if getPlayerStorageValue(cid, 42309) < 1 then
for i = 42300, 42309 do
setPlayerStorageValue(cid, i, 0)
end
end
-- if he did not make full arena 2 he must start from zero
if getPlayerStorageValue(cid, 42319) < 1 then
for i = 42310, 42319 do
setPlayerStorageValue(cid, i, 0)
end
end
-- if he did not make full arena 3 he must start from zero
if getPlayerStorageValue(cid, 42329) < 1 then
for i = 42320, 42329 do
setPlayerStorageValue(cid, i, 0)
end
end
if getPlayerStorageValue(cid, 42355) == -1 then
setPlayerStorageValue(cid, 42355, 0) -- did not arena level
end
setPlayerStorageValue(cid, 42350, 0) -- time to kick 0
setPlayerStorageValue(cid, 42352, 0) -- is not in arena
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "PlayerDeath")
registerCreatureEvent(cid, "PythiusQuest")
return TRUE
end
orgynalny temat : http://otland.net/f118/gesior-acc-maker-forgotten-server-0-3-powergamers-online-time-stats-8640/
Last edited: