PvP rank kill counter

Results 1 to 10 of 10
  1. #1
    Proficient Member comper is offline
    MemberRank
    Sep 2011 Join Date
    151Posts

    cool PvP rank kill counter

    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.


  2. #2
    Account Upgraded | Title Enabled! markmark is offline
    MemberRank
    Aug 2006 Join Date
    217Posts

    Re: PvP rank kill counter

    Plese share PvP rank kill counter
    Mssql

    Thank.

  3. #3
    Enthusiast coolbeansdude is offline
    MemberRank
    Jul 2013 Join Date
    46Posts

    Re: PvP rank kill counter

    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:



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

  4. #4
    Proficient Member comper is offline
    MemberRank
    Sep 2011 Join Date
    151Posts

    Re: PvP rank kill counter

    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 &

  5. #5
    Enthusiast coolbeansdude is offline
    MemberRank
    Jul 2013 Join Date
    46Posts

    Re: PvP rank kill counter

    Quote Originally Posted by comper View Post
    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?

  6. #6
    Proficient Member comper is offline
    MemberRank
    Sep 2011 Join Date
    151Posts

    Re: PvP rank kill counter

    Best way is to copy from your /rain folder to temporarly location.

  7. #7
    Enthusiast coolbeansdude is offline
    MemberRank
    Jul 2013 Join Date
    46Posts

    Re: PvP rank kill counter

    Quote Originally Posted by comper View Post
    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?

  8. #8
    Proficient Member comper is offline
    MemberRank
    Sep 2011 Join Date
    151Posts

    Re: PvP rank kill counter

    /viewer is just temporarly folder.

  9. #9
    Enthusiast coolbeansdude is offline
    MemberRank
    Jul 2013 Join Date
    46Posts

    Re: PvP rank kill counter

    Quote Originally Posted by comper View Post
    /viewer is just temporarly folder.

    ./gdb gdb.conf listrole > /viewer/Logs/listrole.log 2>&1 &


    where is this located then?

    ive never seen a file called: gdb or gdb.conf

  10. #10
    Novice XueWu is offline
    MemberRank
    Mar 2014 Join Date
    1Posts

    Re: PvP rank kill counter

    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?



Advertisement