diff options
| author | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
|---|---|---|
| committer | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
| commit | 2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1 (patch) | |
| tree | 1c5e6d817c88e67b46e216a50e0aef5428bf63df /scripts/hl.pl | |
| parent | 2d080422d79d1fd49d6c5528593ccaaff9bfc583 (diff) | |
| download | scripts.irssi.org-2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1.tar.bz2 | |
Import scripts from scripts.irssi.org
Diffstat (limited to 'scripts/hl.pl')
| -rw-r--r-- | scripts/hl.pl | 54 | 
1 files changed, 54 insertions, 0 deletions
| diff --git a/scripts/hl.pl b/scripts/hl.pl new file mode 100644 index 0000000..3c28cd9 --- /dev/null +++ b/scripts/hl.pl @@ -0,0 +1,54 @@ +# CopyLeft Riku Voipio 2001 +# half-life bot script +use Irssi; +use Irssi::Irc; +use vars qw($VERSION %IRSSI); + +# header begins here + +$VERSION = "1.2"; +%IRSSI = ( +        authors     => "Riku Voipio", +        contact     => "riku.voipio\@iki.fi", +        name        => "half-life", +        description => "responds to \"!hl counterstrike.server \" command on channels/msg's to query counter-strike servers", +        license     => "GPLv2", +        url         => "http://nchip.ukkosenjyly.mine.nu/irssiscripts/", +    ); + + +$qdir="/home/nchip/qstat/"; + +sub cmd_hl { +        my ($server, $data, $nick, $mask, $target) =@_; +	if ($data=~/^!hl/){ +		@foo=split(/\s+/,$data); +		$len=@foo; +		if ($len==1){ +		    $foo[1]="turpasauna.taikatech.com"; +		} +		#fixme, haxxor protection +		$word=$foo[1]; +		$_=$word; +		$word=~s/[^a-zA-ZäöÄÖ0-9\.]/ /g; +		open(DAT, "$qdir"."qstat -hls ".$word."|"); +		$count=0; +		foreach $line (<DAT>) +		{ +			if ($count==1) +			{ +				$_=$line; +				$line=~s/\s+/ /g; +				#print($line); +				$server->command("/notice ".$target." ".$line); +			} +			$count++; +		} +		close(DAT); +	} +} + +Irssi::signal_add_last('message public', 'cmd_hl'); +Irssi::print("Half-life info bot by nchip loaded."); + + | 
