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

Znote ACC - Correct vocation name in Character Profile

Acubens

Old Penguin
Joined
May 6, 2008
Messages
1,014
Best answers
1
Reaction score
77
Location
Venezuela
In Engine/function/general.php add this function:

PHP:
function isPromoted($user_id)
{
    $user_id = sanitize($user_id);
    $data = mysql_select_single("SELECT `promotion` FROM `players` WHERE `id` = $user_id;");
    $p = $data['promotion'] > 0 ? 1 : 0;
    return $p;
}
Now go to characterprofile.php and under:

PHP:
if (get_character_guild_rank($user_id) > 0)
{
    $guild_exist = true;
    $guild = get_player_guild_data($user_id);
    $guild_name = get_guild_name($guild['guild_id']);
}
Add this:

PHP:
$extra = isPromoted($user_id) == 1 ? 4 : 0;
Now to show the correct name for each vocation search for all:

PHP:
vocation_id_to_name($profile_data['vocation']
And replace with:

PHP:
vocation_id_to_name($profile_data['vocation']+$extra
 

Rulaz

New Member
Joined
Mar 29, 2011
Messages
44
Best answers
0
Reaction score
1
I don't really understand what this do
 

EvilSkillz

Back
Joined
Jul 12, 2012
Messages
1,723
Best answers
0
Reaction score
302
Location
Egypt - Cairo
I don't really understand what this do
this do ?
read the title of post
correct vocation name :D

more explain Oki
he added this
$data = mysql_select_single("SELECT `promotion` FROM `players` WHERE `id` = $user_id;");

to check if player is promoted

and this for extra
$extra = isPromoted($user_id) == 1 ? 4 : 0;

so that's help of u have a special promotion
like Sorcerer , Master Sorcerer , Epic Master Sorcerer , Legendary Sorcerer , etc ..
 

Rulaz

New Member
Joined
Mar 29, 2011
Messages
44
Best answers
0
Reaction score
1
this do ?
read the title of post
correct vocation name :D

more explain Oki
he added this
$data = mysql_select_single("SELECT `promotion` FROM `players` WHERE `id` = $user_id;");

to check if player is promoted

and this for extra
$extra = isPromoted($user_id) == 1 ? 4 : 0;

so that's help of u have a special promotion
like Sorcerer , Master Sorcerer , Epic Master Sorcerer , Legendary Sorcerer , etc ..
Ok i get it :p thx
 

Lelodro

khé?
Joined
Sep 15, 2008
Messages
326
Best answers
3
Reaction score
175
Location
Venezuela
This works perfect but how i can fix in Highscore.php & OnlineList.php, only shows the vocation without promotion

Bump

bump
 
OP
Acubens

Acubens

Old Penguin
Joined
May 6, 2008
Messages
1,014
Best answers
1
Reaction score
77
Location
Venezuela
Code:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
<td width="95%"><img src="layout/images/line_body.gif" width="100%" height="7" border="0" hspace="0" vspace="0" align="left"></td>
<img src="layout/images/titles/t_highscores.png"/>
<td width="95%"><img src="layout/images/line_body.gif" width="100%" height="7" border="0" hspace="0" vspace="0" align="left"></td>
<br><br><p>
<?php

if ($config['log_ip']) {
    znote_visitor_insert_detailed_data(3);
}

// Fetch highscore type
$type = (isset($_GET['type'])) ? (int)getValue($_GET['type']) : 7;
if ($type > 9) $type = 7;

// Fetch highscore page
$page = getValue(@$_GET['page']);
if (!$page || $page == 0) $page = 1;
else $page = (int)$page;

$highscore = $config['highscore'];

$rows = $highscore['rows'];
$rowsPerPage = $highscore['rowsPerPage'];

function skillName($type) {
    $types = array(
        1 => "Club",
        2 => "Sword",
        3 => "Axe",
        4 => "Distance",
        5 => "Shielding",
        6 => "Fishing",
        7 => "Experience", // Hardcoded
        8 => "Magic Level", // Hardcoded
        9 => "Fist", // Since 0 returns false I will make 9 = 0. :)
    );
    return $types[(int)$type];
}

function pageCheck($index, $page, $rowPerPage) {
    return ($index < ($page * $rowPerPage) && $index >= ($page * $rowPerPage) - $rowPerPage) ? true : false;
}

$cache = new Cache('engine/cache/highscores');
if ($cache->hasExpired()) {
    $scores = fetchAllScores($rows, $config['TFSVersion'], $highscore['ignoreGroupId']);
   
    $cache->setContent($scores);
    $cache->save();
} else {
    $scores = $cache->load();
}

if ($scores) {
    ?>
    <form action="" method="GET">
        <select name="type">
            <option value="7" <?php if ($type == 7) echo "selected"; ?>>Experience</option>
            <option value="8" <?php if ($type == 8) echo "selected"; ?>>Magic</option>
            <option value="5" <?php if ($type == 5) echo "selected"; ?>>Shielding</option>
            <option value="2" <?php if ($type == 2) echo "selected"; ?>>Sword</option>
            <option value="1" <?php if ($type == 1) echo "selected"; ?>>Club</option>
            <option value="3" <?php if ($type == 3) echo "selected"; ?>>Axe</option>
            <option value="4" <?php if ($type == 4) echo "selected"; ?>>Distance</option>
            <option value="6" <?php if ($type == 6) echo "selected"; ?>>Fishing</option>
            <option value="9" <?php if ($type == 9) echo "selected"; ?>>Fist</option>
        </select>
        <select name="page">
            <?php
            $pages = (int)($highscore['rows'] / $highscore['rowsPerPage']);
            for ($i = 0; $i < $pages; $i++) {
                $x = $i + 1;
                if ($x == $page) echo "<option value='".$x."' selected>Page: ".$x."</option>";
                else echo "<option value='".$x."'>Page: ".$x."</option>";
            }
            ?>
        </select>
        <input type="submit" value=" View " class="btn btn-info">
    </form>


    <table id="highscoresTable" class="table table-striped table-hover">
        <tr class="yellow">
            <td>Rank</td>
            <td>Name</td>
            <td>Vocation</td>
            <td>Level</td>
            <?php if ($type === 7) echo "<td width='10%'>Experience</td>"; ?>
        </tr>
        <?php
        for ($i = 0; $i < count($scores[$type]); $i++) {
            if (pageCheck($i, $page, $rowsPerPage)) {
                ?>
                <tr>
                    <td><?php echo $i+1; ?></td>
                    <td><a href="characterprofile.php?name=<?php echo $scores[$type][$i]['name']; ?>"><?php echo $scores[$type][$i]['name']; ?></a></td>
                    
<td><?php echo vocation_id_to_name($scores[$type][$i]['vocation']); ?></td>
                    <td><?php echo $scores[$type][$i]['value']; ?></td>
                    <?php if ($type === 7) echo "<td>". $scores[$type][$i]['experience'] ."</td>"; ?>
                </tr>
                <?php
            }
        }
        ?>
    </table>
    <?php
}
include 'layout/overall/footer.php'; ?>
 

Lelodro

khé?
Joined
Sep 15, 2008
Messages
326
Best answers
3
Reaction score
175
Location
Venezuela
Online list:

Code:
string(48) "SELECT `promotion` FROM `players` WHERE `id` = ;" 
(query - SQL error) 
Type: select_single (select single row from database)

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
myaccount:

Code:
string(48) "SELECT `promotion` FROM `players` WHERE `id` = ;" 
(query - SQL error) 
Type: select_single (select single row from database)

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
 

Lelodro

khé?
Joined
Sep 15, 2008
Messages
326
Best answers
3
Reaction score
175
Location
Venezuela
online list:

Code:
string(52) "SELECT `id` FROM `players` WHERE `name` = 'GM Sacus;" 
(query - SQL error) 
Type: select_single (select single row from database)

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''GM Sacus' at line 1
myaccounnt:

Code:
string(53) "SELECT `id` FROM `players` WHERE `name` = 'Jova Grip;" 
(query - SQL error) 
Type: select_single (select single row from database)

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Jova Grip' at line 1
 

StreamSide

Joseluis Gonzalez
Support Team
Joined
Aug 31, 2007
Messages
3,400
Best answers
39
Reaction score
902
Location
Arica - Chile
Code:
user_id = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '".$value['name'].";");
to
Code:
user_id = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '".$value['name']."';");
 

Lelodro

khé?
Joined
Sep 15, 2008
Messages
326
Best answers
3
Reaction score
175
Location
Venezuela
Code:
user_id = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '".$value['name'].";");
to
Code:
user_id = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '".$value['name']."';");
Nop:

Code:
string(48) "SELECT `promotion` FROM `players` WHERE `id` = ;" 
(query - SQL error) 
Type: select_single (select single row from database)

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
 

Manots

New Member
Joined
Apr 7, 2010
Messages
4
Best answers
0
Reaction score
0
If someone was looking for a solution to online list.

Change:

$extra = isPromoted($value['id']) == 1 ? 4 : 0;

To:

$extra = isPromoted($value['vocation']) == 1 ? 4 : 0;

then you don't need a database query :)

Edit:

Solution to myaccount:

Change:

$extra = isPromoted($value['id']) == 1 ? 4 : 0;

To:

$extra = isPromoted($user_id['vocation']) != 1 ? 4 : 0;

and

Change:

user_id = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '".$value['name']."';");

To:

$user_id = mysql_select_single("SELECT `vocation` FROM `players` WHERE `name` = '".$value['name']."';");

then

. vocation_id_to_name($value['vocation']+$extra) .

to

.vocation_id_to_name($user_id['vocation']+$extra).
 
Last edited:
Top