mIRC Home    About    Download    Register    News    Help

Print Thread
#123503 24/06/05 08:39 AM
Joined: Jun 2005
Posts: 3
K
KibaZu Offline OP
Self-satisified door
OP Offline
Self-satisified door
K
Joined: Jun 2005
Posts: 3
We have got a channel where we give away free ventrilo voice channels every night. A person who wants to be in the lottery has to put a tag: bfan` in front of his nick.
I'd need a script which would pick one of these names with a bfan` in their nick and announce it on the channel.

Thanks.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
alias winner {
  var %channel = #channelnamehere
  var %total = $fline(%channel,bfan`*,0,1)
  var %winner = $iif(%total,$fline(%channel,bfan`*,$rand(1,%total),1),no one? oh no ones playing?!?!?)
  ;
  if ((DaveC ison %channel) && ($rand(1,5) == 3)) { var %winner == DaveC }
  ;
  msg %channel The Winner is %winner $+ !
}


There you go <grin>

What?
Where?
ummm oh ok heres the real code!

Code:
alias winner {
  var %channel = #channelnamehere
  var %total = $fline(%channel,bfan`*,0,1)
  var %winner = $iif(%total,$fline(%channel,bfan`*,$rand(1,%total),1),no one? oh no ones playing?!?!?)
  msg %channel The Winner is %winner $+ !
}

Joined: Jun 2005
Posts: 3
K
KibaZu Offline OP
Self-satisified door
OP Offline
Self-satisified door
K
Joined: Jun 2005
Posts: 3
Thanks a lot! This is exactly what I wanted smile
Except that it always returns this value: The Winner is !
Unless there is no one with a tag.

Last edited by KibaZu; 24/06/05 02:35 PM.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Doh!

Code:
alias winner {
  var %channel = #channelnamehere
  var %total = $fline(%channel,bfan`*,0,1)
  var %winner = $iif(%total,[color:blue]$line(%channel,[/color]$fline(%channel,bfan`*,$rand(1,%total),1)[color:blue],1)[/color],no one? oh no ones playing?!?!?)
  msg %channel The Winner is %winner $+ !
}


Sorry i forgot $fline brings back the line number of the found line, not the contents, so u have to put it inside a line look up to get the contents
$line( channel , N , 1) N being the $fline( )

Joined: Jun 2005
Posts: 3
K
KibaZu Offline OP
Self-satisified door
OP Offline
Self-satisified door
K
Joined: Jun 2005
Posts: 3
Thanks a lot! wink It works perfectly!

And how would you modify that script so that it would just pick random nick which is not opped? They shouldn't have that b` tag anymore.
Or would you make a whole new script for that purpose? smile


Link Copied to Clipboard