Jump to content

[PHP] Live kill feed


Defent

Recommended Posts

Whats up with them? I have no probs so far.

 

  On 5/27/2014 at 1:47 AM, CommanderRetra said:

if you cancel your service with them and buy a dedi it will work. Seriously. Just don't use Survival Servers.

Link to comment
Share on other sites

 
  On 5/21/2014 at 1:50 AM, RimBlock said:

Setup a shared drive on the webserver where you would like the file to stay.

 

Create a new limited access user account that can be used to login to that share.  Make sure the account is not having any access to the game server.

 

Mount the shared drive on you game server (using the restricted access account). 

 

Setup a batchfile to run robocopy to sync the gameserver rpt with the remote share location (push from game server to webserver for security reasons).

 

Use Windows task schedular to run the batch file automatically every XXX minutes.

 

Any way to go more indepth with how to do this? My website is CentOS 6.5 x64 so not sure if I can make a shared drive.

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...
  • 2 months later...

A while ago I asked Defent's permission to make a completely new version of his PHP killfeed script. He gave me the permission. I almost completed it but other important things got in the way and I haven't been able to come back to the script ever since. It is working perfectly as it should but it's lacking some features I was planning to make. So anyway, I'm releasing it pre-maturely in this topic instead of making it a new release (since it's not as complete as I would like it to be).

 

Download files here!

 

Installation is quite simple. Open up killfeed.php and at the top of the file there are configuration variables that you need to change. After you're done, save the file and place all files anywhere on your web server and access killfeed.php from your browser. Note! There is only 1 difficulty with this though. The PHP files and the RPT log file must be in the same server. So for people with rented hosting this might be difficult. 

 

You can see the script running here: http://dayz.kriba.ee/ (scroll down, under shoutbox)

For this particular example I have Overpoch and the PHP files running on the same server but the website (dayz.kriba.ee) is on a different server. So I installed WAMP on my Overpoch server and made killfeed.php publicly available via http. Then I added a simple iframe script on my website's server like so: 

<iframe src="http://your_servers_ip/killfeed.php" style="border: 0px" width="940px" height="150"></iframe>

So what is this script? It's just more-complex and much more easy to customize. It has more features and is more bulletproof. With Defent's original version I found that if you have a killfeed message like so:

 

[time] Player1 killed Player2 with weapon DMR from distance 100 meters.

 

And if, for example, Player2 would change his name to something like "with weapon DMR" all sorts of crap would go down. This is fixed now as long as the server doesn't allow quotation marks in player's name.

Some other features include:

  • Fully customizable killfeed string: [%time] <b>%victim</b> was killed by <b>%killer</b> with weapon <b>%weapon</b> from distance <b>%distance</b> meters.
  • Limit the number of lines displayed
  • Hide/show suicides
  • Round up the distance number, so you don't get 100.3423432 meters
  • Switch time between AM/PM and 24-hour format
  • You can remove "seconds" from time
  • And last but not least - replaces all class names with real names (e.g Mk_48_DZ = Mk 48 mod 0) and yes, it does include Overwatch weapons

 

One thing I should note though. The class name list doesn't have ALL weapons. There are probably some still missing. Some might not be 100% accurate as well. For example "M240_Scoped_DZ" might actually not be "M240 Scoped", instead just "M240". I grabbed as many weapons class name lists from the interwebs as I could.

 

Adding new class names for replacement is very simple. Open up killfeed_weapon_classnames.php and killfeed_weapon_cleannames.php and just add a new variable at the bottom of the file (before PHP's closing brackets ?> of course). But make sure the line numbers match up from class names file and clean names file. Otherwise it replaces the weapon's name with something else. Also remember not to add any quotation marks (") in the clean names.

 

killfeednames.jpg

 

(Line numbers must match)

 

 

Originally I had lots of plans for this script like replacing the gun names with actual images, showing how many bullets it took to kill the victim, generating statistics on who kills who the most, etc etc. I also wanted to include theballin7's DLL for this script instead of using the RPT log file but he never responed to my letters so I went with the log file.

 

 

Edit// For all of you code-wizards out there who just want to see the code, here's the main file killfeed.php:

  Reveal hidden contents

Edited by Rocu
Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
  On 4/17/2014 at 11:39 PM, zerew said:

 

My code, all kills.

<?php
$file = 'C:\dayz\server\instance_11_Chernarus\arma2oaserver.RPT';
$searchfor = 'PKILL:';

    header('Content-Type: text/plain');
    $contents = file_get_contents($file);

    $pattern = preg_quote($searchfor, '/');

    $pattern = "/^.*$pattern.*$/m";

  if(preg_match_all($pattern, $contents, $matches)){
     echo "Kill list: 
 ";
     echo implode(" ", $matches[0]);
     }
  else {
     echo "Not Kills!";
       }

 ?>

 

How do I make this print in white text?

This is the reason why I ask:http://ndz.no/index.php/killboard-showall

Link to comment
Share on other sites

  On 2/9/2015 at 10:09 PM, buck said:

How do I make this print in white text?

This is the reason why I ask:http://ndz.no/index.php/killboard-showall

 

Got a new code now

<?php
$file = 'C:\Epoch server\instance_11_Chernarus\arma2oaserver.RPT';
$searchfor = 'PKILL:';

    header('Content-Type: text/html');
    $contents = file_get_contents($file);

    $pattern = preg_quote($searchfor, '/');

    $pattern = "/^.*$pattern.*$/m";

  if(preg_match_all($pattern, $contents, $matches)){
     echo "<div style ='font:11px/21px Arial,tahoma,sans-serif;color:#ffffff'>Killboard: <br>";
     echo '', implode(" <br>", $matches[0]);
     }
  else {
     echo "Not Kills!";
       }

 ?>

Green = changes...

 

I got no </div> wherever I place it - it fails, but now it works... are there any problems with not closing the div?

Link to comment
Share on other sites

  • 3 years later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...