mIRC Home    About    Download    Register    News    Help

Print Thread
Help me the code to kick idle users on my channel #197616 10/04/08 01:31 PM
Joined: Apr 2008
Posts: 4
M
mrsilent Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Apr 2008
Posts: 4
Hope you can help me to solve this problem.

I want to kick a user who stays idle for 5 mins on MY CHANNEL (i.e: #myroom). I don't care this user is active on whatever channel and if he is idle for 5 mins on my channel, he'll get kicked.

Using checkidle method is not effective in this case as if a user is active on another channel, the idle time does not count.

Re: Help me the code to kick idle users on my channel [Re: mrsilent] #197620 10/04/08 05:32 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Quote:

Using checkidle method is not effective in this case as if a user is active on another channel, the idle time does not count.


Why? There'd be 2 different idles, one for your channel and one for the other channel they are active in.

Code:
on @*:join:#myroom:{
  $+(.timer,$nick) 0 30 idlecheck $nick $chan
}
alias idlecheck {
  if ($nick($2,$1).idle > 300) {
    kick $2 $1 Don't idle.
    $+(.timer,$nick) off
  }
}

Re: Help me the code to kick idle users on my chan [Re: SladeKraven] #197632 10/04/08 11:44 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I suspect the OP was thinking of the network idle time, rather than the channel idle time, when he referred to the 'checkidle method'

I'd also like to refer the OP, and anyone else that's looking for a code like this, to my Idle Kicker which is a bit more detailed.

Re: Help me the code to kick idle users on my chan [Re: RusselB] #197645 11/04/08 01:03 PM
Joined: Apr 2008
Posts: 4
M
mrsilent Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Apr 2008
Posts: 4
Well, I mean I just wanna kick idle users on my channel. I don't care if they're active on other channels.

I tried some methods, however, I got a bug. That is the idle users on my channel won't be kicked if they're active on other channels. Now the code above helped me alot.

HOWEVER, I still have a problem, that is, the users who have chanel voice (+v) or op (+o) won't be affected by this code, so can you help me?

Last edited by mrsilent; 11/04/08 01:37 PM.
Re: Help me the code to kick idle users on my chan [Re: SladeKraven] #197647 11/04/08 01:57 PM
Joined: Feb 2003
Posts: 83
L
LO_KEY Offline
Babel fish
Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
Originally Posted By: SladeKraven
[quote]

Code:
on @*:join:#myroom:{
  $+(.timer,$nick) 0 30 idlecheck $nick $chan
}
alias idlecheck {
 if ($1 !isreg $2) { $+(.timer,$nick) off }
  if ($nick($2,$1).idle > 300) {
    kick $2 $1 Don't idle.
   $+(.timer,$nick) off 
  }
}


That should do it for you. Enjoy.


any help would make me happy
Re: Help me the code to kick idle users on my chan [Re: LO_KEY] #197652 11/04/08 04:14 PM
Joined: Apr 2008
Posts: 4
M
mrsilent Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Apr 2008
Posts: 4
Code:
on @*:join:#help:{
  $+(.timer,$nick) 0 30 idlecheck $nick $chan
}
alias idlecheck {
 [color:#FF6666] if ($1 !isreg $2) { $+(.timer,$nick) off }[/color]  if ($nick($2,$1).idle > 300) {
    ban -u900 $2 $1 2 | sapart $1 $2
    $+(.timer,$nick) off
  }
}


I inserted that new line above already, however, it makes no difference from the old one.

What I want here is that, a code to kick idle user on my channel (i.e. #myroom) and make sure that this code doesn't affect channel ops and voices (it will kick normal idle users only, ops (+o) and voices (+o) are not kicked).

What do you mean by this: if ($1 !isreg $2) ?

Last edited by mrsilent; 11/04/08 06:13 PM.
Re: Help me the code to kick idle users on my chan [Re: mrsilent] #197657 11/04/08 07:35 PM
Joined: Feb 2003
Posts: 83
L
LO_KEY Offline
Babel fish
Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
Code:
on @*:join:#help:{
  $+(.timer,$nick) 0 30 idlecheck $nick $chan
}
alias idlecheck {
 if ($1 !isreg $2) { $+(.timer,$1) off | return }
  if ($nick($2,$1).idle > 300) {
    ban -u900 $2 $1 2 | sapart $1 $2
    $+(.timer,$1) off
  }
}


