Possible to log PvP kills?
-
Syntax42 wrote:
[PvPLogger]
logfile = pvplogi just noticed you have the section listed as [PvPLogger]
change that to [PvPLog] -
LOL my bad…typo’d something in there (not causing your error though)
plugin_register { name => 'pvplogger', author => 'Fenris_Wolf', version => '1.0', date => '12/27/2009', description => 'logs pvp kills to a file' }, undef, { 'kill' => sub{ my $e = shift; return undef unless $e->{type} eq 'player'; my $system = psystem plid('char',$e->{killer}); my $t = localtime(); open FILE, '>>', $Options->{pvplog}{logfile} or return undef; print FILE "$t - System: $system Killer: $$e{killer} Victim: $$e{victim}\n"; close FILE; } }; 1;
double checked the rest of the code should be fine
-
DeathMsgTextPlayerKill=Death: %victim was killed by %killer (%type)
from flhook.ini
Its either 1.6.0 or 1.5.9.
The log file you expected output to is empty.I can get rid of the death message customization if that’s what it takes to make this work.
[PvPLogger] was fixed and I got the same error.
-
heh ya the empty file was due to my typo >.<
-
that shouldnt be…delete the file and try again (if the file reappears, something should get printed, if not its printing somewhere else)
# this line creates/opens the file in write mode, if it cant, it exits (you wouldnt see a error from the next line) open FILE, '>>', $Options->{pvplog}{logfile} or return undef; print FILE "$t - System: $system Killer: $$e{killer} Victim: $$e{victim}\n"; close FILE;
the $Options->{pvplog}{logfile} which points to your config ini, specifically the:
[PvPLog]
logfile = pvplog.logyou could also take the raw eventmode text and print that in case the msgs have been customized
print FILE "$$e{event_text}\n";
-
plugin_register { name => 'pvplogger', author => 'Fenris_Wolf', version => '1.0', date => '12/27/2009', description => 'logs pvp kills to a file' }, undef, { 'kill' => sub{ my $e = shift; open FILE, '>>', $Options->{pvplog}{logfile} or return undef; print FILE "$$e{event_text}\n"; close FILE; } }; 1;
and the log file had
victim=killarr type=suicide
victim=targetpractice type=player by=killarrGood enough for what I want. I can parse that manually and only turn it on when I need it. PvE deaths may be included in my server’s system anyways.
-
interesting….the error msg was apparently in the a bug programs core
it was looking at the line likevictim=* type=* killer=* ```should have been
victim=* type=* by=*
-
there fixed and uploaded new version, the original script (without typo lol) should work ok now
tyvm for being guinea pig LOL -
plugin_register { name => 'pvplogger', author => 'Fenris_Wolf', version => '1.0', date => '12/27/2009', description => 'logs pvp kills to a file' }, undef, { 'kill' => sub{ my $e = shift; my $system = psystem plid('char',$e->{victim}); my $t = localtime(); open FILE, '>>', $Options->{pvplog}{logfile} or return undef; if ($e->{type} eq 'player') { print FILE "$t - System: $system Killer: $$e{killer} \tVictim: $$e{victim}\n"; } else { print FILE "$t - System: $system Killer: $$e{type} \tVictim: $$e{victim}\n"; } close FILE; } }; 1;
I made a small change so it would log both PvP and PvE kills without giving an error. Also, the system had to be changed to the victim’s instead of the killer’s.