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

TFS 1.X+ ranking.php for storage/resets

Mateus Robeerto

Excellent OT User
Joined
Jun 5, 2016
Messages
1,337
Solutions
71
Reaction score
697
Location
ლ(ಠ益ಠლ)
Can someone help me solve the addition of 'storage'? I need the value 378378 to be added to display the reset values correctly. I've used several functions without success. Follow the image Znote!
ranking.png
And in another 'themebox' that I managed to display the resets working, I thought about taking these functions and putting them in the 'ranking.php' file, but nothing appeared.
toplvl 5.png

@Znote @slaw

can you help me??
 
Solution
So basically something like that but if you want to combine that with highscore you need to add default sort and join to player_storage:
SQL:
SELECT p.name, ps.value AS resets, p.vocation, p.level
FROM players p
LEFT JOIN player_storage ps ON ps.player_id = p.id AND ps.key = 378378
ORDER BY ps.value DESC, p.level DESC
LIMIT 5;

No idea how modern AAC do that but maybe there's even some query builder for that.
Can I ask why you use storage for resets? :p
Because I'm using an NPC that resets a player, so I'm using storage
I've tried without using the storage and also nothing appeared. Even with the storage, it's not working. I even added it in the database but it still didn't show up. It only works when I used themebox ;/
 
So basically something like that but if you want to combine that with highscore you need to add default sort and join to player_storage:
SQL:
SELECT p.name, ps.value AS resets, p.vocation, p.level
FROM players p
LEFT JOIN player_storage ps ON ps.player_id = p.id AND ps.key = 378378
ORDER BY ps.value DESC, p.level DESC
LIMIT 5;

No idea how modern AAC do that but maybe there's even some query builder for that.
 
Solution
I tried several functions, storage, database and other types without success. See how I'm doing

Lua:
<table id="highscoresTable" class="table table-striped table-hover">
    <tr class="yellow">
        <?php if ($loadOutfits) echo "<th>Outfit</th>"; ?>
        <th>Name</th>
        <?php if ($playerStorage_reset) echo "<th>Resets</th>"; ?>
        <th>Vocation</th>
        <th>Level</th>
        <?php if ($type === 7) echo "<th>Points</th>"; ?>
    </tr>

    <?php
    if ($vocGroup[$type] === false) {
        ?>
        <tr>
            <td colspan="<?php echo ($loadOutfits ? 5 : 4); ?>">Nothing to show here yet.</td>
        </tr>
        <?php
    } else {
        foreach ($vocGroup[$type] as $key => $entry) {
            ?>
            <tr>
                <?php if ($loadOutfits): ?>
                    <td class="outfitColumn">
                        <img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $entry['type']; ?>&addons=<?php echo $entry['addons']; ?>&head=<?php echo $entry['head']; ?>&body=<?php echo $entry['body']; ?>&legs=<?php echo $entry['legs']; ?>&feet=<?php echo $entry['feet']; ?>" alt="img">
                    </td>
                <?php endif; ?>
                <td><?php echo $entry['name']; ?></td>
                <?php if ($playerStorage_reset): ?>
                    <td>
                        <?php
                        if (isset($entry['player_id'])) {
                            $playerId = $entry['player_id'];
                            $storageQuery = mysql_select_single("SELECT `value` FROM `player_storage` WHERE `player_id` = $playerId AND `key` = $playerStorage_reset");
                            $resetsValue = ($storageQuery !== false) ? $storageQuery['value'] : 'N/A';
                            echo $resetsValue;
                        } else {
                            echo '0';
                        }
                        ?>
                    </td>
                <?php endif; ?>
                <td><?php echo vocation_id_to_name($entry['vocation']); ?></td>
                <td><?php echo $entry['value']; ?></td>
                <?php if ($type === 7) echo "<td>" . $entry['experience'] . "</td>"; ?>
            </tr>
            <?php
        }
    }
    ?>
</table>
Post automatically merged:

So basically something like that but if you want to combine that with highscore you need to add default sort and join to player_storage:
SQL:
SELECT p.name, ps.value AS resets, p.vocation, p.level
FROM players p
LEFT JOIN player_storage ps ON ps.player_id = p.id AND ps.key = 378378
ORDER BY ps.value DESC, p.level DESC
LIMIT 5;

