Jump to content

[HowTo] Website KillBoard


Jacen

Recommended Posts

I'm currently looking for a way to setup a website killboard. If you guys are interested in helping me out I'll do the website/graphic side if you can do the server sided things, I presume it's just importing things from the database and progressing them on the page. If you have any experience let me know I'd gladly let you take my design and publicly give it away for free, or if your looking to just use it yourself.

Link to comment
Share on other sites

He is new to the site dont give him a attitude with wrong section just help the guy out if you can...or maybe not that i have learnt the hard way with you from another site....

 

Maybe just short and straight to the point instead of:

 

Hi Jacen you appear to be a new member so I will try not to be rude but you have posted this is the wrong section. Please post any of your questions in the Scripting help forum and not in the Epoch mods section.

 

:D

Link to comment
Share on other sites

You can do this one of two ways depending on what information you want to see. 

 

If you want detailed data similar to what is displayed in game (Ethan was killed by TheOneWhoKnocks with weapon G36C_camo from 1.71568m) then you will need your webserver to reside on the same host as your game server to be able to access the rpt file.  Note that the PKILLS in the report file are sketchy sometimes and don't always register.  Players killed by zombies are are displayed on the murder boards as killed by Nil and the report file just shows it as the player killing themselves or other weird things.

 

If you just want to show a list of players who died in a given time frame, you can query your mysql tables character_data and list any players where alive=0.  This give less data, but is easy to parse than the rpt file.  If you purge dead characters from your tables, then that could be a issue as well.

 

I've setup a statistics page for my server.  It shows a kill feed that parses the rpt file and picks out lines with PKILL in it.  The feed only parses the current report file (mine rotates about every 24 hours) so you can't go back any further than that.

 

There are other statistics I extract from the database tables for top daily, weekly and all time players based on a number of different things.  This is all written in PHP.

 

http://blackheartsgaming.com/dayzplayerstats.php

Link to comment
Share on other sites

You can do this one of two ways depending on what information you want to see. 

 

If you want detailed data similar to what is displayed in game (Ethan was killed by TheOneWhoKnocks with weapon G36C_camo from 1.71568m) then you will need your webserver to reside on the same host as your game server to be able to access the rpt file.  Note that the PKILLS in the report file are sketchy sometimes and don't always register.  Players killed by zombies are are displayed on the murder boards as killed by Nil and the report file just shows it as the player killing themselves or other weird things.

 

If you just want to show a list of players who died in a given time frame, you can query your mysql tables character_data and list any players where alive=0.  This give less data, but is easy to parse than the rpt file.  If you purge dead characters from your tables, then that could be a issue as well.

 

I've setup a statistics page for my server.  It shows a kill feed that parses the rpt file and picks out lines with PKILL in it.  The feed only parses the current report file (mine rotates about every 24 hours) so you can't go back any further than that.

 

There are other statistics I extract from the database tables for top daily, weekly and all time players based on a number of different things.  This is all written in PHP.

 

http://blackheartsgaming.com/dayzplayerstats.php

 

This looks great. Would you share it? =)

Link to comment
Share on other sites

  • 2 weeks later...

We Use Linux Commands to copy Kill Logs from RPT to a html file on the same server.

 

Do you have a dedicated server?

 

You might be able to do this.

 

http://ghostzgamerz.com/kill-board/

I'd love to know how this was setup, sorry for the late reply.

I'll be purchasing a Dedi soon, meaning the answer is yes. Currently I have a test server on Vilayer simply for a testing purpose.

Link to comment
Share on other sites

I'd love to know how this was setup, sorry for the late reply.

I'll be purchasing a Dedi soon, meaning the answer is yes. Currently I have a test server on Vilayer simply for a testing purpose.

 

I used cygwin, Google it and download it in your dedi. Then you will be able to use linux commands that will get text from the RPT and it will put it in a txt in your web server.

Link to comment
Share on other sites

[HowTo]

How to use a forum would be better!

Connect to via php to the db, select character_data and give out the values.

How to enough?

 

Would you like me to teach you how to use a forum? Being a MyBB forum developer I think I know how asshole.

If the staff had a problem, or we're active they'd "Know how to use a forum" and move my thread to the appropriate section.

Link to comment
Share on other sites

Would you like me to teach you how to use a forum? Being a MyBB forum developer I think I know how asshole.

If the staff had a problem, or we're active they'd "Know how to use a forum" and move my thread to the appropriate section.

 

That should not belong in EpochMod.com Forums. Please find another Forums for this question

Link to comment
Share on other sites

OK so I'm going to boil down how to do this into simple steps that you can take to learn how to do this.

 

 

