Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

PvP rank kill counter

Junior Spellweaver
Joined
Sep 3, 2011
Messages
150
Reaction score
94
Its just script to calculate kills and save to MySQL.

Table structure:
table name: kills
Code:
CREATE TABLE IF NOT EXISTS `kills` (
  `time` int(11) NOT NULL,
  `corpseid` int(22) NOT NULL,
  `killerid` int(22) NOT NULL,
  `type` tinyint(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

PHP file which saves to MySQL:
saver.php
Code:
<?php 
mysql_connect("localhost","user","pass"); //to change
mysql_select_db("db"); //to change

$tmp=mysql_query("SELECT `time` FROM `kills` ORDER BY `time` DESC LIMIT 1");
$last_time=mysql_fetch_row($tmp);

$file = file("/home/rain/logs/kills.formatlog"); //logs folder
foreach($file as $f){ 
        $a = strpos($f, "die:roleid")+11; 
	$time=substr($f,0,19);
	$time=explode(' ',$time);
	$tim1=explode('-',$time[0]);
	$tim2=explode(':',$time[1]);
	$tim=mktime($tim2[0], $tim2[1], $tim2[2], $tim1[1], $tim1[2], $tim1[0]);
	$data=substr($f,$a);
	$data=str_replace('type=','',$data);
	$data=str_replace('attacker=','',$data);
	$data=explode(':',$data);
	if($data[1]==2) $data[2]=0;
	if($tim>$last_time[0]) mysql_query("INSERT INTO `kills` (`time`, `corpseid`,`killerid`,`type`) VALUES ('$tim', '$data[0]','$data[2]','$data[1]')");
}
?>

Sh file which reads logs:
rank.sh
Code:
#!/bin/sh
cd /home/rain/logs
grep -e ':die:' world2.formatlog > kills.formatlog
chmod 777 kills.formatlog
/opt/lampp/bin/php -f /root/saver.php >> ranklogfile.txt 2>&1
rm kills.formatlog

eg for crontab:
Code:
0          *       *       *       *       root   /auto60/rank.sh

If u set if right, ull get all kills saved in database.
It also remembers last kill date so it works even if you remove old log files.
 
Newbie Spellweaver
Joined
Jul 11, 2013
Messages
46
Reaction score
5
Well im pretty stumped on this, I tried jsp and it did not work,
I looked at a few releases and could not find any answers either. So this is where im stuck at:

XLOoM2E - PvP rank kill counter - RaGEZONE Forums


so how do i now go from the killerid to an actual Character Name so i can display it on a web page?
 

Attachments

You must be registered for see attachments list
Junior Spellweaver
Joined
Sep 3, 2011
Messages
150
Reaction score
94
Hmm, you need to export listrole from game data base - gdbunique and save to MySQL.

command example:
Code:
cd /viewer/gdbunique
./gdb gdb.conf listrole > /viewer/Logs/listrole.log 2>&1 &
 
Newbie Spellweaver
Joined
Jul 11, 2013
Messages
46
Reaction score
5
Hmm, you need to export listrole from game data base - gdbunique and save to MySQL.

command example:
Code:
cd /viewer/gdbunique
./gdb gdb.conf listrole > /viewer/Logs/listrole.log 2>&1 &

where do i get gdbu at?
 
Newbie Spellweaver
Joined
Jul 11, 2013
Messages
46
Reaction score
5
Hmm, you need to export listrole from game data base - gdbunique and save to MySQL.

command example:
Code:
cd /viewer/gdbunique
./gdb gdb.conf listrole > /viewer/Logs/listrole.log 2>&1 &

I dont have a viewer, can you send that to me?
 
Initiate Mage
Joined
Mar 3, 2014
Messages
1
Reaction score
0
I hate to necro old Threads, but since it wasn't asked; Do you have a script that can fetch this data and echo it into a php file?
 
Back
Top