Botscript / tagvoice / tagop

Release your script here.
State:
- Author
- What it does
- Perhaps a little guide.
- Also, if the snippet is of any use to the community, it has a chance of getting posted on the main page, so don't hesitate to submit/ask!

Botscript / tagvoice / tagop

Postby Cristian » Thu Mar 27, 2008 7:06 pm

Botscript / Tagvoice / Tagop / Nickname wildcards for autovoice/autoop.

Current trigger: !tag add <tag>
Current trigger: !tag del <tag>
Current trigger: !tag list

If you want one, thats ops and voices, you could make two files, and changes the settings,triggers. ex !tagop/!tagvoice.

alias _trigger, is the trigger you use when adding 'tags' to the channel.
alias _strip, if the user removes the 'tag' should he be stripped from his gained status.
alias _database, the name of the table in you hashtable.
alias _file, the name of the file, where we save to.
alias _save, is the alias we use to load/save the information.
alias _enabled, is the alias that checks if the channel uses 'tags'.
alias _tag, checks if the user should get the status.

Tested and works on version 6.15

Code: Select all
;# 
;# visit http://sp00fed.org for updates or support.
;# script by Sumsar
;#
alias -l _trigger { return !tag }
alias -l _strip { return 1 }
alias -l _status { return v }
alias -l _database { return tag }
alias -l _file { return $+($_database,.hsh) }




alias -l _save {
  if ($1 == l) {
    if (!$hget($_database)) {
      .hmake $_database 1000
      if ($exists($_file)) { .hload $_database $_file }
    }
  }
  elseif ($1 == s) { .hsave -o $_database $_file }
}

;# $_enabled($chan)
alias -l _enabled {
  var %x = $hget($_database,0).item,%f = 0
  while (%x) {
    if ($1 == $gettok($hget($_database,%x).item,%x,44)) { var %f = 1 }
    dec %x
  }
  return %f
}

;# $_tag($chan,$nick)
alias -l _tag {
  var %t = $hget($_database,$1),%f = 0
  var %x = $numtok(%t,44)
  while (%x) {
    if ($gettok(%t,%x,44) iswm $2) { var %f = 1 }
    dec %x
  }
  return %f
}


on *:NICK:{
  _save l
  var %x = $comchan($newnick,0)
  while (%x) {
    var %c = $comchan($newnick,%x)
    if ($me isop %c) {
      if ($_enabled(%c)) {
        if ($_tag(%c,$newnick)) {
          if ($iif($nick(%c,$newnick,$_status),0,1)) { .mode %c $+(+,$_status) $newnick }
        }
        else {
          if ($iif($nick(%c,$newnick,$_status),1,0)) && ($_strip) { .mode %c $+(-,$_status) $newnick }
        }
      }
    }
    dec %x
  }
}
on !@*:JOIN:#:{ _save l | if ($_tag($chan,$nick)) { .mode $chan $+(+,$_status) $nick } }
on *:TEXT:$($_trigger *):#: {
  if ($2 == add) {
    .hadd -m $_database $chan $addtok($hget($_database,$chan),$3,44)
    .msg $nick Added tag $3 for channel $+($chr(2),$chr(40),$chr(2),$chan,$chr(2),$chr(41),$chr(2),.)
  }
  elseif ($2 == del) {
    if ($istok($hget($_database,$chan),$3,44)) {
      .hadd -m $_database $chan $remtok($hget($_database,$chan),$3,44)
      .msg $nick Deleted tag $3 for channel $+($chr(2),$chr(40),$chr(2),$chan,$chr(2),$chr(41),$chr(2),.)
    }
    else {
      .msg $nick Error couldnt delete tag $+($3,.) Tag doesnt exists for channel $+($chr(2),$chr(40),$chr(2),$chan,$chr(2),$chr(41),$chr(2),.)
    }
  }
  elseif ($2 == list) {
    var %t = $hget($_database,$chan),%x = 1
    .msg $nick Showing tags for channel $+($chr(2),$chr(40),$chr(2),$chan,$chr(2),$chr(41),$chr(2))
    while ($gettok(%t,%x,44)) {
      .msg $nick $+($chr(2),%x,$chr(2),.) $gettok(%t,%x,44)
      inc %x
    }
    .msg $nick End of tags for channel $+($chr(2),$chr(40),$chr(2),$chan,$chr(2),$chr(41),$chr(2))
  }
  _save s
}
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Return to Mirc Scripting Release

Who is online

Users browsing this forum: No registered users and 2 guests

cron