Choose random user

By eivind90 on Jun 28, 2007

This is an easy (and useless) script to choose a random user for a channel
(This script does not choose people who are voice/op)

Please comment.

on *:text:!random*:#channel:{
if ($nick !isop $chan) { msg $chan Your not OPed. }
if ($me isop $chan) {
set %random $nick($chan,$rand(1,$nick($chan,0)),r) || msg $chan <you text (?!)> %random <your-text (?!)> | unset %random }
}

Example:

on *:text:!random:#acom:{
if ($nick !isop $chan) { msg $chan Your not OPed. }
if ($me isop $chan) {
set %random $nick($chan,$rand(1,$nick($chan,0)),r) || msg $chan The winner is: %random $+ !! | unset %random }
}

Comments

Sign in to comment.
xDaeMoN   -  Jun 28, 2007
$nick($chan,$rand(1,$nick($chan,0)),r)

should be

$nick($chan,$rand(1,$nick($chan,0,r)),r)

Notice the \"r\" in \"$nick($chan...\" in the middle. This is to get the correct number of regular users. Yours will get the total number of users in the channel and it would give you an error if the random number higher than the number of the regular users.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.