mIRC Home    About    Download    Register    News    Help

Print Thread
#260690 05/06/17 08:17 PM
Joined: Jun 2017
Posts: 2
T
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: Jun 2017
Posts: 2
Hi everyone, hope you guys can help me..
I'm looking for a script for my bot that will deop (@ and %) the OPS that is not active for the last hour, but then as soon as they say anything in the channel or if they /hop or so then it must give them their status back so if they were % it must give them % back and so on. So basically it must just be a temporary deop, (/mode # -o $nick). Then if they not active later again for an hour it must take it away again. the script must only be for the @ and % and must have option to use in 1 channel only as my bot is in 3 channels but only 1 channel wants this option.. I can do a little scripting myself, but this is a little bit to much for me. Thanks in advance for any help.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
$nick(#ChannelName,Nick).idle gives the time idle in that channel. Each time they do something in that channel it resets to zero, but does not change the idle time for any other channels you share with them. If YOU /hop that channel, it also resets everyone else's idle time to zero.

You can set a timer which activates every 60 seconds calling an alias.

Note that
var %i $nick(#channelname,0,a,vr)
isn't the same as
var %i $nick(#channelname,0,oh)
because it's possible to set someone with mode +ov

Also, if you have additional modes you wish to be exempted, you'll need to reflect them in your variable. For example, if superops are given prefix & and channel owner is given & or !, you probably want to exempt them. $nick seems to accept the mode as well as the prefix, which is needed because mode +a can give prefix & but for $nick "a" means all people in the channel.

Code:
var %i $nick(#channelname,0,ohq&!,q&!)
while (%i) {
  if ($nick(#channelname,0,ohq&!,q&!).idle isnum 3600-) { var %n $nick(#channelname,0,ohq&!,q&!) | mode #channelname -oh #channelname %n %n }
  dec %i
  }
}


It's possible to make the code more efficient by combining nicks on the same row and eliminating references to modes not present, however different networks have different limits to how many modes can be set at the same time. Also, the odds are probably low that several nicks would reach the time limit within the same 1 minute. If you use mode -oh it will only display the modes someone has which can be taken away.

The part for giving their mode back to them can be a nightmare. If someone does /hop it can be handled by the normal method people are given status when they enter a channel. For people who do something within the channel to reset their idle time, are you going to want to use the official list of nicks for that channel, or also include people who might have been manually opped by another op?

If it's the latter, you'll need to keep track of all the status+nick combinations that the script has removed so it can give them back.

The nightmare part comes when people have scripts to protect themselves from having their op status taken away from them. If they have a script to ask chanserv to give their op status back to them when it's taken away, you could have a duel between the chanserv giving someone status and the bot taking it away 60 seconds later.

ON NICK
ON TEXT
ON ACTION

These will reset the idle, so you would want to trap them for giving status back. SOUND also reset idle, but you didn't say you wanted to give status back for that.

Joined: Jun 2017
Posts: 2
T
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: Jun 2017
Posts: 2
Hi Maroon

Thanks for your reply.

There wont be problem with the manual OPS cause its a smallish channel at the moment (less than 20 chatters) and the current OPS knows that they not allowed to give manual temp OPS, also as far as I know not one of the OPS do have a protect script to get chanserv to give their status back, so I dont think that will be a problem.
I havent thought about the sound part but dont really want that to give them status back, only text or /hop. Reason why we want this script for the bot is because some of the OPS (@ and %) is very quiet in the room they will be chatting in private or so, but not in the room itself. We basically trying to get them to chat a little bit more, cause they are not bad OPS so dont want to permanently take away there status.


Link Copied to Clipboard