mIRC Homepage
Posted By: XGamerAMD on text trigger problem - 17/10/22 07:58 AM
on @:TEXT:*:#:{
Tokenize 32 $strip($1-)
if ($1 == !o) ( echo -a 0,4 mode $chan +o $2 )
if ($1 == !deop) ( echo -a mode $chan -o $2 )
if ($1 == !v) echo -a mode $chan +v $2
if ($1 == !dv) echo -a mode $chan -v $2
}

its good ? my code?
Posted By: deVilbaT Re: on text trigger problem - 17/10/22 08:12 AM
I don't know if that's what you expect:

eg: !op <nickname>

Code
on @:text:*:#:{
	tokenize 32 $strip($1-)
	if ($2 ison #) {
		if ($1 == !o) { mode # +o $2 }
		if ($1 == !deop) { mode # -o $2 }
		if ($1 == !v) { mode # +v $2 }
		if ($1 == !dv) { mode # -v $2 }
	}
}
Posted By: maroon Re: on text trigger problem - 17/10/22 08:47 AM
You do not want parenthesis around the commands. If you have more than 1 command to execute only if the 'if' statement is 'true', you must have curly braces around them, but with 1 command here, they are optional.

old:
if ($1 == !o) ( echo -a 0,4 mode $chan +o $2 )
new:
if ($1 == !o) { echo -a 0,4 mode $chan +o $2 }
or
if ($1 == !o) echo -a 0,4 mode $chan +o $2

Your code is TOO good, because it does more than it should do smile
Your code is assuming that everyone in channel is friendly and will not abuse this power.

Your code does not limit which channels this script will perform actions in, except is limited to 100% of all the channels where you are OP.

Your code does not limit which nicks can make these !requests.

Your code can send mode commands that do not need to be sent. You don't verify that $2 is even a nick in the channel, and does not verify that $2 now has the mode being removed. You do not even check if there is a $2 word.

For example, if I came into your channel and typed:

!deop XGamerAMD

Your script would react by removing OP from yourself smile

If you want to have people receive OP or Voice status as soon as they enter the channel, without using a !trigger, if their address matches the expected address, you might want to look at the control tab in address book:

/help Control

I only fixed some of the problems, because it helps to have more information about your final goal. So far I only suggest that you limit the trigger to action in 1 channel, and make sure $2 is a nick in channel, and if using !deop or !dv it verifies they have the mode being taken away. But more information is needed if you do not want to use the Control in the address book

Code
on @:TEXT:*:#channelname:{
Tokenize 32 $strip($1-)
var %nick $2 | if (!$2) return | if (%nick isnum) return
if (!$nick($chan,$2)) return
if ($1 == !o)    echo -a mode $chan +o $2
if ($1 == !deop) {
if (!$nick($chan,$2,o)) return
  echo -a mode $chan -o $2
  }
if ($1 == !v)    echo -a mode $chan +v $2
if ($1 == !dv) {
   if (!$nick($chan,$2,v)) return
   echo -a mode $chan -v $2
  }
}
Posted By: Epic Re: on text trigger problem - 17/10/22 09:35 AM
This will throw an error due to using parentheses ( ) where they shouldn't be:
Quote
if ($1 == !o) ( echo -a mode $chan +o $2 )
if ($1 == !deop) ( echo -a mode $chan -o $2 )

After a condition that uses parentheses if ( ) you must use curly braces { }, but only if you will have multiple commands at once:
Quote
if ($1 == !o) { echo -a mode $chan +o $2 | mode $chan +o $2 }
if ($1 == !deop) { echo -a mode $chan -o $2 | mode $chan -o $2 }


So you can fix your code to look like this:
Code
on @:TEXT:*:#:{
  tokenize 32 $strip($1-)
  if ($1 == !o) echo -a mode $chan +o $2
  if ($1 == !do) echo -a mode $chan -o $2 
  if ($1 == !v) echo -a mode $chan +v $2
  if ($1 == !dv) echo -a mode $chan -v $2
}

If you want the specified commands to be able to be executed on channels, then you need to remove this part "echo -a" in all lines.

The command for the channel operator would be: "!o XGamerAMD" - this will set the channel operator status for the specified nickname.
Posted By: XGamerAMD Re: on text trigger problem - 17/10/22 11:01 PM
thnx both for the posts!!!!!
Posted By: XGamerAMD Re: on text trigger problem - 17/10/22 11:01 PM
thnx
© mIRC Discussion Forums