Ir para conteúdo

[Encerrado] [Encerrado] Ultimas Mortes


Marshmello

Posts Recomendados

10 minutos atrás, Marshmello disse:
  Mostrar conteúdo oculto

<?php

    if(!defined('BASEPATH')) exit('No direct script access allowed');

    $player = $GLOBALS['player'];

    $SQL = POT::getInstance()->getDBHandle();

    $deaths = $SQL->query("SELECT `player_deaths`.`id`, `player_deaths`.`date`, `player_deaths`.`level` FROM `player_deaths` WHERE `player_deaths`.`player_id` = {$player->getId()} ORDER BY `player_deaths`.`date` DESC LIMIT 0,10;");

    if($deaths->rowCount())

    {

        echo "<div class=\"bar\">Deaths</div>";

        foreach($deaths as $death)

        {

            $i = 0;

            $killers = $SQL->query("SELECT `environment_killers`.`name` AS `monster_name`, `players`.`name` AS `player_name`, `players`.`deleted` AS `player_exists` FROM `killers` LEFT JOIN `environment_killers` ON `killers`.`id` = `environment_killers`.`kill_id`

                LEFT JOIN `player_killers` ON `killers`.`id` = `player_killers`.`kill_id` LEFT JOIN `players` ON `players`.`id` = `player_killers`.`player_id`

                WHERE `killers`.`death_id` = {$SQL->quote($death['id'])} ORDER BY `killers`.`final_hit` DESC, `killers`.`id` ASC")->fetchAll();

            echo "<table style=\"width: 100%;\"><tr class=\"highlight\"><td width=\"22%\">".date("j M Y, H:i", $death['date'])."</td><td width=\"78%\">";

            foreach($killers as $killer)

            {

                $i++;

                $str = (count($killers) >= 20 ? "Annihilated" : (count($killers) >= 15 ? "Eliminated" : (count($killers) >= 10 ? "Crushed" : (count($killers) >= 5 ? "Slain" : "Killed"))));

                if(!empty($killer['monster_name']))

                    $killer['monster_name'] = (!in_array($i, array(1, count($killers))) ? str_replace(array("an ", "a "), array("", ""), $killer['monster_name']) : $killer['monster_name']);

                echo (!empty($killer['player_name']) ? ($i == 1 ? "{$str} at Level {$death['level']} by " : ($i == count($killers) ? " and " : ", ")).(!empty($killer['monster_name']) ? "{$killer['monster_name']} of " : "").($killer['player_exists'] == 0 ? "<a href=\"".WEBSITE."/index.php/character/view/{$killer['player_name']}\">{$killer['player_name']}</a>" : $killer['player_name']) : ($i == 1 ? "Died at Level {$death['level']} by {$killer['monster_name']}" : ($i == count($killers) ? " and {$killer['monster_name']}" : ", {$killer['monster_name']}")));

            }

            echo ".</td></tr></table>";

        }

    }

?>

 

não mecho com sites.

Link para o comentário
Compartilhar em outros sites

não chego a ir para o banco de dado

 

tenho uma script aki que acho q pode ajuda um pouco

Spoiler
local config = {    deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),    sqlType = getConfigInfo('mysql'),    maxDeathRecords = getConfigInfo('maxDeathRecords')}config.sqlType = config.sqlType == "mysql" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQLfunction onDeath(cid, corpse, lastHitKiller, mostDamageKiller)    if(config.deathListEnabled ~= TRUE) then        return    end    local hitKillerName = "field item"    local damageKillerName = ""    if(lastHitKiller ~= FALSE) then        if(isPlayer(lastHitKiller) == TRUE) then            hitKillerName = getPlayerGUID(lastHitKiller)        else            hitKillerName = getCreatureName(lastHitKiller)        end        if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then            if(isPlayer(mostDamageKiller) == TRUE) then                damageKillerName = getPlayerGUID(mostDamageKiller)            else                damageKillerName = getCreatureName(mostDamageKiller)            end        end    end    db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")    local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")    if(rows:getID() ~= -1) then        local amount = rows:getRows(true) - config.maxDeathRecords        if(amount > 0) then            if(config.sqlType == DATABASE_ENGINE_SQLITE) then                for i = 1, amount do                    db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")                end            else                db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")            end        end    endend

 

Editado por Marshmello
Link para o comentário
Compartilhar em outros sites

  • 4 months later...
Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...