Sorry. That should fix my error (and SladeKraven's). i forgot to stop the script from proceeding after halting the timer.
Originally Posted By: mrsilent

What do you mean by this: if ($1 !isreg $2) ?

$1 represents the nick
$2 represents the channel
!isreg represents user that is not @ or + on the channel

if (Nick !isreg Channel) { $+(.timer,Nick) off | return }

Hope this helps. smile


any help would make me happy
Re: Help me the code to kick idle users on my chan [Re: LO_KEY] #197661 11/04/08 10:35 PM
Joined: Jan 2008
Posts: 22
I
ix007 Offline
Ameglian cow
Offline
Ameglian cow
I
Joined: Jan 2008
Posts: 22
Originally Posted By: LO_KEY
Code:
on @*:join:#help:{
  $+(.timer,$nick) 0 30 idlecheck $nick $chan
}
alias idlecheck {
 if ($1 !isreg $2) { $+(.timer,$1) off | return }
  if ($nick($2,$1).idle > 300) {
    ban -u900 $2 $1 2 | sapart $1 $2
    $+(.timer,$1) off
  }
}


Sorry. That should fix my error (and SladeKraven's). i forgot to stop the script from proceeding after halting the timer.
Originally Posted By: mrsilent

What do you mean by this: if ($1 !isreg $2) ?

$1 represents the nick
$2 represents the channel
!isreg represents user that is not @ or + on the channel

if (Nick !isreg Channel) { $+(.timer,Nick) off | return }

Hope this helps. smile

instead of if ($nick !isreg $chan) {
it should be if ($nick isreg $chan) { <-- this wont affect ops/voices

Re: Help me the code to kick idle users on my chan [Re: mrsilent] #197662 11/04/08 10:52 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The script that I referred you to allows you to decide who (if anyone) is exempt from the idle kick on a channel by channel basis. If you only want it active on one channel, then right click in that channel, and use the menu to set the allowed idle time, as that is set on a channel by channel basis.

Re: Help me the code to kick idle users on my chan [Re: ix007] #197685 12/04/08 12:14 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Wrong. It was correct using !isreg. If you look, it will RETURN (i.e. halt) the script if the person !isreg. That's what the OP wants to happen. If you remove the !, you'll only be kicking ops and voices (and any other modes the network supports).


Invision Support
#Invision on irc.irchighway.net
Re: Help me the code to kick idle users on my chan [Re: Riamus2] #197688 12/04/08 01:10 PM
Joined: Apr 2008
Posts: 4
M
mrsilent Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Apr 2008
Posts: 4
Thank for your contribution very much!

However, I still wanna have the last help, that is, whenever I (myself) join #myroom, I want to scan all existing users on #myroom. If anyone has been idle for equal or more than 5 mins, he will be kicked. Of course, channel ops and voices are exempt.

I'm happy to have your answer

Re: Help me the code to kick idle users on my chan [Re: mrsilent] #197700 12/04/08 09:36 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Add this 'appendix' to your script:
Code:
; joining "your" channel - start the idle-check after 300 seconds
on me:*:join:#help: { .timeridlecheck.init 1 300 if ( $!me isop $chan ) idlecheck.init $chan } 

; loop all regular users to perform the idle-check
; (using the nick-count to prevent possible kick-flood)
alias -l idlecheck.init {
  var %nr = 1
  while ($nick($1,%nr,r)) {
    .timer 1 $calc(%nr *2) idlecheck $v1 $1
    inc %nr
  }
}
smile

Edit / Note: As mIRC is starting to count the idle-duration of the channels users on YOUR join, I set the initial check straight 5 minutes after your join. There's no way to evaluate "previous" idling in your absence.

Last edited by Horstl; 12/04/08 09:48 PM.
Re: Help me the code to kick idle users on my chan [Re: Horstl] #197712 13/04/08 12:11 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Quote:
Edit / Note: As mIRC is starting to count the idle-duration of the channels users on YOUR join, I set the initial check straight 5 minutes after your join. There's no way to evaluate "previous" idling in your absence.
A method that might be used to get some of the people, is to whois the people on the channel and check raw 317 for their network idle time.. if their network idle time is greater than 5 minutes, then their channel idle time has to be greater than that also.

To the OP: If you make use of this information, I recommend you do so carefully, as multiple whois' in a short period of time can flood you off of the network.