mIRC Home    About    Download    Register    News    Help

Print Thread
#144501 11/03/06 01:44 AM
Joined: Mar 2006
Posts: 10
M
Massari Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Mar 2006
Posts: 10
Well, I used search, and I cant find anything. I want to make a script that if someone changes the mode (any one) it reverses it...

eg i turn it to +m
auto turns it back to -m
and then it kicks them....

I havnt been coding much, but im lost. This is what I could come up wiht..

Code:
on @1:MODE:#: {
/notice $me $nick changed $chan mode to $1 at $time } 
{
  if /mode==+$1
    then /mode -$1  
  /kick $nick dont play around with modes

} 

  

#144502 11/03/06 02:32 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If chanserv is on the network, try the mlock option (for mode lock). /msg chanserv help mlock

That's the easiest way to handle that problem

#144503 11/03/06 04:07 AM
Joined: Mar 2006
Posts: 10
M
Massari Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Mar 2006
Posts: 10
Firstly our server doesnt have cs. But I am not doing this because i need to use it, I am learning to script, so i am trying different codes...Ive been playing around with it, and this is what I came up with, but its still not working.
Code:
;WHEN SOMEONE OTHER THAN ME CHANGES MODE TO +I THEY GET KICEKD
on @1:MODE:#Script-testing: {
  /notice kl
  $me $nick changed $chan mode to $1 at $time LOL 
  {
    if ($nick==$me) && ($1==+i) { /msg $chan good boy $me }
    {  
      else { /kick $chan $nick No more playinh with +i | /mode $chan -i } 

 


Basically, when somone changes mode, it notices me.

This line ..
Code:
    if ($nick==$me) && ($1==+i) { /msg $chan good boy $me }  
is ment to mean if I change the mode + i, I dont get kicked.

This line
Code:
       else { /kick $chan $nick No more playinh with +i | /mode $chan -i  
is ment to mean if anyone else, they get kicked, and mode goes back to -i.

So far, if I or anyone else changes mode to +i or -i, we get kicked. Can anyone help me get back on track. I cant seem to make it do what i want....THanks

#144504 11/03/06 04:17 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
When using IF statements, you need to have spaces inside the comparison:

Code:
if (something == something) {
  echo -a IF MATCH
}
else {
  echo -a NO MATCH
}



-

You don't need to use the / command prefix when you are making scripts.

Code:
/echo -a COMMAND WITH /
echo -a COMMAND WITH NO /



-genius_at_work

#144505 11/03/06 04:23 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
mIRC scripting is very pernickity(sp?) when it comes to spacing
Code:
 ;WHEN SOMEONE OTHER THAN ME CHANGES MODE TO +I THEY GET KICEKD
on @!*:MODE:#Script-testing: {
  notice $me $nick changed $chan mode to $1 at $time LOL 
kick $chan $nick No more playinh with +i 
mode $chan -i
}
 


The @ means that the person/bot that's running the script must be opped.
The ! means Anyone EXCEPT me

If (and when) you get tired of seeing the notice, kick, and mode lines in the system running the script, you can put a fullstop (aka . ) in front of each command

This won't bring up your Good Boy message, but it also won't run when you go to make the change

Part of the reason your script isn't working is a lack of spaces, specifically between the operators and the == signs in your if statements

#144506 11/03/06 04:39 AM
Joined: Oct 2005
Posts: 122
O
Vogon poet
Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
Code:
on @!:MODE:#channel: {
  [color:green] ;if the nick changing the mode is not you [/color]
  [color:green] ;if the nick is turning on a mode, turn it off [/color]
  if (+ isin $1) { mode $chan $replace($1,+,-)  | kick $nick DO NOT Change The Modes Of The Channel!  }
   [color:green]  ; if the nick is turning off the mode, turn it back on  [/color] 
  elseif (- isin $1) { mode $chan $replace($1,-,+)  | kick $nick  DO NOT Change The Modes Of The Channel! }
}




You Will Need To Change Channel Name, And Reason For Kick

EDIT: Sorry didnt see russel had replied back

Last edited by onesikgypo; 11/03/06 04:42 AM.
#144507 11/03/06 04:57 AM
Joined: Mar 2006
Posts: 10
M
Massari Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Mar 2006
Posts: 10
Okay, im stil playing around with it just to kick +i..... its not working! Am i doing the If script correct?

Code:
;WHEN SOMEONE OTHER THAN ME CHANGES MODE TO +I THEY GET KICEKD
on @*:MODE:#Script-testing: 
 /notice $me $nick changed $chan mode to $1 at $time 
  if ($1===+i) { /kick $chan $nick DO NOT Change The Modes Of The Channel $knick!! }
  else /mode $chan -i | /mode $chan -m 
}


