mIRC Home    About    Download    Register    News    Help

Print Thread
#144040 05/03/06 03:19 AM
Joined: Apr 2005
Posts: 2
B
Breno Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
B
Joined: Apr 2005
Posts: 2
Code:
 on *:TEXT:*:#mychan:{
  if ($me isop $chan) && ($nick isreg $chan) && ($nick ison $chan) {
    inc -u3 %tfp. [ $+ [ $chan ] ] $+ . [ $+ [ $site ] ]
    if (%tfp. [ $+ [ $chan ] ] $+ . [ $+ [ $site ] ] >= 4) {
      inc -u3 %tfp.kick. [ $+ [ $chan ] ] $+ . [ $+ [ $site ] ]
      if (%tfp.kick. [ $+ [ $chan ] ] $+ . [ $+ [ $site ] ] >= 2) {
        ban $chan $nick 2
        kick $chan $nick bflood
        halt
      }
      kick $chan $nick kflood                                                                                                                                                                    
    }
  }
}  

why don't work? confused

#144041 05/03/06 03:38 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
At a quick glance i would say its the accessing method for your dynamicly created vars
%tfp. [ $+ [ $chan ] ] $+ . [ $+ [ $site ] ] is ok for defining them but I dont think its ok for accessing them its likely going loooking for a variable called %tfp.$chan finding its $null and then appending .$site (the items in italic are representitive of the resulting values of such identifiers, not the litteral $identifier)

If i were you i would change completely the written method of creating your dynamic variables use this inc -u3 $+(%,tfp.,$chan,.,$site) and to access them it would be if ($([color:blue]$+(%,tfp.,$chan,.,$site),2)[/color] >= 4) {

The $( ,2) means evaluate the contents twice, once is like normal, and it makes the variable name %ftp.$chan.$site and the second one then evaluates that to get its contents.

(oh and the initial %ftp. is seperated into % and ftp. so it is not evaluated as a variable on its own)


heres some code that "might" work, Might since i didnt test it and wrote it here in the forum editor.

The @ means you have to be op for it to trigger, the $nick in channel was removed as the nick must be in channel to have triggered the on text event.

Code:
on @*:TEXT:*:#mychan:{
  if ($nick isreg $chan) {
    inc -u3 $+(%,tfp.,$chan,.,$site)
    if ($($+(%,tfp.,$chan,.,$site),2) >= 4) {
      inc -u3 $+(%,tfp.kick.,$chan,.,$site)
      if ($($+(%,tfp.kick.,$chan,.,$site),2) >= 2) {
        ban $chan $nick 2
      }
      kick $chan $nick kflood                                                                                                                                                                    
    }
  }
}

#144042 05/03/06 03:40 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I believe DaveC is correct.

Except for this:
Quote:
the nick must be in channel to have triggered the on text event

Messages can be sent from outside a channel if it is mode -n.
However, that part of the code was redundant because they can't be "isreg" without being on the channel

Here is another version of the same code:
Code:
on @*:TEXT:*:#mychan:{
  if ($nick !isreg $chan) return

  inc -u3 $+(%tfp.,$chan,.,$site)
  if ($($+(%,tfp.,$chan,.,$site),2) < 4) return

  inc -u3 $+(%tfp.kick.,$chan,.,$site)
  if ($($+(%,tfp.kick.,$chan,.,$site),2) >= 2) ban -k $chan $nick 2 bflood
  else kick $chan $nick kflood 
}


-genius_at_work

Last edited by genius_at_work; 05/03/06 05:40 AM.
#144043 05/03/06 03:49 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
Except for this:
Quote:
the nick must be in channel to have triggered the on text event

Messages can be sent from outside a channel if it is mode -n.


frown LOL, shows my limited use of irc channels, i dont think i been on one that ever lets you send from outside the channel.

#144044 06/03/06 10:24 AM
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
+n is on at almost every IRCd I know by default :-P


If it ain't broken, don't fix it!
#144045 06/03/06 11:02 AM
Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
your right the nick must be on channel to trigger the event
this don't mean he must still be on the channel when your script trys to kick him or ban him smile
but the nick can also part or been kicked from some other op
before your script perform the command., thes why some times some script get in ther status the error message-

