|
Joined: Jul 2005
Posts: 19
Pikka bird
|
OP
Pikka bird
Joined: Jul 2005
Posts: 19 |
Hello all again  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!
|
|
|
|
Joined: Sep 2005
Posts: 116
Vogon poet
|
Vogon poet
Joined: Sep 2005
Posts: 116 |
|
|
|
|
Joined: Sep 2005
Posts: 116
Vogon poet
|
Vogon poet
Joined: Sep 2005
Posts: 116 |
;$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  )
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
maybe this
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 <= 5) {
kick # $gettok(%kicknicks,%k,32)
inc %k
}
}
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
There isn't a "for" command in mIRC. Also, use [[b][/b]code] tags around code, please. It makes it easier to read.
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 <= %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.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Sep 2005
Posts: 116
Vogon poet
|
Vogon poet
Joined: Sep 2005
Posts: 116 |
yours to complicated 
|
|
|
|
Joined: Apr 2003
Posts: 701
Hoopy frood
|
Hoopy frood
Joined: Apr 2003
Posts: 701 |
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  ; 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) && ($nick(%c,0) > 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 
Last edited by Kelder; 07/09/05 11:11 PM.
|
|
|
|
Joined: Sep 2005
Posts: 116
Vogon poet
|
Vogon poet
Joined: Sep 2005
Posts: 116 |
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  oke mine doesnt kick ops so u wont targer tourself here is the non for ( ) version ;$1 = nummer of nicks to kick
alias randomkick {
var i = 0
while(i<=$1){
kick $chan $nick($chan,random(1,$nick($chan,0),a,o)
i++
}
} easy 
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
You are joking right? That isn't easy nor is it correct. Blue is correct. Red is incorrect.
;$1 = nummer of nicks to kick
[color:blue]alias randomkick {[/color]
[color:red]var i = 0[/color]
[color:red]while(i<=$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:
alias randk {
var %i = 1
while (%i <= $2) {
if (($nick($1,%i) !isop $1) && ($nick($1,%i) != $me)) {
kick $1 $nick($1,%i) $3-
}
inc %i
}
} /randk <#channel> <Number of people> <Reason if you want> -Andy
|
|
|
|
Joined: Dec 2002
Posts: 2,985
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,985 |
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. ^^ dont ask ( i jsut wrote in like 1 min and didnt test) That is hardly any help at all.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
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" ...
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 <= %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
}
}
Last edited by Riamus2; 08/09/05 02:34 PM.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Andy, your code isn't random. It just kicks the first X people in the channel, other than yourself. 
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Sep 2005
Posts: 116
Vogon poet
|
Vogon poet
Joined: Sep 2005
Posts: 116 |
You are joking right? That isn't easy nor is it correct. Blue is correct. Red is incorrect.
;$1 = nummer of nicks to kick
[color:blue]alias randomkick {[/color]
[color:red]var i = 0[/color]
[color:red]while(i<=$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:
alias randk {
var %i = 1
while (%i <= $2) {
if (($nick($1,%i) !isop $1) && ($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  i do know mirc scripts but after writing in dll's my mind was a litle on C so i tink it should have been this ;$1 = nummer of nicks to kick
alias randomkick {
var %i = 0
while(%i <= $1) {
kick $chan $nick($chan,rand(1,$nick($chan,0),a,o)
inc %i 1
}
}
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
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.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2003
Posts: 701
Hoopy frood
|
Hoopy frood
Joined: Apr 2003
Posts: 701 |
Since when can't you use $1 in a while loop? /test 5 works just fine here (mIRC v6.16) alias test {
var %i = 1
while (%i < $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...
|
|
|
|
Joined: Sep 2005
Posts: 116
Vogon poet
|
Vogon poet
Joined: Sep 2005
Posts: 116 |
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  so its ;$1 = nummer of nicks to kick
alias randomkick {
var %nummerofkicks = $1
var %i = 1
while(%i <= %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 
Last edited by Im2good4u; 08/09/05 05:39 PM.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
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.
Last edited by Riamus2; 08/09/05 05:43 PM.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Sep 2005
Posts: 3
Self-satisified door
|
Self-satisified door
Joined: Sep 2005
Posts: 3 |
witch of all this scrips is working now.. pls giv the rigth one !
greetz
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
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.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
|