Welcome
Welcome to the Official<strong>World of Phaos</strong>Forums.

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining the World of Phaos community for free, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join the World of Phaos community today</a>!

Player list

Updated or created a new script or part of WoP and you think the world should know, post it here and you may well see it in the next release of Phaos.
(Remember to keep all code clean and readable)

Moderators: zeke, Aradan

Player list

Postby smikus1 » Thu Dec 25, 2008 1:40 pm

I crated scripts for Player list.
You can check it in mine.
http://test-gamerpg.awardspace.com
And i also added that are admins red colored
smikus1
Level 1
 
Posts: 11
Joined: Thu Dec 25, 2008 1:37 pm

Re: Player list

Postby Rebell » Tue Dec 30, 2008 8:19 am

Nice done !

Please uplod for the community :D

thanx
... visit my RPG WEBSITE - but its still not finished !
User avatar
Rebell
Level 3
 
Posts: 62
Joined: Sat Aug 09, 2008 4:42 pm
Location: Germany

Re: Player list

Postby smikus1 » Tue Dec 30, 2008 12:04 pm

I combined it with normal html page but with links to it. So i created more of them. This one is for order players by experience.
<?php

function connectdb()
{
$conn=mysql_connect("localhost","root","password") or die("Unable to connect to the database!");
mysql_select_db("db_name",$conn) or die("The database was not found!");
return $conn;
}

function disconnectdb($conn)
{
mysql_close($conn);
}

?>
<html>
<body>
<table border="2">
<tr>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">Username</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">race</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">class</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">Experience</font></th>

</tr>
<?php
$sql_command='select username,race,class,xp from phaos_characters order by xp desc;';
$conn=connectdb();
$result=mysql_query($sql_command) or die("Unable to extract data from the database!");
disconnectdb($conn);