No idea how modern AAC do that but maybe there's even some query builder for that.
Now yes, that's what you ordered me to put on and it worked. The values of resets appeared. I will organize and make it even better. Thank you very much!


test.png
 
Last edited:
I tried several functions, storage, database and other types without success. See how I'm doing

Lua:
<table id="highscoresTable" class="table table-striped table-hover">
    <tr class="yellow">
        <?php if ($loadOutfits) echo "<th>Outfit</th>"; ?>
        <th>Name</th>
        <?php if ($playerStorage_reset) echo "<th>Resets</th>"; ?>
        <th>Vocation</th>
        <th>Level</th>
        <?php if ($type === 7) echo "<th>Points</th>"; ?>
    </tr>

    <?php
    if ($vocGroup[$type] === false) {
        ?>
        <tr>
            <td colspan="<?php echo ($loadOutfits ? 5 : 4); ?>">Nothing to show here yet.</td>
        </tr>
        <?php
    } else {
        foreach ($vocGroup[$type] as $key => $entry) {
            ?>
            <tr>
                <?php if ($loadOutfits): ?>
                    <td class="outfitColumn">
                        <img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $entry['type']; ?>&addons=<?php echo $entry['addons']; ?>&head=<?php echo $entry['head']; ?>&body=<?php echo $entry['body']; ?>&legs=<?php echo $entry['legs']; ?>&feet=<?php echo $entry['feet']; ?>" alt="img">
                    </td>
                <?php endif; ?>
                <td><?php echo $entry['name']; ?></td>
                <?php if ($playerStorage_reset): ?>
                    <td>
                        <?php
                        if (isset($entry['player_id'])) {
                            $playerId = $entry['player_id'];
                            $storageQuery = mysql_select_single("SELECT `value` FROM `player_storage` WHERE `player_id` = $playerId AND `key` = $playerStorage_reset");
                            $resetsValue = ($storageQuery !== false) ? $storageQuery['value'] : 'N/A';
                            echo $resetsValue;
                        } else {
                            echo '0';
                        }
                        ?>
                    </td>
                <?php endif; ?>
                <td><?php echo vocation_id_to_name($entry['vocation']); ?></td>
                <td><?php echo $entry['value']; ?></td>
                <?php if ($type === 7) echo "<td>" . $entry['experience'] . "</td>"; ?>
            </tr>
            <?php
        }
    }
    ?>
</table>
Post automatically merged:


Now yes, that's what you ordered me to put on and it worked. The values of resets appeared. I will organize and make it even better. Thank you very much!


View attachment 77982
If you're experiencing issues with a Znote AAC (Account Management System for OTServ/OTServ Global), the problem could vary depending on what exactly is going wrong. Here are a few steps you can take to diagnose and potentially fix the issue:

  1. Check Logs: Always the first step when diagnosing issues. Check the error logs to see if anything stands out as the cause of your problem.
  2. Database Connection: Verify that Znote AAC is properly connected to your database. Usually, there will be a config.php file where you can check the database credentials.
  3. Dependencies: Make sure that all the required PHP extensions and server requirements are met for running Znote AAC.
  4. File Permissions: Check if the web server has the appropriate permissions to read/write to the necessary folders.
  5. Version Mismatch: Ensure that the version of Znote AAC is compatible with your OTServ version. Sometimes newer versions of one may not be compatible with older versions of the other.
  6. Configuration: Double-check all the settings in the configuration files of Znote AAC to ensure they are set up correctly.
  7. Custom Changes: If you've made custom changes to the Znote AAC code, try reverting those changes to see if that fixes the problem. Sometimes a small change can have unexpected consequences.
  8. Debugging: Use PHP debugging functions like var_dump() or print_r() to dump variables and see their current state. This might give you clues on what's going wrong.
  9. SQL Injection: As always, ensure that your code is safe from SQL injection, especially if you've made custom changes.
  10. Community Help: Sometimes, the issue you're facing has already been solved by someone in the community. Websites like OtLand offer forums where you can seek advice.
If you could provide more details on what specific problem you're encountering, I'd be able to offer more targeted advice.
 
Back
Top