OTcreator
Active Member
- Joined
- Feb 14, 2022
- Messages
- 426
- Solutions
- 1
- Reaction score
- 44
Hello,
I trying change connect in Znote Powergamers.php and connect with Gesior Powergamers Globalevents.
Work fine for me.
Rep ++ if u use.
* globalevents script:
*PHP
*ADD tables to database
I trying change connect in Znote Powergamers.php and connect with Gesior Powergamers Globalevents.
Work fine for me.
Rep ++ if u use.
* globalevents script:
Lua:
function onThink()
if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
db.executeQuery("UPDATE `players` SET `onlinetime7`=`onlinetime6`, `onlinetime6`=`onlinetime5`, `onlinetime5`=`onlinetime4`, `onlinetime4`=`onlinetime3`, `onlinetime3`=`onlinetime2`, `onlinetime2`=`onlinetime1`, `onlinetime1`=`onlinetimetoday`, `onlinetimetoday`=0;")
db.executeQuery("UPDATE `players` SET `exphist7`=`exphist6`, `exphist6`=`exphist5`, `exphist5`=`exphist4`, `exphist4`=`exphist3`, `exphist3`=`exphist2`, `exphist2`=`exphist1`, `exphist1`=`experience`-`exphist_lastexp`, `exphist_lastexp`=`experience`;")
end
db.executeQuery("UPDATE `players` SET `onlinetimetoday`=`onlinetimetoday`+60, `onlinetimeall`=`onlinetimeall`+60 WHERE `online` = 1;")
return TRUE
end
Code:
*PHP
PHP:
<?php
require_once 'engine/init.php';
include 'layout/overall/header.php';
$powergamers = $config['powergamers'];
$limit = $powergamers['limit'];
if ($config['powergamers_enabled'] === false) {
echo 'Powergamers page has been disabled at config.php.';
include 'layout/overall/footer.php';
exit();
}
?>
<?php
$type = @$_GET['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 '<b><font color="green">+'.$value.'</font></b>';
elseif($valuein < 0)
return '<font color="red">'.$value.'</font>';
else
return $value;
}
if(empty($type))
$players = mysql_select_multi('SELECT name, level, online, vocation, experience, exphist1, exphist2, exphist3, exphist4, exphist5, exphist6, exphist7, exphist_lastexp, id AS online FROM players WHERE group_id < 3 ORDER BY experience - exphist_lastexp DESC LIMIT ' . $limit);
elseif($type == "sum")
$players = mysql_select_multi('SELECT `p`.*, `p_on`.`player_id` AS online FROM `players` p LEFT JOIN `players_online` p_on ON `p`.`id` = `p_on`.`experience`-`p`.`exphist_lastexp` DESC LIMIT ' . $limit);
elseif($type >= 1 && $type <= 7)
$players = mysql_select_multi('SELECT `p`.*, `p_on`.`player_id` AS online FROM `players` p LEFT JOIN `players_online` p_on ON `p`.`id` = `p_on`.`player_id` WHERE `p`.`group_id` < 2 ORDER BY `p`.`exphist' . (int) $type . '` DESC LIMIT '.$limit);
echo '<CENTER><H2></H2></CENTER>
<BR>
<table class="table table-condensed table-bordered table-striped">
<td><B><center>Rank</B></td>
<td><B><center>Name</B></td>';
echo ($type == 'sum') ? '<TD><b><center>Weekly <br> Experience</B></TD>' : '<TD><center>Weekly<br> Experience</TD>';
for($i = 3; $i >= 2; $i--)
echo ($type == $i) ? '<TD><center><a href="powergamers.php?type='.$i.'">'.$i.' <center><b> Days Ago</b></a></B></TD>' : '<TD><center>'.$i.' Days Ago</a></TD>';
echo ($type == 1) ? '<TD><b><center><a href="powergamers.php?type=1">1 Day Ago</a></B></TD>' : '<TD><center>1 Day Ago</a></TD>';
echo (empty($type)) ? '<TD><center><b><font color="#7e7968">Today<br><i class="fa fa-trophy mr-2"></i><b> TOP</a></TD>' : '<TD>Today</a></font></TD>';
echo '</TR>';
$number_of_rows = 1;
if($players)
foreach($players as $player)
{
echo '<td><center>'. $number_of_rows . '. </td>';
echo ($player['online']) ? '<td><center><a href="characterprofile.php?name=' . urlencode($player['name']) . '"><b>' . htmlspecialchars($player['name']) . '</font></b></a>' : '<td><a href="characterprofile.php?name=' . urlencode($player['name']) . '"><b><font color="red">' . htmlspecialchars($player['name']) . '</font></b></a>';
echo '<br /><span class="badge badge-primary badge-pill float-left">'.$player['level'].' level</span> </td><td ><center>'.coloured_value($player['exphist1'] + $player['exphist2'] + $player['exphist3'] + $player['exphist4'] + $player['exphist5']+ $player['exphist6']+ $player['exphist7'] + $player['experience'] - $player['exphist_lastexp']).'</td>';
echo '<td ><center>'.coloured_value($player['exphist3']).'</td><td ><center>'.coloured_value($player['exphist2']).'</td><td ><center>'.coloured_value($player['exphist1']).'</td><td ><center>'.coloured_value($player['experience']-$player['exphist_lastexp']).'</td></tr>';
$number_of_rows++;
}
echo '</table>';
?>
<?php
include 'layout/overall/footer.php';
?>
*ADD tables to database
Code:
ALTER TABLE `players` ADD `exphist_lastexp` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetimetoday` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime1` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime2` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime3` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime4` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime5` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime6` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime7` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetimeall` BIGINT( 255 ) NOT NULL DEFAULT '0';