mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
exempt op #181220 20/07/07 12:31 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Why is my script banning op on join?

raw 319:*:{
if (%drone != off) && (%options.exempt != on) && ($nick(#chat,$me,~&@%)) {
if $numtok($3-,32) > 12 {
if ($wildtok($3-,#*,$numtok($3-,32),32)) ban -ku3600 #chat $2 2 14Drone Bot - Excess Channels
}
}
}

Re: exempt op [Re: Garou] #181222 20/07/07 12:47 PM
Joined: Jan 2004
Posts: 1,301
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,301
perhaps you are doing this before the op has a chance to actually be given op level?

Re: exempt op [Re: maroon] #181224 20/07/07 12:58 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
No it banned after he got op, thats what I dont get...

Re: exempt op [Re: Garou] #181225 20/07/07 12:59 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
maroon is right, you need to add some kind of safe list to make them exempt.

Re: exempt op [Re: SladeKraven] #181226 20/07/07 01:08 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
If I was to add this line, would this help?

if (($nick isop $chan) || (exempt isin $level($fulladdress))) halt

Re: exempt op [Re: Garou] #181227 20/07/07 01:11 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
No because $chan doesn't work in Raw events, you're better off using $level or adding the nicknames in a hash table and having something like:

Code:
raw 319:*:{
  if (%drone != off) && (%options.exempt != on) && ($nick(#chat,$me,~&@%)) {
    if $numtok($3-,32) > 12 {
      if ($wildtok($3-,#*,$numtok($3-,32),32)) && (!$hget(exempt,$2)) ban -ku3600 #chat $2 2 14Drone Bot - Excess Channels
    }
  }
}

Re: exempt op [Re: SladeKraven] #181229 20/07/07 01:13 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
I see ok I make a file named exempt with nicks to be exempted right? Or add the nicks to my script exempt list?

Last edited by Garou; 20/07/07 01:18 PM.
Re: exempt op [Re: Garou] #181231 20/07/07 01:37 PM
Joined: Jan 2004
Posts: 1,301
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,301
If your /whois is done inside the ON JOIN event, the /whois reply comes before the op is given their OP status, but the resulting ban comes after they've been given OP status.

If you're trying to prevent spammers, it's possible for someone to blurt out their spam before the ban takes effect. One method some channels do is to make the channel +m moderated, then give everyone voice except the spammers.

You'll probably want to give OP based on address mask, instead of nick. Anyone could use a non-registered nick, and even a registered nick for the few seconds needed to join a channel. It's harder for them to be ident@*.some-ISP.com

Re: exempt op [Re: Garou] #181232 20/07/07 01:43 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
On *:Start: {
  hmake exempt 10
  if ($isfile(exempt.hsh)) hload -i exempt exempt.hsh
}

alias isexempt { return $iif($hget(exempt,$1),$true,$false) }
alias exempt {
  if (!$hget(exempt)) hmake exempt 10
  if ($1 == -r) {
    if (!$2) echo 2 * /exempt: insufficient parameters
    elseif (!$hget(exempt,$2)) echo 3 * /exempt: $2 not in list
    else { hdel exempt $2 | echo 3 * Removed $2 from exempt list }
  }
  elseif ($1 == -l) {
    if ($hget(exempt,0) < 1) echo 2 * Exempt list empty
    else {
      echo 2 * Exempt list:
      var %x = 1
      while (%x <= $hget(exempt,0).item) {
        echo 3 $hget(exempt,%x).item
        inc %x
      }
    }
  }
  else {
    if (!$hget(exempt,$1)) { hadd exempt $1 $1 | echo 3 * Added $1 to exempt list }
    else { echo 3 * /exempt: $1 is already in list }
  }
  hsave -i exempt exempt.hsh
}

raw 319:*:{
  if (%drone != off) && (%options.exempt != on) && ($nick(#chat,$me,~&@%)) {
    if $numtok($3-,32) > 12 {
      if ($wildtok($3-,#*,$numtok($3-,32),32)) && (!$isexempt($2)) ban -ku3600 #chat $2 2 14Drone Bot - Excess Channels
    }
  }
}


The only thing I tested was the exempt list, which seems to work ok. I haven't actually tested out the Raw though. Hopefully it works.

/exempt <Nick> Adds a nickname to the exempt list.
/exempt -r <Nick> Removes a nickname from the exempt list.
/exempt -l Lists the exempt list.

It should also save the exempt list after using the command too and then reload it when mIRC starts up.

Re: exempt op [Re: SladeKraven] #181233 20/07/07 01:57 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
wow cool stuff...thx very much....Last question please...I want to save exempt.hsh in my mirc/sys/ folder?

Re: exempt op [Re: Garou] #181234 20/07/07 02:04 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
On *:Start: {
  hmake exempt 10
  if ($isfile(exempt.hsh)) hload -i exempt $qt($mircdirsys\exempt.hsh)
}

alias isexempt { return $iif($hget(exempt,$1),$true,$false) }
alias exempt {
  if (!$isdir(sys)) mkdir Sys
  if (!$hget(exempt)) hmake exempt 10
  if ($1 == -r) {
    if (!$2) echo 2 * /exempt: insufficient parameters
    elseif (!$hget(exempt,$2)) echo 3 * /exempt: $2 not in list
    else { hdel exempt $2 | echo 3 * Removed $2 from exempt list }
  }
  elseif ($1 == -l) {
    if ($hget(exempt,0) < 1) echo 2 * Exempt list empty
    else {
      echo 2 * Exempt list:
      var %x = 1
      while (%x <= $hget(exempt,0).item) {
        echo 3 $hget(exempt,%x).item
        inc %x
      }
    }
  }
  else {
    if (!$hget(exempt,$1)) { hadd exempt $1 $1 | echo 3 * Added $1 to exempt list }
    else { echo 3 * /exempt: $1 is already in list }
  }
  hsave -i exempt $qt($mircdirsys\exempt.hsh)
}

raw 319:*:{
  if (%drone != off) && (%options.exempt != on) && ($nick(#chat,$me,~&@%)) {
    if $numtok($3-,32) > 12 {
      if ($wildtok($3-,#*,$numtok($3-,32),32)) && (!$isexempt($2)) ban -ku3600 #chat $2 2 14Drone Bot - Excess Channels
    }
  }
} 


I would of said which lines to change but I thought it'd be easier for you just to post the updated code.

Re: exempt op [Re: SladeKraven] #181238 20/07/07 02:22 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Its working great....Thank you sir. smile

Re: exempt op [Re: Garou] #181264 20/07/07 06:09 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Just noticed when I exit or disc that its not saving...any ideal why?

Re: exempt op [Re: Garou] #181267 20/07/07 06:46 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Ooops, sorry mate. Try this.

Code:
On me:*:Disconnect: exempt.sv
On *:Exit: exempt.sv
On *:Start: {
  hmake exempt 10
  if ($isfile(exempt.hsh)) hload -i exempt $qt($mircdirsys\exempt.hsh)
}

alias isexempt { return $iif($hget(exempt,$1),$true,$false) }
alias exempt.sv { hsave -i exempt $qt($mircdirsys\exempt.hsh) }
alias exempt {
  if (!$isdir(sys)) mkdir Sys
  if (!$hget(exempt)) hmake exempt 10
  if ($1 == -r) {
    if (!$2) echo 2 * /exempt: insufficient parameters
    elseif (!$hget(exempt,$2)) echo 3 * /exempt: $2 not in list
    else { hdel exempt $2 | echo 3 * Removed $2 from exempt list }
  }
  elseif ($1 == -l) {
    if ($hget(exempt,0) < 1) echo 2 * Exempt list empty
    else {
      echo 2 * Exempt list:
      var %x = 1
      while (%x <= $hget(exempt,0).item) {
        echo 3 $hget(exempt,%x).item
        inc %x
      }
    }
  }
  else {
    if (!$hget(exempt,$1)) { hadd exempt $1 $1 | echo 3 * Added $1 to exempt list }
    else { echo 3 * /exempt: $1 is already in list }
  }
  exempt.sv
}

raw 319:*:{
  if (%drone != off) && (%options.exempt != on) && ($nick(#chat,$me,~&@%)) {
    if $numtok($3-,32) > 12 {
      if ($wildtok($3-,#*,$numtok($3-,32),32)) && (!$isexempt($2)) ban -ku3600 #chat $2 2 14Drone Bot - Excess Channels
    }
  }
}

Re: exempt op [Re: SladeKraven] #181268 20/07/07 06:57 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Still wont save what I added on exit :P
I also get this error when I save the dialog:
* /hmake: table 'exempt' exists (line 4, dialog22.op)

Last edited by Garou; 20/07/07 06:59 PM.
Re: exempt op [Re: Garou] #181276 20/07/07 09:48 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
On me:*:Disconnect: exempt save
On *:Exit: exempt save
On *:Start: {
  hmake exempt 10
  if ($isfile(exempt.hsh)) hload -i exempt $qt($mircdirsys\exempt.hsh)
}

alias isexempt { return $iif($hget(exempt,$1),$true,$false) }
alias exempt {
  if (!$isdir(sys)) mkdir Sys
  if (!$hget(exempt)) hmake exempt 10
  if ($1 == -r) {
    if (!$2) echo 2 * /exempt: insufficient parameters
    elseif (!$hget(exempt,$2)) echo 3 * /exempt: $2 not in list
    else { hdel exempt $2 | echo 3 * Removed $2 from exempt list }
  }
  elseif ($1 == -l) {
    if ($hget(exempt,0).item < 1) echo 2 * Exempt list empty
    else {
      echo 2 * Exempt list:
      var %x = 1
      while (%x <= $hget(exempt,0).item) {
        echo 3 $hget(exempt,%x).item
        inc %x
      }
    }
  }
  elseif ($1 == save) hsave -i exempt $qt($mircdirsys\exempt.hsh)
  else {
    if (!$hget(exempt,$1)) { hadd exempt $1 $1 | echo 3 * Added $1 to exempt list }
    else { echo 3 * /exempt: $1 is already in list }
  }
  hsave -i exempt $qt($mircdirsys\exempt.hsh)
}

raw 319:*:{
  if (%drone != off) && (%options.exempt != on) && ($nick(#chat,$me,~&@%)) {
    if $numtok($3-,32) > 12 {
      if ($wildtok($3-,#*,$numtok($3-,32),32)) && (!$isexempt($2)) ban -ku3600 #chat $2 2 14Drone Bot - Excess Channels
    }
  }
} 


I think the only reason you got that error is because On Start also works the same way On Load does.

From the help file:

The on START event uses the same format, and triggers the first time a script is loaded and every time after that when mIRC is run.

I hope this sorts out the save problem.

Re: exempt op [Re: SladeKraven] #181281 20/07/07 10:34 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
1) No need for the me prefix in the ON DISCONNECT event, since that event only responds when you disconnect.

2) I avoid the 'table exists' error by using this format in the ON START event
Code:
on *:start:{
  if !$hget(exempt)  .hmake exempt 10
  if $exists($mircdirsys\exempt.hsh) hload -i exempt $mircdirsys\exempt.hsh
}

My preference is to use $exists rather than $isfile, since $exists will return false if the file has a 0 byte size, but $isfile will return true.

Also, the directory where the file is stored has to be contained in the $exists/$isfile otherwise mIRC will only check the installation directory.

The $qt isn't required, even if there are spaces in $mircdir
If there were spaces in the sub-directory name off of $mircdir
eg: $mircdirRussel Bairstow\exempt.hsh
does require the $qt so that it reads $qt($mircdirRussel Bairstow\exempt.hsh)

Re: exempt op [Re: RusselB] #181283 20/07/07 10:42 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Quote:

1) No need for the me prefix in the ON DISCONNECT event, since that event only responds when you disconnect.


The OP wanted to save it when he disconnected.

Quote:

2) I avoid the 'table exists' error by using this format in the ON START event
Code:
on *:start:{
  if !$hget(exempt)  .hmake exempt 10
  if $exists($mircdirsys\exempt.hsh) hload -i exempt $mircdirsys\exempt.hsh
}



That usually only happens when you overwrite your old script with a new script. Your code is fine if you're going to be loading/unloading it alot but that's about it.

Re: exempt op [Re: SladeKraven] #181285 20/07/07 10:52 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The ON DISCONNECT event will only trigger when the OP (presuming the OP is running the script) disconnects. A disconnection by anyone else triggers the ON QUIT event

Re: exempt op [Re: RusselB] #181286 20/07/07 10:54 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Originally Posted By: RusselB

The ON DISCONNECT event will only trigger when the OP (presuming the OP is running the script) disconnects.

Yes, and that's exactly what he wanted.

Originally Posted By: Garou

Just noticed when I exit or disc that its not saving...any ideal why?

Page 1 of 2 1 2