mIRC Home    About    Download    Register    News    Help

Print Thread
#163923 05/11/06 11:10 PM
Joined: May 2005
Posts: 74
D
Dracoz Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: May 2005
Posts: 74
Hello all,,,

I'm not really sure how to script this so I`m asking u guys maybe u know.

I'm running an extra mirc as a bot.

it needs to invite users to #corless if they type !invite
But not everybody should get acces to it. It need to have a function like !allow $nick but that only the ops can allow people.

I hope u guys get this.

-Dracoz

#163924 06/11/06 12:13 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Im sure theres quicker ways but meh im bored tonight before wrestling so here she blows...

Code:
on @*:TEXT:*:#:{
if (!%ot) && ($1 == !allow) { write access.txt $2 | %ot = 1 | halt } 
elseif ($1 == !allow) && ($2 !iswm $read(access.txt,w,$+(*,$2,*)) { write access.txt $2 | halt }
}
on *:TEXT:*:#:{ 
if ($1 == !invite) && ($nick iswm $read(access.txt,w,$+(*,$nick,*))) { invite $2 #corless }
}


first on text event checks OP status and only works for ops, #2 text event checks if $nick is in the allow list.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#163925 06/11/06 03:45 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Actually, the first one will work for anyone conditional that the bot has ops. The @ character only checks for the ops status of the client running the code.
Code:
on *:text:!allow*:#:{
  if $nick !isop $chan {
    .notice $nick Insufficient access. Ops status required
  }
  elseif !$2 {
    .notice $nick Insufficient parameters. One or more nicks required
  }
  else {
    var %nicks = $replace($2-,$chr(44),$chr(32))
    var %a = 1, %b = $numtok(%nicks,32)
    while %a <= %b {
      .hadd -m Allowed $gettok(%nicks,%a,32) $addtok($hget(Allowed,$gettok(%nicks,%a,32)),$chan,32)
      inc %a
    }
  }
}
on @*:text:!invite*:#:{
  if !$2 {
    .notice $nick  Insufficient parameters. One or more nicks required
  }
  else {
    var %nicks = $replace($2-,$chr(44),$chr(32))
    var %a = 1, %b = $numtok(%nicks,32)
    while %a <= %b {
      if $istok($hget(Allowed,$gettok(%nicks,%a,32)),$chan,32) {
        invite $gettok(%nicks,%a,32) $chan
      }
      inc %a
    }
  }
}
on *:text:!disallow*:#:{
  if $nick !isop $chan {
    .notice $nick Insufficient access. Ops status required
  }
  elseif !$2 {
    .notice $nick Insufficient parameters. One or more nicks required
  }
  else {
    var %nicks = $replace($2-,$chr(44),$chr(32))
    var %a = 1, %b = $numtok(%nicks,32)
    while %a <= %b {
      .hadd -m Allowed $gettok(%nicks,%a,32) $remtok($hget(Allowed,$gettok(%nicks,%a,32)),$chan,1,32)
      inc %a
    }
  }
}
on *:start:{
  if !$hget(Allowed) { .hmake Allowed 100 }
  if $exists(Allowed.hsh) { .hload Allowed Allowed.hsh }
}
on *:exit:{
  .hsave -o Allowed Allowed.hsh
}
on *:disconnect:{
  .hsave -o Allowed Allowed.hsh
}
 


Requires Ops status to add nicks with !allow or remove them with !disallow. Notices going out if the person doesn't have ops or if there are no nicks specified.
Multiple nicks can be specified, separated by comma or space.

Works in multiple rooms on a single network, and on multiple networks conditional that no two rooms on two networks have identical names.

Nicks & channels stored in hash table while bot is connected.

#163926 07/11/06 11:00 PM
Joined: May 2005
Posts: 74
D
Dracoz Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: May 2005
Posts: 74
Thank you dude laugh
This 1 is working really good smile

#163927 09/11/06 03:12 PM
Joined: May 2005
Posts: 74
D
Dracoz Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: May 2005
Posts: 74
Hmmm after some day's of using the script...
It didn't worked really good...
i need something like this...
Code:
On *:Text:!allow *:#: {
  if ($nick == Dracoz)
      write allowlist.txt
      msg $chan $2 Has been added to the Allow-List.
 }
}
On *:Text:!invite *:#: {
   if ($nick ==
(and here something if $nick types !invite and if he is in allowlist.txt that the bot invites this user to #Corless)


Is this possible ?


Link Copied to Clipboard