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

KD to my website

Monomalo00

http://leiends.ml/
Joined
Nov 13, 2010
Messages
120
Solutions
1
Reaction score
4
Hello again, someone knows how i can add the KD to my website? (taking the info from DB)

This sidebar its for Frags and i want transform for KD/R, i have some idea but i dont know how to do. My is idea taking Frags + Deaths from DB and make a average.
Thanks you

Code:
            <div class="sidebar">
                    <div class="panel panel-default">
                    <div class="panel-heading">
                    <h3 class="panel-title"><img src="IMAGE"></h3>
                    </div>
                    <div class="panel-body">
                        <table class="table table-condensed table-content table-striped">
                        <tbody>
                         <?php
                    $test = $SQL->query("SELECT `name`,`frags` FROM players ORDER BY `frags` DESC LIMIT 5");
                    $count = 1;
                         foreach ($test as $display) {
                         if (strlen($display['name']) > 15) { $valuex = substr($display['name'],0,10).'...'; } else { $valuex = $display['name']; }
                          echo '<tr><td width="10%">' . $count++ . '.</td><td width="60%"><a href="?subtopic=characters&name=' . $display['name'] . '">' . $valuex . '</a></td><td><span class="label label-primary">Kills. '.$display['frags'].'</span></td></tr>';
                                                }
                                       ?>

                        </tbody>
                        </table>
                    </div>
                </div>
 
How i can make this in MYSQL.
In Player_Storage: select player_id, key (30000,30001,30002), value (30000+30002 / 30001) = result

And with this result i make KD for my website (maybe i need create some table for works good) i triyed for myself but i can't reach the solution.. if someone know how runs mysql i'd be very grateful.
 
I got other idea.
Use the KDA script to update directly the DB.

My idea it's the same think this script is updating the description make with DB. With some line like this:
Code:
  db.query("UPDATE `players` SET `kda` = `kda` + "?" WHERE id = " .. getPlayerGUID(cid) .. ";")

KDA
Code:
    if thing:isCreature() then
        if thing:isPlayer() then
            local KD = (math.max(0, thing:getStorageValue(STORAGEVALUE_KILLS)) + math.max(0, thing:getStorageValue(STORAGEVALUE_ASSISTS))) / math.max(1, thing:getStorageValue(STORAGEVALUE_DEATHS))
            description = string.format("%s\nKD: [%0.2f]", description, KD)
        end
    end
 
Back
Top