Not my first mIRC script, but the first I released with this account.
Script currently only logs for one channel for simplicity's sake.
If you can figure out a way around this, please let me know. :)
Commands:
!lookup [string with wildcards] - Advanced display of matching nicknames and hosts. Typing an exact or close nick will also list any duplicates.
!watch [nick/host] [notes] - Watches for the nick or host in the channel and sends the requester a memo with details if the person is seen.
!tell [nick/host] [message] - Basically a memoserv, but also works for unregistered nicks. Only sends the message once.
!owatch [nick/host] [notes] - Watches for the nick or host in the channel and sends an onotice with details if the person is seen.
!unwatch [nick/host] - Removes any watches on the nick.
The hostmasks for all commands except !lookup should be in !@host.ext format.
Changelog:
--V0.9--
-Converted from ini to hash tables for the main parts
-Watch.ini still uses an ini file because it stores a bit more information
-Added comment info with some advanced options
;Hastmask/nick database and checker
;Made by Hello2u
;Version 0.9
;Feel free to edit and repost or whatever, but please give credit in comments, like this does
;------------------------------
;Commands:
;!lookup [string with wildcards] - Advanced display of matching nicknames and hosts. Typing an exact or close nick will also list any duplicates.
;!watch [nick/host] [notes] - Watches for the nick or host in the channel and sends the requester a memo with details if the person is seen.
;!tell [nick/host] [message] - Basically a memoserv, but also works for unregistered nicks. Only sends the message once.
;!owatch [nick/host] [notes] - Watches for the nick or host in the channel and sends an onotice with details if the person is seen.
;!unwatch [nick/host] - Removes any watches on the nick.
;------------------------------
;The bot can give certain output to a channel, but there currently isn't a dialog or option for it. If you want to try it, set %opchan to the output channel.
;This update will use new tables, so the old hosts.ini is no longer supported. There is some commented lines for it though.
-------------------------------
on *:START: {
/hmake hosts 100
/hmake nicks 100
/hload hosts hosts.hsh
/hload nicks nicks.hsh
}
on *:LOAD: {
if (%checkchan == $null) set %checkchan $$?="Main channel?"
if (%whitelist == $null) set %whitelist $$?="Whitelisted nicknames? (Seperated by comma)"
if (%hostwl == $null) set %hostwl $$?="Whitelisted hostsmasks? (Seperated by comma)"
/hmake hosts 100
/hmake nicks 100
/hsave hosts hosts.hsh
/hsave nicks nicks.hsh
}
on *:Join:%checkchan:{
if ($readini(watch.ini,$address($nick,2),requester) != $null) {
if ($readini(watch.ini,$address($nick,2),type) == notice) {
onotice # $nick is being watched! Notes: $readini(watch.ini,$address($nick,2),notes) $+ . Use !unwatch [host] to stop recieving these messages.
}
elseif ($readini(watch.ini,$address($nick,2),type) == tell) {
notice $nick $readini(watch.ini,$address($nick,2),requester) says: " $+ $readini(watch.ini,$address($nick,2),messege) $+ "
ms send $readini(watch.ini,$address($nick,2),requester) $nick has been told $readini(watch.ini,$address($nick,2),messege) $+ .
remini watch.ini $address($nick,2)
}
elseif ($readini(watch.ini,$address($nick,2),type) == bind) {
if ($nick != $readini(watch.ini,$address($nick,2),fnick) && $remove($nick,_) != $readini(watch.ini,$address($nick,2),fnick)) {
if ($readini(watch.ini,$address($nick,2),muted) != yes) {
cs quiet # $address($nick,2)
writeini watch.ini $address($nick,2) muted yes
if (%opchan != $null) msg %opchan $nick has been muted because he should be using $readini(watch.ini,$address($nick,2),fnick) according to $readini(watch.ini,$address($nick,2),requester) $+ .
notice $nick You are muted in this channel because you are not using your forum nick or an approved alt. Please type /nick $readini(watch.ini,$address($nick,2),fnick) or type /join #fc-help for assistance.
cs kick # $nick Please come back as $readini(watch.ini,$address($nick,2),fnick)
}
elseif ($readini(watch.ini,$address($nick,2),muted) == yes) {
notice $nick Like I said, you MUST come back as $readini(watch.ini,$address($nick,2),fnick) to talk.
notice $nick If you have trouble, please join #fc-help
}
else {
echo Error! Watch file for $nick is corrupt!
}
}
else {
if ($readini(watch.ini,$address($nick,2),muted) == yes) {
cs unquiet # $address($nick,2)
writeini watch.ini $address($nick,2) muted no
}
}
}
else {
ms send $readini(watch.ini,$address($nick,2),requester) $nick came in with host $address($nick,2) at $asctime(hh:nn:ss) $+ . Notes: $readini(watch.ini,$address($nick,2),notes) $+ . Use !unwatch [host] to stop recieving these messages.
if (%opchan != $null) msg %opchan $nick came in with host $address($nick,2) which is being watched by $readini(watch.ini,$address($nick,2),requester) at $asctime(hh:nn:ss) $+ . Notes: $readini(watch.ini,$address($nick,2),notes) $+ . Use !unwatch [host] to stop recieving these messages.
}
echo $nick came in with host $address($nick,2) $+ . Notes: $readini(watch.ini,$address($nick,2),notes)
}
elseif ($readini(watch.ini,$nick,requester) != $null) {
if ($readini(watch.ini,$nick,type) == notice) {
onotice # $nick is being watched! Notes: $readini(watch.ini,$nick,notes) $+ . Use "!unwatch $nick $+ " to stop recieving these messages.
}
elseif ($readini(watch.ini,$nick,type) == tell) {
notice $nick $readini(watch.ini,$nick,requester) says: " $+ $readini(watch.ini,$nick,messege) $+ "
ms send $readini(watch.ini,$nick,requester) $nick has been told " $+ $readini(watch.ini,$nick,messege) $+ ."
remini watch.ini $nick
}
else {
ms send $readini(watch.ini,$nick,requester) $nick came in with host $address($nick,2) which is being watched. Notes: $readini(watch.ini,$nick,notes) $+ . Use "!unwatch $nick $+ " to stop recieving these messages.
if (%opchan != $null) msg %opchan $nick came in with host $address($nick,2) which is being watched by $readini(watch.ini,$nick,requester) $+ . Notes: $readini(watch.ini,$nick,notes) $+ . Use "!unwatch $nick $+ " to stop recieving these messages.
}
echo $nick came in with host $address($nick,2) $+ . Notes: $readini(watch.ini,$nick,notes)
}
if ($address($nick,2) isin %HostWL) halt
if ($nick !isin $hget(nicks,$address($nick,2)) ) {
hadd nicks $address($nick,2) $hget(nicks,$address($nick,2)) $+ $nick $+ ,
hsave -o nicks nicks.hsh
}
if ($address($nick,2) !isin $hget(hosts,$nick)) {
hadd hosts $nick $hget(hosts,$nick) $+ $address($nick,2) $+ ,
hsave -o hosts hosts.hsh
}
if ($nick !isin %whitelist && $+(*,$chr(44),*,$chr(44),*) iswm $hget(nicks,$address($nick,2))) { ;multiple nicks
if (%opchan != $null) msg %opchan $nick is also known as: $remove($hget(nicks,$address($nick,2)),$nick $+ $chr(44))
else onotice %checkchan $nick is also known as: $remove($hget(nicks,$address($nick,2)),$nick $+ $chr(44))
}
}
on *:NICK: {
if ($readini(watch.ini,$address($newnick,2),type) == bind) {
if ($newnick != $readini(watch.ini,$address($newnick,2),fnick)) {
cs quiet %checkchan $address($newnick,2)
writeini watch.ini $address($newnick,2) muted yes
if (%opchan != $null) msg %opchan $newnick has been muted because he should be using $readini(watch.ini,$address($newnick,2),fnick) according to $readini(watch.ini,$address($newnick,2),requester) $+ .
notice $newnick You are muted in this channel because you are not using your forum nick or an approved alt. Please come back as $readini(watch.ini,$address($nick,2),fnick) or type /join #fc-help for assistance.
cs kick %checkchan $newnick Please come back as $readini(watch.ini,$address($newnick,2),fnick)
}
}
if ($readini(watch.ini,$newnick,requester) != $null) {
if ($readini(watch.ini,$newnick,type) == notice) {
onotice %checkchan $newnick is being watched! Notes: $readini(watch.ini,$newnick,notes) $+ . Use !unwatch [host] to stop recieving these messages.
}
elseif ($readini(watch.ini,$newnick,type) == tell) {
notice $newnick $readini(watch.ini,$newnick,requester) says: " $+ $readini(watch.ini,$newnick,messege) $+ "
ms send $readini(watch.ini,$newnick,requester) $nick has been told $readini(watch.ini,$newnick,messege) $+ .
remini watch.ini $newnick
}
else {
ms send $readini(watch.ini,$newnick,requester) $newnick came in with host $address($newnick,2) $+ . Notes: $readini(watch.ini,$address($newnick,2),notes) $+ . Use !unwatch [host] to stop recieving these messages.
}
echo $newnick came in with host $address($newnick,2) $+. Notes: $readini(watch.ini,$newnick,notes)
}
if ($address($newnick,2) isin %HostWL) halt
if ($newnick !isin $hget(nicks,$address($newnick,2)) ) {
hadd nicks $address($newnick,2) $hget(nicks,$address($newnick,2)) $+ $newnick $+ ,
hsave -o nicks nicks.hsh
}
}
on *:Text:!watch *:*:{
if ($2 isin %whitelist) {
notice $nick But... $2 is whitelisted.
halt
}
if ($readini(watch.ini,$2,requester) != $null) {
notice $nick but $2 is already being watched by $readini(watch.ini,$2,requester) $+ !
halt
}
if ($nick isop %checkchan || $nick isop #) {
writeini watch.ini $2 requester $nick
if ($3 != $null) writeini watch.ini $2 notes $3-
notice $nick watching for $2
}
else {
notice $nick You don't have permissions for that!
}
}
on *:Text:!owatch *:*:{
if ($2 isin %whitelist) {
notice $nick but... $2 is whitelisted.
halt
}
if ($readini(watch.ini,$2,requester) != $null) {
notice $nick but $2 is already being watched by $readini(watch.ini,$2,requester) $+ !
halt
}
if (($nick isop %checkchan || $nick isop #) && $3 != $null) {
writeini watch.ini $2 requester $nick
writeini watch.ini $2 type notice
writeini watch.ini $2 notes $3-
notice $nick watching for $2
}
else {
notice $nick you don't have permissions for that!
}
}
on *:Text:!tell *:*:{
if ($readini(watch.ini,$2,requester) != $null) {
notice $nick but $2 is already being watched by $readini(watch.ini,$2,requester) $+ !
halt
}
if ($2 ison %checkchan) {
notice $2 $nick says: " $+ $3- $+ "
notice $nick $2 was on %checkchan $+ . $2 has been told $3- $+ .
halt
}
if ($nick isop %checkchan || $nick isop #) {
writeini watch.ini $2 requester $nick
writeini watch.ini $2 type tell
if ($3 != $null) writeini watch.ini $2 messege $3-
notice $nick watching for $2
}
else {
notice $nick you don't have permissions for that!
}
}
on *:TEXT:!unwatch *:*: {
if ($nick isop %checkchan) {
if ($readini(watch.ini,$2,requester) != $null) {
remini watch.ini $2
notice $nick $2 is no longer being watched
}
else {
notice $nick Host not found
}
}
else {
notice $nick You don't have permission!
}
}
on *:TEXT:!lookup *:*: {
if ($nick !isop %checkchan && $nick !isop #) {
notice $nick Unauthorized
halt
}
var %numfound $hfind(hosts, $2, 0, w)
var %totalhits %numfound
if (%numfound > 5) {
%numfound = 5
}
if (%numfound == 1) {
var %matchedto $hfind(hosts, $2, 1, w)
var %allnicks $hget(nicks,$remove( $hget(hosts, %matchedto ), $chr(44)) )
notice $nick Matched to: %matchedto Host: $remove( $hget(hosts, %matchedto ), $chr(44))
if ($+(*,$chr(44),*,$chr(44),*) iswm %allnicks) notice $nick %matchedto is also known as: $left($remove(%allnicks, %matchedto $+ $chr(44)),-1)
}
else {
if (%numfound != 0) {
var %tosend Nicks:
var %counter 1
var %found
while (%counter <= %numfound) {
%found = $hfind(hosts, $2, %counter, w)
if ($+(*,$chr(44),*,$chr(44),*) iswm $hget(nicks,$remove( $hget(hosts,%found), $chr(44) ) ) ) {
%found = %found $+ *
.timerast* off
.timerast 1 1 notice $nick Names with a * indicate alt nicks. Use !lookup [nick] to see them.
}
%tosend = %tosend $+ %found $+ , $+ $chr(32)
inc %counter
}
notice $nick %tosend
}
var %numfound $hfind(nicks, $2, 0, w)
%totalhits = %totalhits + %numfound
if (%numfound != 0) {
if (%numfound > 5) {
%numfound = 5
}
var %tosend Hosts:
var %counter 1
var %found
while (%counter <= %numfound) {
%found = $hfind(nicks, $2, %counter, w)
%tosend = %tosend $+ %found $+ , $+ $chr(32)
inc %counter
}
notice $nick %tosend
}
}
;Uncomment the following to include old results. No longer supported.
; if (*!*@* !iswm $2) {
; if ($readini(hosts.ini,hosts,$2) != $null) {
; notice $nick Hosts for $2 $+ : $readini(hosts.ini,hosts,$2)
; %totalhits = %totalhits + 1
; }
; if ( $+(*,$chr(44),*,$chr(44),*) iswm $hget(nicks,$address($2,2)) ) { ;multiple nicks
; notice $nick $2 is also known as: $remove($hget(nicks,$address($2,2)),$2 $+ $chr(44))
; }
; elseif ($hget(hosts,$2) != $null && $address($2,2) == $null) {
; if ($+(*,$chr(44),*,$chr(44),*) !iswm $hget(hosts,$2)) {
; var %altnicks $remove($hget(nicks, $remove($hget(hosts,$2), $chr(44) )),$2 $+ $chr(44))
; if ($+(*,$chr(44),*,$chr(44),*) iswm %altnicks) notice $nick $2 is also known as:
; }
; }
if (%totalhits == 0) notice $nick No results. :(
elseif (%totalhits >= 10) notice $nick Results may have been cut off, try being more specific.
}
;Nickbind command, Currently uses server-specific settings so you probably don't want to use it. I'll fix that soon.
on *:Text:!nickbind *:*:{
if ($readini(watch.ini,$2,requester) != $null) {
notice $nick but $2 is already being watched by $readini(watch.ini,$2,requester) $+ !
halt
}
if (*@* !iswm $2) {
notice $nick That command can't take a nick silly!
halt
}
if ($nick isop %checkchan || $nick isop #) {
writeini watch.ini $2 requester $nick
writeini watch.ini $2 type bind
if ($3 != $null) writeini watch.ini $2 fnick $3
notice $nick watching for $2
}
else {
notice $nick you don't have permissions for that!
}
}