mIRC Home    About    Download    Register    News    Help

Topic Options
#137045 - 07/12/05 08:08 AM Idle Kick
truguce Offline
Babel fish

Registered: 24/10/05
Posts: 91
I am trying to figure out the proper way to do an idle kick. I was thinking at first about setting up a timer but started going in the wrong direction with that. I am using this in a learning room so if i am teaching someone i dont want them to get kick. Not sure how to make this happen i was thinking
on teacher:text:!add:#learning: {
/write -ds $2 teach.txt
}
but after looking at that i dont think that is the best way. Can someone help please. I appreciate all the help.

Top
#137046 - 07/12/05 08:26 AM Re: Idle Kick
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
when you are teaching someone, is there a change to their status/ (eg; students are voiced, while teachers are opped or half-opped) or something like that/
If so, then let me know how you determine who is a student, versus who is a teacher, and I can probably come up with something easily

Top
#137047 - 07/12/05 03:10 PM Re: Idle Kick
truguce Offline
Babel fish

Registered: 24/10/05
Posts: 91
I give the teachers the user level of teacher. Also every teacher is opped. As for student they dont get a voice. Was wondering if I can add them to list while training. A txt file or a token. Thanks alot for the help

Top
#137048 - 07/12/05 05:05 PM Re: Idle Kick
MikeChat Offline
Hoopy frood

Registered: 12/12/02
Posts: 1245
Loc: California, doooood
why not the user level of "student"?

then whatever you have to check the idle time looks to see if the nick is a teacher,elseif a student, else kick for being idle.

Top
#137049 - 08/12/05 08:32 AM Re: Idle Kick
truguce Offline
Babel fish

Registered: 24/10/05
Posts: 91
Thanks mikechat for the info. That does make more scence. But can someone help with the coding? I cant figure it out. I know after seeing how it is done i will be able to pick it up. Thanks

Top
#137050 - 08/12/05 08:58 AM Re: Idle Kick
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
Code:
 on !@*:join:#:{
  $+(.timer,$nick) 0 30 idlecheck $nick $chan
}
alias idlecheck {
  if $nick($2,$1).idle > 300 {
    .ban -ku30 $2 $1 No idleing
  }
}
on teacher:text:!student*:*:{
  $iif(student !isin $level($2),.auser -a,.ruser) student $2
  $+(.timer,$nick) $iif(student !isin $level($2),0 30 idlecheck $nick $chan,off)
}
 


You'll have to add coding so that teachers don't get kicked for idleing. Hopefully what I've given you above is sufficient for you to figure out how to handle the coding for the teachers. If not, provide the code that you're currently using to establish the teacher level, and I'll modify it.

If you have any questions about the code, ask and I'll do my best to answer them.

Top
#137051 - 08/12/05 09:00 AM Re: Idle Kick
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Maybe something like:

Code:
On Teacher:Text:!add *:#learning: {
  var %x = 1
  while (%x <= $numtok($2-,32)) {
    var %pupil = $gettok($2-,%x,32)
    if (%pupil ison #learning) {
      write teach.txt %pupil
      msg $chan added pupil to list
    }
    inc %x
  }
}


-Andy

Top
#137052 - 09/12/05 08:38 AM Re: Idle Kick
truguce Offline
Babel fish

Registered: 24/10/05
Posts: 91
thanks for the help russelb. All teachers have same type of nick so i added this

Code:
on !@*:join:#:{
  if (teacher* iswm $nick) halt
  $+(.timer,$nick) 0 30 idlecheck $nick $chan
}
alias idlecheck {
  if $nick($2,$1).idle > 62 {
    .ban -ku30 $2 $1 No idleing
  }
}
on teacher:text:!student*:*:{
  $iif(student !isin $level($2),.auser -a,.ruser) student $2
  $+(.timer,$nick) $iif(student !isin $level($2),0 30 idlecheck $nick $chan,off)
}
  

I did notice that after the people got kicked for idleing or when they just left the room the timer was still going for them. Is there a way to check if they are in the room the halt the timer if they are not? One more thing can the timer get updated if they change there nick, possibly with $newnick ? Thanks for the help.


Edited by truguce (09/12/05 09:47 AM)

Top
#137053 - 09/12/05 10:40 AM Re: Idle Kick
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
Code:
on !@*:join:#:{
if (teacher* !iswm $nick) {
$+(.timer,$address) 0 30 idlecheck $nick $chan
}
}
alias idlecheck {
if $nick($2,$1).idle > 62 {
.ban -ku $2 $1 No idleing
}
on teacher:text:!student*:#:{
 $iif(student !isin $level($2),.auser -a,.ruser) student $2
var %address = $right($address($2,0),-2)
$+(.timer,%address) $iif(student !isin $level($2),0 30 idlecheck $2 $chan,off)
}
on *:quit:{ pkq $address $nick }
on *:part:#:{ pkq $address $nick }
on *:kick:#:{ pkq $address $knick }
alias pkq {
$+(.timer,$1) off
.ruser $2
}
 


Changed the timer so that it tracks by address rather than nick, that way you only need one timer per person, and don't have to worry about stopping & starting timers when someone changes their nick.

Top
#137054 - 11/12/05 09:55 AM Re: Idle Kick
truguce Offline
Babel fish

Registered: 24/10/05
Posts: 91
Thanks for the help. Works great!

Top