mIRC Homepage
Posted By: truguce Idle Kick - 07/12/05 08:08 AM
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.
Posted By: RusselB Re: Idle Kick - 07/12/05 08:26 AM
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
Posted By: truguce Re: Idle Kick - 07/12/05 03:10 PM
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
Posted By: MikeChat Re: Idle Kick - 07/12/05 05:05 PM
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.
Posted By: truguce Re: Idle Kick - 08/12/05 08:32 AM
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
Posted By: RusselB Re: Idle Kick - 08/12/05 08:58 AM
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.
Posted By: SladeKraven Re: Idle Kick - 08/12/05 09:00 AM
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
Posted By: truguce Re: Idle Kick - 09/12/05 08:38 AM
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.
Posted By: RusselB Re: Idle Kick - 09/12/05 10:40 AM
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.
Posted By: truguce Re: Idle Kick - 11/12/05 09:55 AM
Thanks for the help. Works great!
© mIRC Discussion Forums