Step 1.  Look up and get a basic understanding of regular expressions.   Short summary, they are what some programmers call "black magic".  Regex or regular expressions are used to look up patterns in strings.  You can use regex to grab sections of strings in a log line by line and pull out the useful info.

 

Step 2.  Learn to use Grep or another regex search tool.  Grep will most likely be what you are going to use as it is GNU and included in almost every single linux web server.  Almost all web servers are linux so this is pretty key.

 

Step 3.  Learn PHP or some other sort of language to dynamically create a HTML page.  Not going to go into semantics but basically this is a server side language that lets you run code server side and display the results in raw HTML (or javascript).

 

 

So here's what I'm doing.

 

1.  Use grep to pull out relevant lines from the log file

grep -i -r 'infiSTAR.de Log:.*UNLOCK' /media/dayz/instance_11_Chernarus_vp/ > /var/www/html/dayzlogs/unlocks.txt

2.  Use regex with PHP to parse out the different parts of the log that we actually want.

 

3.  Using the same PHP script, generate a basic table of events to display.

 

 

(2 and 3)

<?php

if ($_GET['parse']) {

} else {

        $handle = fopen("/var/www/html/dayzlogs/unlocks.txt","r");

        if ($handle) {
                        echo "<table border=1>";
                        echo "<tr>";
                        echo "<td>fileName</td>";
                        echo "<td>time</td>";
                        echo "<td>type</td>";
                        echo "<td>id</td>";
                        echo "<td>uid</td>";
                        echo "<td>name</td>";
                        echo "<td>playerUID</td>";
                        echo "<td>gps</td>";
                        echo "<td>code</td>";
                        echo "</tr>";

                while(($buffer = fgets($handle, 4096)) !== false){
                //      echo $buffer;
                        $pattern = '/^(?<File>.*\.RPT):(?<Time>[0-9][0-9]:[0-9][0-9]:[0-9][0-9])\s"infiSTAR.de Log:\s(?<Type>[a-zA-Z ]*):\sID:(?<ID>[0-9]+).*UID:(?<UID>[0-9]+)\sBY(?<Name>.*)\((?<PlayerUID>[0-9]+)\)\s@?(?<GPS>[0-9]+)\s*(Code Entered:\s?)?(?<Code>[0-9]*)?.*$/m';
                        preg_match($pattern, $buffer, $matches, PREG_OFFSET_CAPTURE);
                        $fileName  = $matches[1][0];
                        $time      = $matches[2][0];
                        $type      = $matches[3][0];
                        $id        = $matches[4][0];
                        $uid       = $matches[5][0];
                        $name      = $matches[6][0];
                        $playerUID = $matches[7][0];
                        $gps       = $matches[8][0];
                        $code      = $matches[10][0];
                        if (!empty($fileName)) {
                                echo "<tr>";
                                echo "<td>$fileName</td>";
                                echo "<td>$time</td>";
                                echo "<td>$type</td>";
                                echo "<td>$id</td>";
                                echo "<td>$uid</td>";
                                echo "<td>$name</td>";
                                echo "<td>$playerUID</td>";
                                echo "<td>@$gps</td>";
                                echo "<td>$code</td>";
                                echo "</tr>";
                        }
                }
                if (!feof($handle)) {
                        echo "ERROR";
                }
                fclose($handle);
                echo "</table>";
        }
}

?>


And this is the end result, note I've blacked out the sensitive information here.

 

BZi4gMi.png

Link to comment
Share on other sites

<?php
$file = 'C:\wamp\www\Killboard\EPChernarus1\PhitLog.txt';
$searchfor = 'Chernarus';
   header('Content-Type: text/html');
   $contents = file_get_contents($file);
$contents = str_replace("(DayzNorway)", "(DayZNorway.com)", $contents);

   $pattern = preg_quote($searchfor, '/');
$contents = str_replace("DayZ Instance: 11", " Map: Chernarus ", $contents);
   $pattern = "/^.*$pattern.*$/m";
$contents = str_replace("PKILL", "Player Killed", $contents);
$contents = str_replace("CLOG", "Combat Logged", $contents);

if(preg_match_all($pattern, $contents, $matches)){
echo "<strong>";
   echo "<div style ='font:11px/21px Arial,tahoma,sans-serif;color:#2983CB'>Killboard Epoch Chernarus: <br>";
echo '', implode(" <br>", $matches[0]);
echo "</strong>";
   }
else 
{
echo "No kills yet. Looks like everyone is playing nice.";
   }
?>

 

Hey guys, my killboard looks like this. But i need some help here.

I am trying to make it use array_reverse to read it in descending order, this to get the newest kills at the top.

 

I couldnt make it work unfortunately. Could someone clean up the code and make it in descending order for me?

I am sure those str_replace functions can be done in a cleaner way than i did it in  :P

 

Kimz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...