1 # Nexuiz rcon2irc plugin by Merlijn Hofstra licensed under GPL - joinsparts.pl
2 # Place this file inside the same directory as rcon2irc.pl and add the full filename to the plugins.
3 # Don't forget to edit the options below to suit your needs.
6 irc_announce_joins => 1,
7 irc_announce_parts => 1,
8 irc_show_playerip => 0,
10 irc_show_amount_of_players => 0
13 $store{plugin_joinsparts} = \%pj;
20 for (1 .. $store{slots_max}) {
21 my $id = $store{"playerid_byslot_$_"};
22 $count++ if (defined $id && $store{"playerip_byid_$id"} ne 'bot');
27 # chat: Nexuiz server -> IRC channel, nick set
28 [ dp => q{:join:(\d+):(\d+):([^:]*):(.*)} => sub {
29 my ($id, $slot, $ip, $nick) = @_;
30 my $pj = $store{plugin_joinsparts};
31 $store{"playernickraw_byid_$id"} = $nick;
32 $nick = color_dp2irc $nick;
33 if ($pj->{irc_announce_joins} && !$store{"playerid_byslot_$slot"} && $ip ne 'bot') {
34 out irc => 0, "PRIVMSG $config{irc_channel} :\00309+ join\017: $nick\017" .
35 ($pj->{irc_show_playerip} ? " (\00304$ip\017)" : '') .
36 ($pj->{irc_show_mapname} ? " playing on \00304$store{map}\017" : '') .
37 ($pj->{irc_show_amount_of_players} ? " players: \00304" . (get_player_count()+1) . "\017/$store{slots_max}" : '');
41 # Record parts so the info in $store is always up to date
42 [ dp => q{:part:(\d+)} => sub {
44 my $pj = $store{plugin_joinsparts};
45 if ($pj->{irc_announce_parts} && defined $store{"playernick_byid_$id"} && $store{"playerip_byid_$id"} ne 'bot') {
46 out irc => 0, "PRIVMSG $config{irc_channel} :\00304- part\017: " . $store{"playernick_byid_$id"} . "\017" .
47 ($pj->{irc_show_playerip} ? " (\00304" . $store{"playerip_byid_$id"} . "\017)" : '') .
48 ($pj->{irc_show_mapname} ? " playing on \00304$store{map}\017" : '') .
49 ($pj->{irc_show_amount_of_players} ? " players: \00304" . (get_player_count()-1) . "\017/$store{slots_max}" : '');
51 my $slot = $store{"playerslot_byid_$id"};
52 $store{"playernickraw_byid_$id"} = undef;
53 $store{"playernick_byid_$id"} = undef;
54 $store{"playerip_byid_$id"} = undef;
55 $store{"playerslot_byid_$id"} = undef;
56 $store{"playerid_byslot_$slot"} = undef;