|
DjJax
|
DjJax
|
hi , i have this Ops: 9.38% ˜˜˜˜˜˜˜˜˜ with my add on
and i want this llllllllllllllllllllllll 3 (9.1%) i want one decimal ,please any help THNX
alias caca { set %ops $calc( $nick(#,0,o) * 100 / $nick(#,0) ) set %voice $calc( $nick(#,0,v) * 100 / $nick(#,0) ) set %half $calc( $nick(#,0,h) * 100 / $nick(#,0) ) set %rops $round(%ops,2) set %rvoi $round(%voice,2) set %rhalf $round(%half,2) .echo -a Ops: %rops $str($chr(152),%rops) if %voice != 0 { .echo -a Voice : %rvoi $str($chr(152),%rvoi) } if %half != 0 { .echo -a Half : %rhalf $str($chr(152),%rhalf) } if %voice == 0 { halt } if %half == 0 { halt } }
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
To get the one decimal, all you needed to do was change the rounding from ,2 to ,1 There are a few other items that I noticed that might cause problems and/or could be improved. Example: usage of # for the channel name in an alias is not guaranteed. Some people have reported that it works, while others have said that it doesn't. To be on the safe side, you should pass the channel name to the alias as a parameter. Here's the full code with all of the suggestions/alterations that I was able to think of included. alias caca {
$iif($round($calc($nick($1,0,o) * 100 / $nick($1,0)),1),.echo -a Ops: $v1 $str($chr(152),$v1))
$iif($round($calc($nick($1,0,v) * 100 / $nick($1,0)),1),.echo -a Voice: $v1 $str($chr(152),$v1))
$iif($round($calc($nick($1,0,h) * 100 / $nick($1,0)),1),.echo -a Half-Ops: $v1 $str($chr(152),$v1))
}
Menu nicklist,channel {
Caca : caca $chan
}
Usage: right click in channel or nicklist, then select Caca P.S.: Next time you post code in the forums, please use the Code Tags.
|
|
|
|
Taggnostr
|
Taggnostr
|
I made this function for my bot
on *:text:!users:#:{
msg $chan 12Info users ( $+ $chan $+ ): 04 $+ $nick($chan,0) $+ users $&
$iif($nick(#,0,o),$+(- 04,$ifmatch,,$chr(32),ops,[,$round($calc($nick(#,0,o) * 100 / $nick(#,0)),2),%,])) $&
$iif($nick(#,0,h,o),$+(- 04,$ifmatch,,$chr(32),halfops,[,$round($calc($nick(#,0,h,o) * 100 / $nick(#,0)),2),%,])) $&
$iif($nick(#,0,v,oh),$+(- 04,$ifmatch,,$chr(32),voiced,[,$round($calc($nick(#,0,v,oh) * 100 / $nick(#,0)),2),%,])) $&
$iif($nick(#,0,r,voh),$+(- 04,$ifmatch,,$chr(32),regular,[,$round($calc($nick(#,0,r,voh) * 100 / $nick(#,0)),2),%,]))
}
it will show something like this Info users (#chan): 48 users - 11 ops[22.92%] - 5 halfops[10.42%] - 2 voiced[4.17%] - 30 regular[62.5%] if there are not ops, halfops or voiced it won't show them Info users (#chan2): 6 users - 3 ops[50%] - 1 voiced[16.67%] - 2 regular[33.33%] if a user is op and voiced (for example) at the same time the bot will count just the higher grade.
|
|
|
|
|