btw thanks for all your replies guys

EDIT The script isnt even noticing me anymore.....whats going on :S

Last edited by Massari; 11/03/06 05:34 AM.
#144508 11/03/06 07:54 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You're still missing required spacing in your if statement
if ($1 === +i) { /kick $chan $nick DO NOT Change The Modes Of The Channel $knick $+ !! }

Also, I don't know if you can test these events yourself, or if they react like an on text event where someone else has to initiate the command for it to be recognized.

The if statement above is the corrected version of the if statement you gave.

#144509 11/03/06 10:01 AM
Joined: Mar 2006
Posts: 10
M
Massari Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Mar 2006
Posts: 10
ok thanks for that.. All I know now, is the code was working..now its not...can anyone see anything wrong with the code?

Code:
;WHEN SOMEONE OTHER THAN ME CHANGES MODE TO +I THEY GET KICEKD
on *:MODE:#Script-testing: {
/notice $me $nick changed $chan mode to $1 at $time | write log.txt $me $nick changed $chan mode to $1 at $time }
if ($1 == +i) { /kick $chan $nick DO NOT Change The Modes Of The Channel $knick $+ !! | /mode $chan -i }
else /mode $chan -i | /mode $chan -m
  


I cant think of anything else :S

#144510 11/03/06 10:59 AM
Joined: Oct 2005
Posts: 122
O
Vogon poet
Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
Code:
on *:MODE:#Script-testing: {
  /notice $me $nick changed $chan mode to $1 at $time | write log.txt $me $nick changed $chan mode to $1 at $time
  if ($1 == +i) { /kick $chan $nick DO NOT Change The Modes Of The Channel $knick $+ !! | /mode $chan -i }
  else { /mode $chan -i | /mode $chan -m }
}


You Will Notice The { } around the else statement now, also you had a } after the write log.txt.... line, its not needed, and you needed a bracket down the end to close the event statement

also i dont understand the logic of your else statement.

Back To Your Original Question which was to stop people from changing the modes, and kicking them if they did, you might want to look at the script i posted above.

#144511 11/03/06 11:11 AM
Joined: Mar 2006
Posts: 10
M
Massari Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Mar 2006
Posts: 10
Quote:
Code:
on *:MODE:#Script-testing: {
  /notice $me $nick changed $chan mode to $1 at $time | write log.txt $me $nick changed $chan mode to $1 at $time
  if ($1 == +i) { /kick $chan $nick DO NOT Change The Modes Of The Channel $knick $+ !! | /mode $chan -i }
  else { /mode $chan -i | /mode $chan -m }
}


You Will Notice The { } around the else statement now, also you had a } after the write log.txt.... line, its not needed, and you needed a bracket down the end to close the event statement

also i dont understand the logic of your else statement.

Back To Your Original Question which was to stop people from changing the modes, and kicking them if they did, you might want to look at the script i posted above.


LOL all that was stopping me was 2 brackets. Thanks alot :P

well I basically added else to test stuff, but the logic behind it is that if someone changes the mode to one of the ones I dont want changed, it makes it back to normal ie +m and +i wink

Once again, thanks alot. I can sleep good tonight

#144512 11/03/06 03:22 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You should consider spreading your code out to multiple
lines. Your current code uses pipes | to separate multiple
commands on one line. That can make code very difficult to
read/alter/debug. Example of difficulty using | pipes:
Code:
alias example {
set %ex this is a very long line that goes beyond the edge of the mIRC editor screen. this line could be any code, and this string is just an example. when the text goes beyond the edge of the editor, you have to scroll back and forth to be able to read all the code, and you have to notice all the pipes so that you know where the commands are separated. | unset %ex
msg $me %ex
}

When you look at that code quickly, you would see that a
variable is getting set to some value, and then below it,
the variable is being messaged to yourself. What you may
not notice is that at the end of the variable, there is a
pipe and the variable is unset. This unnoticed code would
cause you all sorts of problems. The /msg command would
give an error because it doesn't have anything to send
(%ex has been unset).

mIRC allows you to put multiple commands on multiple lines if you contain them in { } brackets. Using the same example, but on multiple lines:
Code:
alias example {
set %ex this is a very long line that goes beyond the edge of the mIRC editor screen. this line could be any code, and this string is just an example. when the text goes beyond the edge of the editor, you have to scroll back and forth to be able to read all the code, and you have to notice all the pipes so that you know where the commands are separated. 
unset %ex
msg $me %ex
}

It becomes incredibly easy to see what the problem is.

Anyway, this is not a rule, it is just a suggestion.
Personally, I hate trying to debug (someone else's) code
when it uses | pipes, and you are more likely to get
(quick) help on this forum if you use pipes as little as
possible.

-genius_at_work


Link Copied to Clipboard