while ($character=mysql_fetch_array($result))
// malo sem popravil stvari
if($character['username']!='phaos_npc')
if($character['username']!='phaos_npc_arena')
if($character['username']!='phaos_arena_fighting')
{
if ($character['race'] == 'Admin')
echo("<tr style=\"color:red;\"><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
else
echo("<tr><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
}
?>
</table>
</body>
</html>


i made that all that has race Admin are red colored. I hope that this will help you
smikus1
Level 1
 
Posts: 11
Joined: Thu Dec 25, 2008 1:37 pm

Re: Player list

Postby Rebell » Thu Jan 08, 2009 11:48 am

Thanks !

ive changes your scipt and added on the top:

Code: Select all
define('AUTH',true);
include "config.php";


and removed:

Code: Select all
//$conn=mysql_connect("localhost","root","password") or die("Unable to connect to the database!");
//mysql_select_db("db_name",$conn) or die("The database was not found!");


now its working :D
... visit my RPG WEBSITE - but its still not finished !
User avatar
Rebell
Level 3
 
Posts: 62
Joined: Sat Aug 09, 2008 4:42 pm
Location: Germany

Re: Player list

Postby mccragge » Thu Apr 09, 2009 7:06 pm

This is really helpful, thank you! I was just looking for something just like this.

However, I have arranged mine to have all the tables on one page so you can see everything at a glance.

Thanks again.

McCragge
mccragge
Level 4
 
Posts: 82
Joined: Mon Nov 10, 2008 5:46 am

Re: Player list

Postby mccragge » Fri Apr 10, 2009 12:46 am

How do you get to only show the top ten?

It takes up way to much room showing all the players.

McCragge
mccragge
Level 4
 
Posts: 82
Joined: Mon Nov 10, 2008 5:46 am

Re: Player list

Postby mccragge » Wed Apr 15, 2009 5:15 am

Here is my little contribution to the WoP community.

I have taken the top players code from above and modified it a little bit :) It only shows the top TEN players and not all the players in the database. Plus I fixed the way it lists the Top Ten Highest leveled characters. And on top of that, I managed to fit 9 categories on one page without it looking ot terrible. Let me know what you guys think.

Code: Select all
<?php

include "header2.php";

function connectdb()
{
//$conn=mysql_connect("localhost","root","password") or die("Unable to connect to the database!");
//mysql_select_db("database",$conn) or die("The database was not found!");
return $conn;
}

function disconnectdb($conn)
{
mysql_close($conn);
}

?>

<html>
<body>

<center><font size="6"><b>TOP PLAYERS</b></font></center>
<br>


<center><table>
<tr>
    <td>

<center><font size="4"><b>Experience</b></font></center>
 
    <center><table border="5" cellpadding="1" cellspacing="0">
     <tr>
     
      <th style="background-color: rgb(255, 255, 153);"><font
color="red">Character</font></th>
      <th style="background-color: rgb(255, 255, 153);"><font
color="red">Race</font></th>
      <th style="background-color: rgb(255, 255, 153);"><font
color="red">Class</font></th>
      <th style="background-color: rgb(255, 255, 153);"><font
color="red">Exp</font></th>

     </tr>
<?php
$sql_command='select username,name,race,class,xp from phaos_characters order by xp desc;';
$conn=connectdb();
$result=mysql_query($sql_command) or die("Unable to extract data from the database!");
disconnectdb($conn);


$i = 0;
while ($character=mysql_fetch_array($result))
{
   if ($i <10)
   {
      // malo sem popravil stvari   
      if($character['username']!='phaos_npc')
         if($character['username']!='phaos_npc_arena')
            if($character['username']!='phaos_arena_fighting')
            {
         $i++;
               if ($character['race'] == 'Admin')
                  echo("<tr style=\"color:red;\"><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
               else
                  echo("<tr class=\"combat\"><td>{$character['name']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
            }
   }

}
?>
     </table></center>
  </td>
  <td>
     
<center><font size="4"><b>Level</b></font></center>     

<center><table border="5" cellpadding="1" cellspacing="0">
<tr>

<th style="background-color: rgb(255, 255, 153);"><font
color="red">Character</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">Class</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">Level</font></th>

</tr>
<?php
$sql_command='select username,name,class,level from phaos_characters order by cast(level as UNSIGNED) desc;';
$conn=connectdb();
$result=mysql_query($sql_command) or die("Unable to extract data from the database!");
disconnectdb($conn);


$i = 0;
while ($character=mysql_fetch_array($result))
{
   if ($i <10)
   {
      // malo sem popravil stvari   
      if($character['username']!='phaos_npc')
         if($character['username']!='phaos_npc_arena')
            if($character['username']!='phaos_arena_fighting')
            {
         $i++;
               if ($character['race'] == 'Admin')
                  echo("<tr style=\"color:red;\"><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
               else
                  echo("<tr class=\"combat\"><td>{$character['name']}</td><td>{$character['class']}</td><td>{$character['level']}</td></tr>");
            }
   }

}

?>
</table></center>
</td>
<td>

<center><font size="4"><b>Wealthiest</b></font></center>

<center><table border="5" cellpadding="1" cellspacing="0">
<tr>

<th style="background-color: rgb(255, 255, 153);"><font
color="red">Character</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">Credits</font></th>

</tr>
<?php
$sql_command='select username,name,gold from phaos_characters order by gold desc;';
$conn=connectdb();
$result=mysql_query($sql_command) or die("Unable to extract data from the database!");
disconnectdb($conn);

$i = 0;
while ($character=mysql_fetch_array($result))
{
   if ($i <10)
   {
      // malo sem popravil stvari   
      if($character['username']!='phaos_npc')
         if($character['username']!='phaos_npc_arena')
            if($character['username']!='phaos_arena_fighting')
            {
         $i++;
               if ($character['race'] == 'Admin')
                  echo("<tr style=\"color:red;\"><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
               else
                  echo("<tr class=\"combat\"><td>{$character['name']}</td><td>{$character['gold']}</td></tr>");
            }
   }

}

?>
</table></center>
</td>
</tr>
<tr>
<td>

<center><font size="4"><b>Best Fighter</b></font></center>


<center><table border="5" cellpadding="1" cellspacing="0">
<tr>

<th style="background-color: rgb(255, 255, 153);"><font
color="red">Character</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">Attack Skill</font></th>

</tr>
<?php
$sql_command='select username,name,fight from phaos_characters order by fight desc;';
$conn=connectdb();
$result=mysql_query($sql_command) or die("Unable to extract data from the database!");
disconnectdb($conn);

$i = 0;
while ($character=mysql_fetch_array($result))
{
   if ($i <10)
   {
      // malo sem popravil stvari   
      if($character['username']!='phaos_npc')
         if($character['username']!='phaos_npc_arena')
            if($character['username']!='phaos_arena_fighting')
            {
         $i++;
               if ($character['race'] == 'Admin')
                  echo("<tr style=\"color:red;\"><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
               else
                  echo("<tr class=\"combat\"><td>{$character['name']}</td><td>{$character['fight']}</td></tr>");
            }
   }

}

?>
</table></center>
</td>
<td>

<center><font size="4"><b>Best Defender</b></font></center>


<center><table border="5" cellpadding="1" cellspacing="0">
<tr>

<th style="background-color: rgb(255, 255, 153);"><font
color="red">Character</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">Defense Skill</font></th>

</tr>
<?php
$sql_command='select username,name,defence from phaos_characters order by defence desc;';
$conn=connectdb();
$result=mysql_query($sql_command) or die("Unable to extract data from the database!");
disconnectdb($conn);

$i = 0;
while ($character=mysql_fetch_array($result))
{
   if ($i <10)
   {
      // malo sem popravil stvari   
      if($character['username']!='phaos_npc')
         if($character['username']!='phaos_npc_arena')
            if($character['username']!='phaos_arena_fighting')
            {
         $i++;
               if ($character['race'] == 'Admin')
                  echo("<tr style=\"color:red;\"><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
               else
                  echo("<tr class=\"combat\"><td>{$character['name']}</td><td>{$character['defence']}</td></tr>");
            }
   }

}

?>
</table></center>
</td>
<td>

<center><font size="4"><b>Best Unarmed Fighter</b></font></center>


<center><table border="5" cellpadding="1" cellspacing="0">
<tr>

<th style="background-color: rgb(255, 255, 153);"><font
color="red">Character</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">Unarmed Skill</font></th>

</tr>
<?php
$sql_command='select username,name,weaponless from phaos_characters order by weaponless desc;';
$conn=connectdb();
$result=mysql_query($sql_command) or die("Unable to extract data from the database!");
disconnectdb($conn);

$i = 0;
while ($character=mysql_fetch_array($result))
{
   if ($i <10)
   {
      // malo sem popravil stvari   
      if($character['username']!='phaos_npc')
         if($character['username']!='phaos_npc_arena')
            if($character['username']!='phaos_arena_fighting')
            {
         $i++;
               if ($character['race'] == 'Admin')
                  echo("<tr style=\"color:red;\"><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
               else
                  echo("<tr class=\"combat\"><td>{$character['name']}</td><td>{$character['weaponless']}</td></tr>");
            }
   }

}

?>
</table></center>
</td>
<tr>
<td>

<center><font size="4"><b>Helpful Reputation</b></font></center>


<center><table border="5" cellpadding="1" cellspacing="0">
<tr>

<th style="background-color: rgb(255, 255, 153);"><font
color="red">Character</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">Helpful</font></th>

</tr>
<?php
$sql_command='select username,name,rep_helpfull from phaos_characters order by rep_helpfull desc;';
$conn=connectdb();
$result=mysql_query($sql_command) or die("Unable to extract data from the database!");
disconnectdb($conn);

$i = 0;
while ($character=mysql_fetch_array($result))
{
   if ($i <10)
   {
      // malo sem popravil stvari   
      if($character['username']!='phaos_npc')
         if($character['username']!='phaos_npc_arena')
            if($character['username']!='phaos_arena_fighting')
            {
         $i++;
               if ($character['race'] == 'Admin')
                  echo("<tr style=\"color:red;\"><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
               else
                  echo("<tr class=\"combat\"><td>{$character['name']}</td><td>{$character['rep_helpfull']}</td></tr>");
            }
   }

}

?>
</table></center>
</td>
<td>


<center><font size="4"><b>Generous Reputation</b></font></center>

<center><table border="5" cellpadding="1" cellspacing="0">
<tr>

<th style="background-color: rgb(255, 255, 153);"><font
color="red">Character</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">Generous</font></th>

</tr>
<?php
$sql_command='select username,name,rep_generious from phaos_characters order by rep_generious desc;';
$conn=connectdb();
$result=mysql_query($sql_command) or die("Unable to extract data from the database!");
disconnectdb($conn);

$i = 0;
while ($character=mysql_fetch_array($result))
{
   if ($i <10)
   {
      // malo sem popravil stvari   
      if($character['username']!='phaos_npc')
         if($character['username']!='phaos_npc_arena')
            if($character['username']!='phaos_arena_fighting')
            {
         $i++;
               if ($character['race'] == 'Admin')
                  echo("<tr style=\"color:red;\"><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
               else
                  echo("<tr class=\"combat\"><td>{$character['name']}</td><td>{$character['rep_generious']}</td></tr>");
            }
   }

}

?>
</table></center>
</td>
<td>

<center><font size="4"><b>Combat Reputation</b></font></center>


<center><table border="5" cellpadding="1" cellspacing="0">
<tr>

<th style="background-color: rgb(255, 255, 153);"><font
color="red">Character</font></th>
<th style="background-color: rgb(255, 255, 153);"><font
color="red">Combat</font></th>

</tr>
<?php
$sql_command='select username,name,rep_combat from phaos_characters order by rep_combat desc;';
$conn=connectdb();
$result=mysql_query($sql_command) or die("Unable to extract data from the database!");
disconnectdb($conn);

$i = 0;
while ($character=mysql_fetch_array($result))
{
   if ($i <10)
   {
      // malo sem popravil stvari   
      if($character['username']!='phaos_npc')
         if($character['username']!='phaos_npc_arena')
            if($character['username']!='phaos_arena_fighting')
            {
         $i++;
               if ($character['race'] == 'Admin')
                  echo("<tr style=\"color:red;\"><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
               else
                  echo("<tr class=\"combat\"><td>{$character['name']}</td><td>{$character['rep_combat']}</td></tr>");
            }
   }

}

?>
</table></center>
</td>
</tr>

</tr>
</table></center>

<br>

</body>
</html>

<? include "footer.php"; ?>
mccragge
Level 4
 
Posts: 82
Joined: Mon Nov 10, 2008 5:46 am


Return to Scripts

Who is online

Users browsing this forum: No registered users and 0 guests

cron