]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
fix a few minor bugs
authormerlijn <mhofstra@gmail.com>
Sun, 22 Aug 2010 17:45:10 +0000 (19:45 +0200)
committermerlijn <mhofstra@gmail.com>
Sun, 22 Aug 2010 17:45:10 +0000 (19:45 +0200)
server/rcon2irc/votestop.pl

index b6f2d69ec6871af2b641f23dcab36d7b6dd16323..1a17ac8e351f5806e38025c0e14fbde2184e4d40 100644 (file)
@@ -13,7 +13,7 @@
 $store{plugin_votestop} = \%vs; }
 
 # add a dependency on joinsparts.pl
 $store{plugin_votestop} = \%vs; }
 
 # add a dependency on joinsparts.pl
-if (defined %config && $config{plugins} !~ m/joinsparts.pl /gi) {
+if (defined %config && $config{plugins} !~ m/joinsparts\.pl/gi) {
        die "votestop.pl depends on joinsparts.pl but it appears to not be loaded.";
 }
 
        die "votestop.pl depends on joinsparts.pl but it appears to not be loaded.";
 }
 
@@ -60,13 +60,15 @@ sub time_to_seconds {
        }
        
        $vs->{currentvote} = $id;
        }
        
        $vs->{currentvote} = $id;
+       $vs->{command} = $command;
        return 0;
 } ],
 
 [ dp => q{:vote:v(yes|no|timeout|stop):.*} => sub {
        my ($cmd) = @_;
        return 0;
 } ],
 
 [ dp => q{:vote:v(yes|no|timeout|stop):.*} => sub {
        my ($cmd) = @_;
-       $store{plugin_votestop}->{currentvote} = undef;
        my $vs = $store{plugin_votestop};
        my $vs = $store{plugin_votestop};
+       $vs->{currentvote} = undef;
+       $vs->{command} = undef;
        
        if ($cmd eq 'stop' && $vs->{vstopignore}) {
                $vs->{vstopignore} = undef;
        
        if ($cmd eq 'stop' && $vs->{vstopignore}) {
                $vs->{vstopignore} = undef;
@@ -80,10 +82,11 @@ sub time_to_seconds {
        my ($id) = @_;
        my $vs = $store{plugin_votestop};
        
        my ($id) = @_;
        my $vs = $store{plugin_votestop};
        
-       if (defined $store{plugin_votestop}->{currentvote} && $id == $store{plugin_votestop}->{currentvote}) {
+       if (defined $vs->{currentvote} && $id == $vs->{currentvote}) {
                $vs->{vstopignore} = 1;
                out dp => 0, "sv_cmd vote stop";
                $vs->{vstopignore} = 1;
                out dp => 0, "sv_cmd vote stop";
-               out irc => 0, "PRIVMSG $config{irc_channel} :* vote \00304$command\017 by " . $store{"playernick_byid_$id"} .
+               out dp => 0, "say Vote was stopped as player left the server";
+               out irc => 0, "PRIVMSG $config{irc_channel} :* vote \00304" . $vs->{command} . "\017 by " . $store{"playernick_byid_$id"} .
                        "\017 was stopped because he left the server";
        }
        
                        "\017 was stopped because he left the server";
        }
        
@@ -93,9 +96,10 @@ sub time_to_seconds {
 [ dp => q{:gamestart:(.*):[0-9.]*} => sub {
        my $vs = $store{plugin_votestop};
        
 [ dp => q{:gamestart:(.*):[0-9.]*} => sub {
        my $vs = $store{plugin_votestop};
        
-       if (defined $store{plugin_votestop}->{currentvote}) {
+       if (defined $vs->{currentvote}) {
                out dp => 0, "sv_cmd vote stop";
                out dp => 0, "sv_cmd vote stop";
-               $store{plugin_votestop}->{currentvote} = undef;
+               $vs->{currentvote} = undef;
+               $vs->{command} = undef;
                $vs->{vstopignore} = undef;
        }
        
                $vs->{vstopignore} = undef;
        }