mIRC Homepage
Posted By: Time4aHoliday channel limit on users - 29/12/02 11:37 AM
I'd like to know how to get a script to read how many users are currently in channel (for the purpose of setting a channel limit on users entering the channel and then adjusting the limit). If someone could give me a start in the right direction for doing this, it would be greatly appreciated, thanks smile
Posted By: Collective Re: channel limit on users - 29/12/02 11:41 AM
on @*:join:#:{
mode # +k $calc($nick(#,0) + 1)
}

The above code would set the user limit to the number of users on the channel + 1 every time someone joined (pretty pointless, I know).
Posted By: Saturne Re: channel limit on users - 29/12/02 01:29 PM
Erm, perhaps better "mode +l $calc($nick(#,0) + 1)" and not +k... wink

Make sure you don't get flooded if too many people join at once. I do recommend that you set a member limit about 10 or 15 above the number of channel users, then let the script check it everytime someone joins the channel, then, if number of users is 15 (for instance) and your user limit is 16, let the script add another 10 or 15 users to the limit...

Not sure if you can understand what I'm writing (funny english, lol) but you can ask more help I guess smile
Posted By: Time4aHoliday Re: channel limit on users - 29/12/02 02:26 PM
Thanks Collective and Saturne .. I had noticed the +k was the wrong mode and put in the +l instead for what I'm working on.
Code:
on me:1:join:#:{ .timerlimitcheck 0 180 /limitcheck #channel }


alias limitcheck {
  .set %LimCheck $calc($nick(#,0))
  goto next
  :next
  if ( $me isop #channel ) && ( nickhere !isop #channel ) { .set %AdjLim %LimCheck + 5 | /mode #channel +l %AdjLim | goto end }
  else goto end
  :end
}

For some reason the above isn't reading how many people are in channel. Can anyone see what's wrong?
Posted By: Collective Re: channel limit on users - 29/12/02 02:52 PM
Bah goddamn typos...anyway what exactly are you trying to do with that script?
Posted By: Time4aHoliday Re: channel limit on users - 29/12/02 03:04 PM
Well after joining the channel I want the script to check how many users are in channel every 3 minutes and if another bot isn't opped in channel, to increase the channel limit by 5 more than how many users are currently in channel. I hope that makes since - it's just after 4am here lol
Posted By: Saturne Re: channel limit on users - 29/12/02 03:07 PM
I think the problem comes from $calc($nick(#,0)).

Firstly, you don't need $calc to check the number of users, and secondly, you're using an alias so it doesn't know what channel # is.

I have also noticed that you used the command /limitcheck #Channel, so I suggest you use a local variable to store the channel name, i.e.
Code:
alias limitcheck { 
 var %tmpchan $1
 .set %LimCheck $nick(%tmpchan,0)
goto next  
:next 
 if ($me isop %tmpchan) && ( nickofyourbots !isop %tmpchan) { 
.set %AdjLim %LimCheck + 5 
mode %tmpchan +l %AdjLim 
 goto end 
} 
 else { goto end }
:end
}
  


Edit : I saw your last post after I posted that one...
Posted By: Saturne Re: channel limit on users - 29/12/02 03:09 PM
I do think that code should work, although I didn't test it.

Edit : 4am ? ! Shoudl't you be into your bed ? lol, it's about 4pm here !
Posted By: Collective Re: channel limit on users - 29/12/02 03:13 PM
Saturne got the right code, although it would save you having to send the mode +l etc every 3 mintues if you did:

Code:
on @*:JOIN:#channelname:{
  if ( botname !isop # ) {
    mode # +l $calc($nick(#,0) + 5)
  }
}


Edit: Said +k again, ffs
Posted By: Saturne Re: channel limit on users - 29/12/02 03:19 PM
that prevent from using the timer, but I'm not sure whether it's very safe, what if two hundred or bots suddently joined ? crazy
Posted By: Collective Re: channel limit on users - 29/12/02 03:22 PM
Somewhat unlikely, don't ya think? smile, besides, sending a line every 3 minutes isn't very good, since every line you send which isn't needed is just a waste of bandwidth..
Posted By: Saturne Re: channel limit on users - 29/12/02 03:25 PM
Well, I kinda don't trust huge networks such as DALnet... I've spent a lot of time there at the very beggining, then on the ircx server irc.msn.com and it could happen any moment. Now with that user limit, it's unlikely, but you never know, some *intelligent* lamer could make their bots to join with a 1sec timer, just to annoy the channel owners... Okok, I'm paranoïd, lol
Posted By: Time4aHoliday Re: channel limit on users - 29/12/02 03:30 PM
woohooooooo thanks Collective and Saturne .. I finally got it to work!! laugh

lol yeah I guess I should be in bed at 4:30am lol but I don't have any work at the moment (unless the temp agency phones me) so my sleep time is not always when it should be lol
Posted By: Saturne Re: channel limit on users - 29/12/02 03:48 PM
I'm glad you got it to work Time4aholiday (what a nice nick cool) laugh
Posted By: aZnLupin Re: channel limit on users - 31/12/02 03:16 AM
Code:
on @*:JOIN:#channelname:{
  if ( botname !isop # ) { 
    mode # +l $calc($nick(#,0) + 5)
  }
}

If 10 clones join to channel in 3 secs, i want stoped set limit to channel, can u help me ?
Posted By: Hammer Re: channel limit on users - 31/12/02 04:57 AM
Code:
  
;  This script will automatically set the limit of the channel to 10 more than the
;  current nick compliment of the channel at the time the timer fires.
;
;  It will do this for any channel you get opped in, so make sure that the ops
;  in that channel don't mind you running it (i.e., if they already have a bot
;  that does so).
  
on *:OP:#: if ($opnick == $me) $+(.timer,$chan) 0 600 SetLimit $chan
on *:DEOP:#: if ($opnick == $me) $+(.timer,$chan) off
on *:PART:#: if ($opnick == $me) $+(.timer,$chan) off
alias SetLimit .raw MODE $1 +l $calc($nick($1,0) + 10)
© mIRC Discussion Forums