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

MyACC characters how to show kills

SixNine

Active Member
Joined
Dec 12, 2018
Messages
452
Reaction score
41
Hi i have custom character page and for some reason it doesnt show kills it always stays at zero

i think its these code parts

PHP:
                '.$twig->render('characters.html.twig', array(
                    'outfit' => isset($outfit) ? $outfit : null,
                    'player' => $player,
                    'account' => $account,
                    'flag' => $flag,
                    'frags_enabled' => $frags_enabled,
                    'frags_count' => $frags_count,
                    'skills' => isset($skills) ? $skills : null,
                    'skull' => $player->getSkullTime() > 0 && ($player->getSkull() == 4 || $player->getSkull() == 5) ? $skulls[$player->getSkull()] : null,
                    'deaths' => $deaths,
                    'frags' => $frags,
                    'player_link' => getPlayerLink($player->getName(), false),
                    'hidden' => $hidden,
                    'bannedUntil' => isset($bannedUntil) ? $bannedUntil : null,
                    'characters_link' => getLink('characters'),
                    'account_players' => isset($account_players) ? $account_players : null,
                    'achievements' => $playerAchievements,
                    'search_form' => generate_search_form()
                )).'

PHP:
    $frags_enabled = tableExist('player_killers') && $config['characters']['frags'];
    $frags_count = 0;
    if($frags_enabled) {
        $query = $db->query(
            'SELECT COUNT(`player_id`) as `frags`' .
            'FROM `player_killers`' .
            'WHERE `player_id` = ' .$player->getId() . ' ' .
            'GROUP BY `player_id`' .
            'ORDER BY COUNT(`player_id`) DESC');
        
        if($query->rowCount() > 0)
        {
            $query = $query->fetch();
            $frags_count = $query['frags'];
        }
    }

PHP:
    $frags = array();
    $frag_add_content = '';
    if($config['characters']['frags'])
    {
        //frags list by Xampy
        $i = 0;
        $frags_limit = 10; // frags limit to show? // default: 10
        $player_frags = $db->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,'.$frags_limit.';')->fetchAll();
        if(count($player_frags))
        {
            $row_count = 0;
            foreach($player_frags as $frag)
            {
                $description = 'Fragged <a href="' . getPlayerLink($frag['name'], false) . '">' . $frag['name'] . '</a> at level ' . $frag['level'];
                $frags[] = array('time' => $frag['date'], 'description' => $description, 'unjustified' => $frag['unjustified'] != 0);
            }
        }
    }
 
Then the query should be:

Code:
SELECT COUNT(`player_deaths`.`killed_by`) as frags
FROM `player_deaths`
WHERE `player_deaths`.`killed_by` = ' . $db->quote($player->getName()) . '
AND `player_deaths`.`unjustified` = 1

Because TFS 1.2 uses player_deaths table.
Post automatically merged:

Also, change this:

Code:
$frags_enabled = tableExist('player_killers') && $config['characters']['frags'];

To:
Code:
$frags_enabled = tableExist('player_deaths') && $config['characters']['frags'];
 
Last edited:
Then the query should be:

Code:
SELECT COUNT(`player_deaths`.`killed_by`) as frags
FROM `player_deaths`
WHERE `player_deaths`.`killed_by` = ' . $db->quote($player->getName()) . '
AND `player_deaths`.`unjustified` = 1

Because TFS 1.2 uses player_deaths table.
Post automatically merged:

Also, change this:

Code:
$frags_enabled = tableExist('player_killers') && $config['characters']['frags'];

To:
Code:
$frags_enabled = tableExist('player_deaths') && $config['characters']['frags'];
So weird that its player_deaths

but im getting
Parse error: syntax error, unexpected 'COUNT' (T_STRING), expecting ')' in C:\xampp\htdocs\system\pages\characters.php on line 130

yousre.png

Code:
    $frags_enabled = tableExist('player_deaths') && $config['characters']['frags'];
    $frags_count = 20;
    if($frags_enabled) {
        $query = $db->query(
            SELECT COUNT(`player_deaths`.`killed_by`) as frags
            FROM `player_deaths`
            WHERE `player_deaths`.`killed_by` = ' . $db->quote($player->getName()) . '
            AND `player_deaths`.`unjustified` = 1
        
        if($query->rowCount() > 20)
        {
            $query = $query->fetch();
            $frags_count = $query['frags'];
        }
    }
 
PHP:
    $frags_enabled = tableExist('player_deaths') && $config['characters']['frags'];
    $frags_count = 20;
    if($frags_enabled) {
        $query = $db->query(
            'SELECT COUNT(`player_deaths`.`killed_by`) as frags
            FROM `player_deaths`
            WHERE `player_deaths`.`killed_by` = ' . $db->quote($player->getName()) . '
            AND `player_deaths`.`unjustified` = 1');
        
        if($query->rowCount() > 20)
        {
            $query = $query->fetch();
            $frags_count = $query['frags'];
        }
    }
 
PHP:
    $frags_enabled = tableExist('player_deaths') && $config['characters']['frags'];
    $frags_count = 20;
    if($frags_enabled) {
        $query = $db->query(
            'SELECT COUNT(`player_deaths`.`killed_by`) as frags
            FROM `player_deaths`
            WHERE `player_deaths`.`killed_by` = ' . $db->quote($player->getName()) . '
            AND `player_deaths`.`unjustified` = 1');
       
        if($query->rowCount() > 20)
        {
            $query = $query->fetch();
            $frags_count = $query['frags'];
        }
    }
Hmm it doesnt work :/

Last Kill page
Player1 died at level 101 by Player2.

Player1 character page
Killed at level 101 by Player2..

But Player2 still have 0 Kills. Tried clearing cache, using different browsers but still zero
 
Are you sure it was unjustified kill? Check in database, table player_deaths, if there is anything with "unjustified" set to 1.
 
Are you sure it was unjustified kill? Check in database, table player_deaths, if there is anything with "unjustified" set to 1.
4eba8d5ce95045c6c404ef1aedb9e084.png
Yes as you can see those two deaths are unjustified and it says killed by Test2 and mostdamage_by Test2
 
Weird, try to paste this into PhpMyAdmin and see if there are any results:

Code:
SELECT COUNT(`player_deaths`.`killed_by`) as frags
            FROM `player_deaths`
            WHERE `player_deaths`.`killed_by` = "Test2"
            AND `player_deaths`.`unjustified` = 1
 
Weird, try to paste this into PhpMyAdmin and see if there are any results:

Code:
SELECT COUNT(`player_deaths`.`killed_by`) as frags
            FROM `player_deaths`
            WHERE `player_deaths`.`killed_by` = "Test2"
            AND `player_deaths`.`unjustified` = 1
Hmm still zero. Maybe its issue with overall characters.php and we editing the wrong code part?
 
Hmm still zero. Maybe its issue with overall characters.php and we editing the wrong code part?
If its zero in phpmyadmin its not the code being edited on the page.
What results does phpmyadmin give when you type that into the SQL query builder.

I just tested this and it sees the 3 frags the tests i made has.
Post an image of the structure and the data tab with all columns for the deaths in question.
 
Where are you looking at the frags?

$frags_count and $frags are two separate functions in characters page
 
Back
Top