changed icon for carrying flag + psd
[divverent/nexuiz.git] / server / rcon2irc / fastest_lap.pl
1 sub out($$@);
2 use POSIX qw(ceil floor);
3         # chat: Nexuiz server -> IRC channel, fastest record in nexrun and ctf
4         [ dp => q{:recordset:(\d+):(.*)} => sub {
5                 my ($id, $record) = @_;
6                 my $recordnick = $id ? $store{"playernick_byid_$id"} : "(console)";
7                 my $minutes = $record/60;
8                 my $seconds = $record%60;
9                 my $ms = int(($record - floor($record))*1000000);
10                 my $time;
11                 if($seconds < 1) {
12                         $time = "\003040:0.$ms";
13                 } elsif($minutes < 1) {
14                         $time = "\003040:$seconds.$ms";
15                 } else {
16                         $time = "\00304$minutes:$seconds.$ms";
17                 }
18                 my $mapname = $store{"map"};
19                 if ($mapname =~ m/^ctf_/) {
20                         out irc => 0, "PRIVMSG $config{irc_channel} :* \00304$recordnick\017 set the \00304all-time fastest flag capture \00304record\017 with $time ($mapname)";
21                 } else {
22                         out irc => 0, "PRIVMSG $config{irc_channel} :* \00304$recordnick\017 set the \00304all-time fastest lap \00304record\017 with $time ($mapname)";
23                 }
24                 return 0;
25         } ],