• 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!

Change playersonline.php ZNOTE

luccagomes

New Member
Joined
Jul 30, 2015
Messages
153
Reaction score
1
Someone could help me to change my playersonline.php to something like it:

01:54 8 players online:
01:54 Vocations: None [2], Sorcerer [2], Paladin [2], Knight [2].

Im using Znote AAC

Code:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>

<h1>Who is online?</h1>
<?php
$array = online_list();
if ($array) {
   ?>
   
   <table id="onlinelistTable" class="table table-striped table-hover">
     <tr class="yellow">
       <th>Name:</th>
       <th>Guild:</th>
       <th>Level:</th>
       <th>Vocation:</th>
     </tr>
       <?php
       foreach ($array as $value) {
       $url = url("characterprofile.php?name=". $value['name']);
       echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">';
       echo '<td><a href="characterprofile.php?name='. $value['name'] .'">'. $value['name'] .'</a></td>';
       if (!empty($value['gname'])) echo '<td><a href="guilds.php?name='. $value['gname'] .'">'. $value['gname'] .'</a></td>'; else echo '<td></td>';
       echo '<td>'. $value['level'] .'</td>';
       echo '<td>'. vocation_id_to_name($value['vocation']) .'</td>';
       echo '</tr>';
       }
       ?>
   </table>

   <?php
} else {
   echo 'Nobody is online.';
}
?>
<?php include 'layout/overall/footer.php'; ?>
 
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>

<h1>Who is online?</h1>
<?php
$array = online_list();

if ($array) {
    ?>
    Currently <?php echo user_count_online(); ?> players is online:<br/><br/>
    <?php
        $players = user_count_online();
        $type = "";
        $count = 1;
        foreach ($array as $value) {
            if ($count < $players) {
                $type = ',';
            } else {
                $type = '.';
            }
            echo '<a href="characterprofile.php?name='. $value['name'] .'">'. $value['name'] .'</a> [Level: '. $value['level'] .']'. $type .' ';
            $count++;
        }
    ?>

    <?php
} else {
    echo 'Nobody is online.';
}
?>
<?php include 'layout/overall/footer.php'; ?>
 
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>

<h1>Who is online?</h1>
<?php
$array = online_list();

if ($array) {
    ?>
    Currently <?php echo user_count_online(); ?> players is online:<br/><br/>
    <?php
        $players = user_count_online();
        $type = "";
        $count = 1;
        foreach ($array as $value) {
            if ($count < $players) {
                $type = ',';
            } else {
                $type = '.';
            }
            echo '<a href="characterprofile.php?name='. $value['name'] .'">'. $value['name'] .'</a> [Level: '. $value['level'] .']'. $type .' ';
            $count++;
        }
    ?>

    <?php
} else {
    echo 'Nobody is online.';
}
?>
<?php include 'layout/overall/footer.php'; ?>
This is not what he wants.
He wants to show in the online page, how many vocations are online too

For example:

Knight [2], Sorcerer [2] .... :)
 
Something like this might be what you want. Never worked with ZnoteAAC so there might be some functions that let you do it more easily.

PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>

<h1>Who is online?</h1>
<?php
$array = online_list();
if ($array) {
  ?>

  <?php
  $count = 0;
  $voc_count = array(0, 0, 0, 0, 0);
  $content = "";

  foreach ($array as $value) {
  $count++;
  $no_promo_voc = ($value['vocation'] > 4) ? $value['vocation']-4 : $value['vocation'];
  $voc_count[$no_promo_voc]++;

  $url = url("characterprofile.php?name=". $value['name']);
  $content .= '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">';
  $content .= '<td><a href="characterprofile.php?name='. $value['name'] .'">'. $value['name'] .'</a></td>';
  if (!empty($value['gname']))
  $content .= '<td><a href="guilds.php?name='. $value['gname'] .'">'. $value['gname'] .'</a></td>';
  else
  $content .= '<td></td>';
  $content .= '<td>'. $value['level'] .'</td>';
  $content .= '<td>'. vocation_id_to_name($value['vocation']) .'</td>';
  $content .= '</tr>';
  }

  echo $count . ' '.(($count > 1) ? 'players' : 'player').' online. <br />';

  $voc_output = array();
  foreach ($voc_count as $k => $v) {
  array_push($voc_output, vocation_id_to_name($k) . ' ['.$v.']');
  }

  echo implode(', ', $voc_output);

  ?>
 
  <table id="onlinelistTable" class="table table-striped table-hover">
  <tr class="yellow">
  <th>Name:</th>
  <th>Guild:</th>
  <th>Level:</th>
  <th>Vocation:</th>
  </tr>
  <?php
  echo $content;
  ?>
  </table>

  <?php
} else {
  echo 'Nobody is online.';
}
?>
<?php include 'layout/overall/footer.php'; ?>
 
Back
Top