• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[PHP] Display in characters.php!

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,782
Solutions
25
Reaction score
491
Location
Sweden
Can someone help me display my frags in characters?

Im thinking something like this:

PHP:
f ($cfg['skill_names'][$player->attrs['frags']]))
	    echo '<b>Frags:</b> '.$player->attrs['frags']."<br/>\n";

Doesn't work xD Please help!
 
So late with answering but yes ofc! Sec:

PHP:
<?php 
/*
    Copyright (C) 2007 - 2009  Nicaw

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
include ("include.inc.php");
$ptitle="Characters - $cfg[server_name]";
include("header.inc.php");
?>
<div id="content">
    <div class="top">Character Lookup</div>
    <div class="mid">
        <form method="get" action="characters.php">
            <input type="text" name="player_name"/>
            <input type="submit" value="Search"/>
        </form>
        <?php
        try {
            $player = new Player();
            if (!empty($_GET['player_id'])) {
                $player->load($_GET['player_id']);
            } elseif (!empty($_GET['player_name'])) {
                $player->find($_GET['player_name']);
            } else {
                throw new PlayerException();
            }
            $account = new Account();
            $account->load($player->attrs['account']);

            echo '<hr/><table style="width: 100%"><tr><td><b>Name:</b> '.htmlspecialchars($player->attrs['name']).'&nbsp;';
            if($player->isStatus()) echo '<span style="color:green">[Online]</span>'."<br/>\n";
            else echo '<span style="color:red">[Offline]</span>'."<br/>\n";
            echo '<b>Level:</b> '.$player->attrs['level']."<br/>\n";
            echo '<b>Magic Level:</b> '.$player->attrs['maglevel']."<br/>\n";
            echo '<b>Profession:</b> '.$cfg['vocations'][$player->attrs['vocation']]['name']."<br/>\n";

	    if ($cfg['skill_names'][$player->attrs['frags']])
            echo '<b>Frags:</b> '.$player->attrs['frags']."<br/>\n"; 

            try {
                echo '<b>Guild:</b> '.$player->guild['guild_rank_name'].' of <a href="guilds.php?guild_id='.$player->guild['guild_id'].'">'.htmlspecialchars($player->guild['guild_name']).'</a><br/>'."\n";
            } catch(GuildNotFoundException $e) {}

            $gender = Array('Female','Male');
            echo '<b>Sex:</b> '.$gender[$player->attrs['sex']].'<br/>'."\n";
            if (!empty($cfg['temple'][$player->attrs['city']]['name']))
                echo "<b>Residence</b>: ".ucfirst($cfg['temple'][$player->attrs['city']]['name'])."<br/>";

            if ($account->attrs['premend'] > time()) {
                echo "<b>Premium: </b> ".ceil(($account->attrs['premend'] - time())/(3600*24))." day(s)<br/>";
            }
            if ($player->attrs['lastlogin'] == 0)
                $lastlogin = 'Never';
            else
                $lastlogin = date("jS F Y H:i:s",$player->attrs['lastlogin']);
            echo "<b>Last Login:</b> ".$lastlogin."<br/>\n";
            if ($cfg['show_skills']) {
                echo "</td><td>";
                $sn = $cfg['skill_names'];
                for ($i=0; $i < count($sn); $i++) {
                    echo '<b>'.ucfirst($sn[$i]).':</b> '.$player->skills[$i]['skill']."<br/>\n";
                }
                echo '</td></tr>';
            }
            echo '</table>';
            if (strlen($account->attrs['comment'])>0) {
                echo "<b>Comments</b><br/><div style=\"overflow:hidden\"><pre>".htmlspecialchars($account->attrs['comment'])."</pre></div><br/>\n";
            }
            echo '<hr/>';
            if ($account->attrs['reveal_characters'] && $account->players && count($account->players) > 1) {
                echo '<b>Characters on the same account</b><br/><ul class="task-menu">';
                foreach ($account->players as $_player) {
                    echo '<li style="background-image: url(resource/user.png);" onclick="window.location.href=\'characters.php?player_id='.htmlspecialchars($_player['id']).'\'">'.htmlspecialchars($_player['name']).'</li>';
                }
                echo '</ul><hr/>';
            }

            if ($cfg['show_deathlist']) {
                if ($player->deaths) {
                    echo '<b>Latest Deaths</b><br/>';
                    $prevdate = 0;
                    foreach ($player->deaths as $death) {
                        if ($death['killer_id'])
                            $name = '<a href="characters.php?player_id='.$death['killer_id'].'">'.$death['killer_name'].'</a>';
                        else
                            $name = $death['killer_name'];
                        if($prevdate == $death['date'])
                            echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and by '.$name.'<br/>';
                        else
                            echo '<i>'.date("jS F Y H:i:s",$death['date']).'</i> Killed at level '.$death['victim_level'].' by '.$name.'<br/>';
                        $prevdate = $death['date'];
                    }
                }
            }
        } catch(PlayerNotFoundException $e) {
            echo 'Player not found';
        } catch(PlayerException $e) {}
        ?>
    </div>
    <div class="bot"></div>
</div>
<?php include ("footer.inc.php");?>
 
Back
Top