mIRC Homepage
Posted By: encom Kick random 5 - 07/09/05 07:45 PM
Hello all again wink

I need a random kick 5 script.
So it kicked's 5 random people.

Does anyone got it or got a link to it?

Thanks allot!
Posted By: Im2good4u Re: Kick random 5 - 07/09/05 08:08 PM
omg your evil
Posted By: Im2good4u Re: Kick random 5 - 07/09/05 08:15 PM
;$1 = nummer of nicks to kick
alias randomkick {
var i = 0
for(i=0;i<=$1;i++){
kick $chan $nick($chan,random(1,$nick($chan,0),a,o)
}
}
^^ dont ask ( i jsut wrote in like 1 min and didnt test laugh)
Posted By: MikeChat Re: Kick random 5 - 07/09/05 08:54 PM
maybe this
Code:
alias kick5 {
  var %nicksall = $nick(#,0)
  var %i = 5
  var %kicknicks
  while (%i) {
    var %nicknow = $nick(#,$r(%i,%nicksall))
    if (%nicknow !isop $chan) { 
      if (%nicknow != $me) {
        if (%nicknow !isin %kicknicks) { 
          var %kicknicks = %kicknicks %nicknow  
        }
      }
    }
    dec %i
  }
  var %k = 1
  while (%k &lt;= 5) { 
    kick # $gettok(%kicknicks,%k,32) 
    inc %k
  }
}
Posted By: Riamus2 Re: Kick random 5 - 07/09/05 09:03 PM
There isn't a "for" command in mIRC. Also, use [[b][/b]code] tags around code, please. It makes it easier to read.

Code:
alias rk {
  if ($chan == $null || $me !isop $chan) { echo -a Error: You must be on the channel and opped to use this command. | return }
  var %i = 1
  var %x = $1
  if (%x == $null) { var %x = 5 }
  while (%i &lt;= %x) {
    var %nick = $nick($chan,$rand(1,$nick($chan,0)))
    while (%nick != $me) {
      var %nick = $nick($chan,$rand(1,$nick($chan,0)))
    }
    kick $chan %nick What bad luck... You have been randomly kicked.
    inc %i
  }
}


If you just type /rk in a channel, it will randomly kick 5 people. If you include a number after it, it will randomly kick that number of people. It will only work if you use it IN a channel and if you're opped (or it will give an error). It will also not kick you.

If you have questions, just ask.
Posted By: Im2good4u Re: Kick random 5 - 07/09/05 09:06 PM
yours to complicated laugh
Posted By: Kelder Re: Kick random 5 - 07/09/05 09:11 PM
mIRC doesn't have a for loop...

It's probably a good way to get yourself flooded off, deopped, banned or K-lined, but suit yourself...
I also added some error checking and prevented choosing yourself as random target smile

Code:
; kick 3 random people in current channel: /randomkick 3
; kick 2 random people in given channel: /randomkick 2 #channelnamealias randomkick {
  var %i = $$iif($1 isnum 1-5,$1), %c = $$iif($2 ischan,$2,$chan)
  while ((%i) &amp;&amp; ($nick(%c,0) &gt; 1)) {
    if ($nick(%c,$rand(1,$v2)) == $me) continue
    kick %c $v1
    dec %i
  }
}


edit: ok apparently I type too slow, 3 replies during the time I type mine frown
Posted By: Im2good4u Re: Kick random 5 - 07/09/05 09:23 PM
Quote:
mIRC doesn't have a for loop...

It's probably a good way to get yourself flooded off, deopped, banned or K-lined, but suit yourself...
I also added some error checking and prevented choosing yourself as random target smile

oke mine doesnt kick ops so u wont targer tourself here is the non for ( ) version
Code:
;$1 = nummer of nicks to kick
alias randomkick {
  var i = 0
  while(i&lt;=$1){
    kick $chan $nick($chan,random(1,$nick($chan,0),a,o)
    i++
  }
}
easy laugh
Posted By: SladeKraven Re: Kick random 5 - 07/09/05 10:47 PM
You are joking right? That isn't easy nor is it correct.

Blue is correct.
Red is incorrect.

Code:
;$1 = nummer of nicks to kick
[color:blue]alias randomkick {[/color]
  [color:red]var i = 0[/color]
  [color:red]while(i&lt;=$1){[/color]
    [color:red]kick $chan $nick($chan,random(1,$nick($chan,0),a,o)[/color]
    [color:red]i++[/color]
  [color:red]}[/color]
[color:blue]}[/color]


Corrections to your code line by line.

[*]var %i = 1
[*]while (%i <= $1) {
[*]The KICK command definitely wouldn't have worked because there is no $random() identifier and you didn't include %i in the $nick() call.
[*]The main reason it wouldn't have worked is because you didn't incease the var. (i++[/color should be inc %i)

Points you may want to take note to:

[*]Spacing is vital in code so make sure you view the help file thouroughly.
[*]You may want to stick to the language you've been writing in..
[*]You may want to test the code before you post it.

You could also try something a little like:

Code:
alias randk {
  var %i = 1
  while (%i &lt;= $2) {
    if (($nick($1,%i) !isop $1) &amp;&amp; ($nick($1,%i) != $me)) {
      kick $1 $nick($1,%i) $3-
    }
    inc %i
  }
}


/randk <#channel> <Number of people> <Reason if you want>

-Andy
Posted By: Watchdog Re: Kick random 5 - 08/09/05 10:01 AM
The best way to help people is to smoke test any scripts you write before giving them to others. Also take the time to tell un-knowldgable people what each part of the script does, either by ;comments or by an explanation after the code is presented.

Quote:
^^ dont ask ( i jsut wrote in like 1 min and didnt test)


That is hardly any help at all.
Posted By: Riamus2 Re: Kick random 5 - 08/09/05 02:27 PM
Please remember before posting code here to help people, that the the code should be mIRC's scripting language and not C++.

  • Variables must have a % in the name.
  • ++ doesn't increment and -- doesn't decrement in mIRC


Btw, my code wasn't "too complicated" ...

Code:
alias rk {
  [color:blue]; Give an error if called from a query or chat window instead of a channel window, or if you're not opped.[/color]
  if ($chan == $null || $me !isop $chan) { echo -a Error: You must be on the channel and opped to use this command. | return }
  [color:blue]; Set variables.  %i is the counter.  %x is the number to kick... it's set so that a default can be added[/color]
  var %i = 1
  var %x = $1
  [color:blue]; Allow 5 to be the default so that you don't have to type a number to kick[/color]
  if (%x == $null) { var %x = 5 }
  [color:blue]; Loop.[/color]
  while (%i &lt;= %x) {
    [color:blue]; Set %nick to a random nick in the channel[/color]
    var %nick = $nick($chan,$rand(1,$nick($chan,0)))
    [color:blue]; If %nick is $me, get a new random nick.  If not, continue.[/color]
    while (%nick != $me) {
      var %nick = $nick($chan,$rand(1,$nick($chan,0)))
    }
    [color:blue]; Kick nick with reason.[/color]
    kick $chan %nick What bad luck... You have been randomly kicked.
    inc %i
  }
}
Posted By: Riamus2 Re: Kick random 5 - 08/09/05 02:29 PM
Andy, your code isn't random. It just kicks the first X people in the channel, other than yourself. laugh
Posted By: Im2good4u Re: Kick random 5 - 08/09/05 04:50 PM
Quote:
You are joking right? That isn't easy nor is it correct.

Blue is correct.
Red is incorrect.

Code:
;$1 = nummer of nicks to kick
[color:blue]alias randomkick {[/color]
  [color:red]var i = 0[/color]
  [color:red]while(i&lt;=$1){[/color]
    [color:red]kick $chan $nick($chan,random(1,$nick($chan,0),a,o)[/color]
    [color:red]i++[/color]
  [color:red]}[/color]
[color:blue]}[/color]


Corrections to your code line by line.

[*]var %i = 1
[*]while (%i <= $1) {
[*]The KICK command definitely wouldn't have worked because there is no $random() identifier and you didn't include %i in the $nick() call.
[*]The main reason it wouldn't have worked is because you didn't incease the var. (i++[/color should be inc %i)

Points you may want to take note to:

[*]Spacing is vital in code so make sure you view the help file thouroughly.
[*]You may want to stick to the language you've been writing in..
[*]You may want to test the code before you post it.

You could also try something a little like:

Code:
alias randk {
  var %i = 1
  while (%i &lt;= $2) {
    if (($nick($1,%i) !isop $1) &amp;&amp; ($nick($1,%i) != $me)) {
      kick $1 $nick($1,%i) $3-
    }
    inc %i
  }
}


/randk <#channel> <Number of people> <Reason if you want>

-Andy
good atleast u give some real reason about whuts wrong

i have had to much C lol

i indeed forgot the % and i++ should have been inc %i`yes but the random does exist its jsut $rand instead of $random!!!! the eason i didnt incluse %i in the kick command is becase i dont need it i only use it to kick $1 nummer of ppl so the wile loop does it $1 nummer of times

bu sorry guys u where right i coded i to fast lol laugh i do know mirc scripts but after writing in dll's my mind was a litle on C grin
so i tink it should have been this
Code:
;$1 = nummer of nicks to kick
alias randomkick {
  var %i = 0
  while(%i &lt;= $1) {
    kick $chan $nick($chan,rand(1,$nick($chan,0),a,o)
    inc %i 1
  }
}
Posted By: Riamus2 Re: Kick random 5 - 08/09/05 05:29 PM
Btw, there is still a problem in there. You can't use $N in a while loop. It loses the value after the first time through, so you need to store it.
Posted By: Kelder Re: Kick random 5 - 08/09/05 05:36 PM
Since when can't you use $1 in a while loop?

/test 5 works just fine here (mIRC v6.16)
Code:
alias test {
  var %i = 1
  while (%i &lt; $1) {
    echo TEST: %i ; $1
    inc %i
  }
}

As for his script: $rand instead of rand, a space after the while and it might have worked...
Posted By: Im2good4u Re: Kick random 5 - 08/09/05 05:36 PM
Quote:
Btw, there is still a problem in there. You can't use $N in a while loop. It loses the value after the first time through, so you need to store it.
ah oke i didnt know that laugh
so its
Code:
;$1 = nummer of nicks to kick
alias randomkick {
  var %nummerofkicks = $1
  var %i = 1
  while(%i &lt;= %nummerofkicks) {
    kick $chan $nick($chan,$rand(1,$nick($chan,0),a,o)
    inc %i 1
  }
}
:tongue:

oops i saw i forgot the $ whne i made $random to $rand frown
Posted By: Riamus2 Re: Kick random 5 - 08/09/05 05:37 PM
Does it? I've tried in the past and had it lose the value. Hm. I'll have to go through and run some tests.

EDIT:
Hm... I can't seem to duplicate it on 6.16 and I don't have 6.14 right now... and I think that's where I had the issues. I'll have to try and remember to check it tonight.
Posted By: DuNnoO Re: Kick random 5 - 11/09/05 06:32 PM
witch of all this scrips is working now..
pls giv the rigth one !


greetz
Posted By: Riamus2 Re: Kick random 5 - 12/09/05 01:11 PM
My script, or Im2good4u's most recent script, should work fine. Mine does offer the ability to kick any users randomly rather than only non-ops. It also gives a default number of people to kick (with the ability to kick more or less) and error messages when doing something wrong.
© mIRC Discussion Forums