Siemka,
co tu źle zrobiłem:
powergames.php
globalevents:
Proszę o pomoc, exp jest źle naliczany, albo czasem wgl nie jest naliczany
co tu źle zrobiłem:
powergames.php
PHP:
<?PHP
$limit = 50;
$type = $_REQUEST['type'];
function coloured_value($valuein)
{
$value2 = $valuein;
while(strlen($value2) > 3)
{
$value .= '.'.substr($value2, -3, 3);
$value2 = substr($value2, 0, strlen($value2)-3);
}
$value = $value2.$value;
if($valuein > 0)
return '<center>'.$value.'</center>';
elseif($valuein < 0)
return '<font color="red">'.$value.'</font>';
else
return '<center>'.$value.'</center>';
}
if(empty($type))
$players = $SQL->query(' SELECT * FROM players ORDER BY `players`.`experience`-`players`.`exphist_lastexp` DESC LIMIT '.$limit)->fetchAll();
$main_content .= '<div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/content/contentheader.png)"><b><font color="white">Najszybciej expiący</font></b></div>Poniżej przedstawiona jest tabela z 50 najszybciej expiącymi graczami w dniu dzisiejszym:<br><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=4% CLASS=whites><B><center>#</center></B></TD><TD WIDTH=60% CLASS=whites><B><center>Nazwa postaci</center></B></TD>';
if(empty($type))
$main_content .= '<TD WIDTH=40% CLASS=whites><b><center>Zdobyte doświadczenie</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"><center>'.$player['name'].'</center></font></b></a><center>'.$player['level'].' lvl</center>';
else
$main_content .= '<td><a href="?subtopic=characters&name='.urlencode($player['name']).'"><b><font color="red"><center>'.$player['name'].'</center></font></b></a><center>'.$player['level'].' lvl</center>';
$main_content .= '<td align="right">'.coloured_value($player['exphist_lastexp']).'</td></tr>';
}
$main_content .= '</TABLE>';
?>
globalevents:
PHP:
function historyPage(parameters)
dofile("./config.lua")
env = assert(luasql.mysql())
con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
local historyPage = addEvent(historyPage, 60000, {})
if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
assert(con:execute("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;"))
assert(con:execute("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
assert(con:execute("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;"))
con:close()
env:close()
end