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

Znote Account | Onlinelist with Storage-vocations

Nubaza

LUA Scripter
Joined
Jun 5, 2011
Messages
337
Solutions
1
Reaction score
23
Location
Chile
Hello.
Well, my currently Online List looks like this:
2d99v89.jpg

Because all my players on my server have Vocation 1.

But i want to change it! Because on my server, the vocations are storages, so i would like with the players with the storage number 86228 change it on onlinelist too.

Example:
Player with storage 86228 == -1 will be a Trainer
Player with storage 86228 == 3 will be a Firetamer
Player with storage 86228 == 4 will be a Waterdragon.

Etc, this is my Online List:
PHP:
<?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">
        <tr class="yellow">
            <td>Name:</td>
            <td>Level:</td>
            <td>Vocation:</td>
        </tr>
            <?php
            foreach ($array as $value) {
            echo '<tr>';
            echo '<td><a href="characterprofile.php?name='. $value[0] .'">'. $value[0] .'</a></td>';
            echo '<td>'. $value[1] .'</td>';
            echo '<td>'. vocation_id_to_name($value[2]) .'</td>';
            echo '</tr>';
            }
            ?>
    </table>

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

So, is this possible? Just change the vocation for the storage? Humm i don't know how to make this ://

Please help me a little, very thanks!

Greetings.
 
You could try this:

PHP:
<?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">
        <tr class="yellow">
            <td>Name:</td>
            <td>Level:</td>
            <td>Vocation:</td>
        </tr>
            <?php
            foreach ($array as $value) {
            $playerID = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '". $value[0] ."';");
            $vocation = mysql_select_single("SELECT `value` FROM `player_storage` WHERE `player_id` = '". $playerID ."' and `key` = 86228;");
            if ($vocation == -1) { $vocationName = "Trainer"; }
            elseif ($vocation == 3) { $vocationName = "Firetamer"; }
            elseif ($vocation == 4) { $vocationName = "Waterdragon"; }
       
            echo '<tr>';
            echo '<td><a href="characterprofile.php?name='. $value[0] .'">'. $value[0] .'</a></td>';
            echo '<td>'. $value[1] .'</td>';
            echo '<td>'. $vocationName .'</td>';
            echo '</tr>';
            }
            ?>
    </table>

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

I'm sorry if it doesn't work, just trying to help!
 
Notice: Array to string conversion in C:\xampp\htdocs\onlinelist.php on line 18

Notice: Undefined variable: vocationName in C:\xampp\htdocs\onlinelist.php on line 26

PD: Thanks for trying help, greetings
 
Hmm maybe this?

PHP:
<?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">
        <tr class="yellow">
            <td>Name:</td>
            <td>Level:</td>
            <td>Vocation:</td>
        </tr>
            <?php
            foreach ($array as $value) {
            $playerID = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '". $value[0] ."';");
            $vocation = mysql_select_single("SELECT `value` FROM `player_storage` WHERE (`key` = 86228 AND `player_id` = '". $playerID ."');");
           
            if ($vocation == -1) { $vocationName = "Trainer"; }
            elseif ($vocation == 3) { $vocationName = "Firetamer"; }
            elseif ($vocation == 4) { $vocationName = "Waterdragon"; }
            else { $vocationName = "Unknown Vocation"; }
       
            echo '<tr>';
            echo '<td><a href="characterprofile.php?name='. $value[0] .'">'. $value[0] .'</a></td>';
            echo '<td>'. $value[1] .'</td>';
            echo '<td>'. $vocationName .'</td>';
            echo '</tr>';
            }
            ?>
    </table>

    <?php
} else {
    echo 'Nobody is online.';
}
?>
<?php include 'layout/overall/footer.php'; ?>
 
Just that:
Notice: Array to string conversion in C:\xampp\htdocs\onlinelist.php on line 18

Notice: Array to string conversion in C:\xampp\htdocs\onlinelist.php on line 18

Notice: Array to string conversion in C:\xampp\htdocs\onlinelist.php on line 18

Notice: Array to string conversion in C:\xampp\htdocs\onlinelist.php on line 18

Notice: Array to string conversion in C:\xampp\htdocs\onlinelist.php on line 18

Thanks! :D
 
I think I found out what it was ;) Try this:

PHP:
<?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">
        <tr class="yellow">
            <td>Name:</td>
            <td>Level:</td>
            <td>Vocation:</td>
        </tr>
            <?php
            foreach ($array as $value) {
            $playerID = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '". $value[0] ."';");
            $vocation = mysql_select_single("SELECT `value` FROM `player_storage` WHERE (`key` = 86228 AND `player_id` = '". $playerID['id'] ."');");
           
            if ($vocation == -1) { $vocationName = "Trainer"; }
            elseif ($vocation == 3) { $vocationName = "Firetamer"; }
            elseif ($vocation == 4) { $vocationName = "Waterdragon"; }
            else { $vocationName = "Unknown Vocation"; }
       
            echo '<tr>';
            echo '<td><a href="characterprofile.php?name='. $value[0] .'">'. $value[0] .'</a></td>';
            echo '<td>'. $value[1] .'</td>';
            echo '<td>'. $vocationName .'</td>';
            echo '</tr>';
            }
            ?>
    </table>

    <?php
} else {
    echo 'Nobody is online.';
}
?>
<?php include 'layout/overall/footer.php'; ?>
 
@Skrypton bro, now i have not errores but all the characters online show Unknown Trainer and not how to supossed to be, undestood?

thanks for all the help ://
 
This should work.... haha I'm sorry it's taking me so many tries! I'm learning aswell!

PHP:
<?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">
        <tr class="yellow">
            <td>Name:</td>
            <td>Level:</td>
            <td>Vocation:</td>
        </tr>
            <?php
            foreach ($array as $value) {
            $playerID = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '". $value[0] ."';");
            $vocation = mysql_select_single("SELECT `value` FROM `player_storage` WHERE (`key` = 86228 AND `player_id` = '". $playerID['id'] ."');");
           
            if ($vocation['value'] == -1) { $vocationName = "Trainer"; }
            elseif ($vocation['value'] == 3) { $vocationName = "Firetamer"; }
            elseif ($vocation['value'] == 4) { $vocationName = "Waterdragon"; }
            else { $vocationName = "Unknown Vocation"; }
       
            echo '<tr>';
            echo '<td><a href="characterprofile.php?name='. $value[0] .'">'. $value[0] .'</a></td>';
            echo '<td>'. $value[1] .'</td>';
            echo '<td>'. $vocationName .'</td>';
            echo '</tr>';
            }
            ?>
    </table>

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