Jump to content

[Free] Top 10 Players


Recommended Posts

Easy one. Nothing fancy really, just saves some time, it displays top 10 players, you can order the top list via money/level.


//This file cannot be viewed, it must be included
defined('IN_EZRPG') or exit;

class Module_TopPlayers extends Base_Module
   public function start()
       //Require login

       switch ($_GET['order'])
           case 'level':
               $order = 'level';
           case 'money':
               $order = 'money';
               $order = 'level';

       $query = $this->db->execute('SELECT `username`, `level`, `money` FROM `<ezrpg>players` ORDER BY ' . $order . ' DESC LIMIT 10');
       $members = $this->db->fetchAll($query);

       $this->tpl->assign('members', $members);




{include file="header.tpl" TITLE="Top 10 Players"}

<h2>Top 10 Players</h2>

<table width="90%">
   <th style="text-align: left;">Username</th>
   <th style="text-align: left;"><a href="index.php?mod=TopPlayers&order=level">Level</a></th>
   <th style="text-align: left;"><a href="index.php?mod=TopPlayers&order=money">Money</a></th>

{foreach from=$members item=member}

{include file="footer.tpl"}



1. Make a folder named TopPlayers in your modules directory.

2. Place the index.php file with the first code snippet above.

3. Place the topplayers.tpl file in the smarty/templates directory with the second code snippet above.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...