|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
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 } } }
|
|
|
|
Joined: Jan 2004
Posts: 2,127
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 2,127 |
perhaps you are doing this before the op has a chance to actually be given op level?
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
No it banned after he got op, thats what I dont get...
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
maroon is right, you need to add some kind of safe list to make them exempt.
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
If I was to add this line, would this help?
if (($nick isop $chan) || (exempt isin $level($fulladdress))) halt
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
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:
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
}
}
}
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
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.
|
|
|
|
Joined: Jan 2004
Posts: 2,127
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 2,127 |
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
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
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.
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
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?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
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.
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
Its working great....Thank you sir.
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
Just noticed when I exit or disc that its not saving...any ideal why?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Ooops, sorry mate. Try this.
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
}
}
}
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
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.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
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.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
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 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)
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
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. 2) I avoid the 'table exists' error by using this format in the ON START event 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.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
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. Just noticed when I exit or disc that its not saving...any ideal why?
|
|
|
|
|