• Vote in October Mapping Competition to select a winner!
  • There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

MyAAC Top Guilds

Bubecki

Member
Joined
Nov 16, 2015
Messages
30
Reaction score
8
Hi guys, does someone know how to do something like this Top Guilds?

^ This is my Old Layout...
I want put it there: (This is my New layout - Myaac)


Will be very Thankfull.
@slawkens
 
Last edited:

Loney

[*]
Senator
Premium User
Joined
Jul 23, 2012
Messages
1,903
Solutions
11
Reaction score
142
Location
México
 
OP
B

Bubecki

Member
Joined
Nov 16, 2015
Messages
30
Reaction score
8
Thank you very much!
Maybe you know how to do in php this script?
1602951611892.png
I want to put it in my up header.
Status server + today date
 

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
3,077
Solutions
83
Reaction score
561
Location
Germany
The PHP Code to write like this would be:
PHP:
Status:
<?php
if($status['online']): ?>
<span style="color: green"><b>ONLINE</b></span>
<?php else: ?>
<span style="color: red"><b>OFFLINE</b></span>
<?php endif;
echo date('l j F, Y');
?>

But you need however find the right place to put it in your template.

If you can post your template then maybe I can help you.
 
OP
B

Bubecki

Member
Joined
Nov 16, 2015
Messages
30
Reaction score
8
You are my bosses @slawkens @Loney . Thank you very much.
I have last question....
I have Best Players TOP 5 lvl in my ots.
But under this i want to add Last 24h Top players. I mean players who have gained the most experience in the last 24 hours.
1602966766342.png

PHP:
<?php

                        foreach(getTopPlayers(5) as $player)

                        {

                         echo '<li class="bg6"><h3><em class="style2"><b>(' . $player['level'] . ')</b>&nbsp;<a href="' . getPlayerLink($player['name'], false) . '"  class="link2">' . $player['name'] . '</a></em></h3>';

                         echo '<em class="style2">
                         ' . number_format($player['experience']) . '&nbsp;exp</em></li>';

                        }

        ?>
I just need to edit this code^ from best players to top 24h exp gained.
It is possible?
 

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
3,077
Solutions
83
Reaction score
561
Location
Germany
Here's the function: (paste in system/functions.php)
PHP:
function getTopPowergamers($limit = 5) {
   global $db;

   $cache = Cache::getInstance();
   if($cache->enabled()) {
      $tmp = '';
      if($cache->fetch('toppow_' . $limit . '_level', $tmp)) {
         $players = unserialize($tmp);
      }
   }

   if (!isset($players)) {
      $deleted = 'deleted';
      if($db->hasColumn('players', 'deletion'))
         $deleted = 'deletion';

      $is_tfs10 = $db->hasTable('players_online');
      $players = $db->query('SELECT `id`, `name`, `level`, `exphist1` as `experience`, `looktype`' . ($db->hasColumn('players', 'lookaddons') ? ', `lookaddons`' : '') . ', `lookhead`, `lookbody`, `looklegs`, `lookfeet`' . ($is_tfs10 ? '' : ', `online`') . ' FROM `players` WHERE `group_id` < ' . config('highscores_groups_hidden') . ' AND `id` NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND `' . $deleted . '` = 0 AND `account_id` != 1 ORDER BY `exphist1` DESC LIMIT ' . (int)$limit)->fetchAll();

      if($is_tfs10) {
         foreach($players as &$player) {
            $query = $db->query('SELECT `player_id` FROM `players_online` WHERE `player_id` = ' . $player['id']);
            $player['online'] = ($query->rowCount() > 0 ? 1 : 0);
         }
         unset($player);
      }

      $i = 0;
      foreach($players as &$player) {
         $player['rank'] = ++$i;
      }
      unset($player);

      if($cache->enabled()) {
         $cache->set('toppow_' . $limit . '_level', serialize($players), 120);
      }
   }

   return $players;
}

Just replace in your code:
PHP:
foreach(getTopPlayers(5) as $player)

getTopPlayers with getTopPowergamers
 
OP
B

Bubecki

Member
Joined
Nov 16, 2015
Messages
30
Reaction score
8
Here's the function: (paste in system/functions.php)
PHP:
function getTopPowergamers($limit = 5) {
   global $db;

   $cache = Cache::getInstance();
   if($cache->enabled()) {
      $tmp = '';
      if($cache->fetch('toppow_' . $limit . '_level', $tmp)) {
         $players = unserialize($tmp);
      }
   }

   if (!isset($players)) {
      $deleted = 'deleted';
      if($db->hasColumn('players', 'deletion'))
         $deleted = 'deletion';

      $is_tfs10 = $db->hasTable('players_online');
      $players = $db->query('SELECT `id`, `name`, `level`, `exphist1` as `experience`, `looktype`' . ($db->hasColumn('players', 'lookaddons') ? ', `lookaddons`' : '') . ', `lookhead`, `lookbody`, `looklegs`, `lookfeet`' . ($is_tfs10 ? '' : ', `online`') . ' FROM `players` WHERE `group_id` < ' . config('highscores_groups_hidden') . ' AND `id` NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND `' . $deleted . '` = 0 AND `account_id` != 1 ORDER BY `exphist1` DESC LIMIT ' . (int)$limit)->fetchAll();

      if($is_tfs10) {
         foreach($players as &$player) {
            $query = $db->query('SELECT `player_id` FROM `players_online` WHERE `player_id` = ' . $player['id']);
            $player['online'] = ($query->rowCount() > 0 ? 1 : 0);
         }
         unset($player);
      }

      $i = 0;
      foreach($players as &$player) {
         $player['rank'] = ++$i;
      }
      unset($player);

      if($cache->enabled()) {
         $cache->set('toppow_' . $limit . '_level', serialize($players), 120);
      }
   }

   return $players;
}

Just replace in your code:
PHP:
foreach(getTopPlayers(5) as $player)

getTopPlayers with getTopPowergamers
Thank you very much. My hero.
Here is possible to do show how much he earned exp in the day? " + Day exp " now it is showing "Total exp player". If you know what i mean. In screen i showed what i want. Player1 now showing total exp of X player. But i want only like in James + Today earned exp.
1603108156322.png

@@@@@ EDIT
Or it is possible to change not for 1234567exp, but for example + X lvls?
+ X levels
Example screen
1603125622164.png
 
Last edited:
Top