somenick #mIRC They aren't on that channel
numeric 441

Last edited by tso29; 06/03/06 11:04 AM.
#144046 06/03/06 02:51 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
@Dognach

"Almost" doesn't mean "every". I'm sure most bigger scripts automatically set +nt when you join an empty channel, but I don't think that the server sets the mode itself.


@tso29

The user does NOT need to be on the channel to trigger an event if the channel is mode -n.

Add this code to your remotes:
on *:TEXT:*:#:if ($nick !ison $chan) echo 4 -t $chan $nick said something on $chan

Then try this:
- Join an empty channel
- Set channel mode -n (no outside messages)
- Get someone else (who is not on the channel) to do /msg #channel testing

-genius_at_work

#144047 06/03/06 03:05 PM
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
Quote:
@Doqnach
"Almost" doesn't mean "every".
-genius_at_work


that is why that 'almost' is in there :-P

I stand corrected btw, not all the ircd's I'm on support this indeed. does seem to happen as soon as you register the channel though by chanserv services.

and it's with a Q btw, nog a G ;-]


If it ain't broken, don't fix it!
#144048 07/03/06 10:11 AM
Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
it semse like you misunderstud thinks First i talked to Davec
and if you read his post he pointed out if n is not set (-n)
so don't use my nick in this form @tso29 becuse i not a channel operator in this forum smile
but if it is so and -n is on channel you dont need a flood protection script you need a script thet check if n is set usinc $chan(#).mode . and if it is not raw -q mode # +n

else what sense would make a flood protection script for a channel thet is -n he ?, and evryone outsite the channel would flood it and your script just returns from the event..
EOF

#144049 07/03/06 02:45 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
In this specific script, if you didn't have a line that made sure the person was actually on the channel (if the channel was -n), then when you tried to kick them, it would give you an error that they aren't on the channel.

BTW, on my scripts, ops don't have @ infront of their nick. They are simply a different color than everyone else.

-genius_at_work

#144050 07/03/06 03:25 PM
Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
this is what you post

on @*:TEXT:*:#mychan:{
if ($nick isreg $chan) {
inc -u3 $+(%,tfp.,$chan,.,$site)
if ($($+(%,tfp.,$chan,.,$site),2) >= 4) {
inc -u3 $+(%,tfp.kick.,$chan,.,$site)
if ($($+(%,tfp.kick.,$chan,.,$site),2) >= 2) {
ban $chan $nick 2
}
kick $chan $nick kflood
}
}
}

And this is what you get Nothing!! (if +n is not set yet) becuse your script returns from the event and the above script would do the same it would retun but not fix the problem

In my option

if ($nick !ison $chan) && (*n* !iswmcs $gettok($chan(#).mode,1,32)) { raw -q mode # +n | return }
;and after this line the rest like
inc -u3 $+(%,tfp.,$chan,.,$site), etc..


becuse if ($nick !ison $chan)
and if ($nick isreg $chan)
both script would be just return from the event
and outsite user could still flood the channel

BTW ,I not using a script pure mIRC baby!

Last edited by tso29; 07/03/06 03:45 PM.
#144051 07/03/06 07:10 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
your right the nick must be on channel to trigger the event this don't mean he must still be on the channel when your script trys to kick him or ban him smile
but the nick can also part or been kicked from some other op before your script perform the command., thes why some times some script get in ther status the error message-


I have to reply back to this, becuase if were ignoring -n channels, and you appear to be since you said he has to be on the channel, then at the time your testing if hes in channel he ALWAYS well be, becuase as far as your mirc is concerned, he hasnt been tossed out of the channel and he hasnt left on his own, Why? u ask am i sure of this, im sure because the event mirc is up to processing is the one where hes in the channel at the time saying the message he just said. So ISON well always return true. The kick &/or ban might fail by the time it reaches the irc server, but it would still be issued regardless, as theres no way your mirc can have seen someone else has already done the job of tossing em out.

#144052 07/03/06 10:00 PM
Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
yeah you right smile i was think somthing else and i post somthing else forgive me!


Link Copied to Clipboard