Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ON !*:TEXT:*:#: {
- if ($strip($1,burci) == !topsm) {
- if ($2) && ($2 isnum) { var %num = $2 }
- if (!$2) { var %num = 10 }
- if ($2) && ($2 !isnum) { var %num 10 }
- if (%num >= 100) { .msg $chan [ $+ $nick $+ ]: Error, Incorrect parameter, try again and use an smaller number than $qt(%num) max is 100! | return }
- top5_smileys %num $chan
- return
- }
- check_smileys $chan $nick $1-
- }
- ON !*:ACTION:*:#: { check_smileys $chan $nick $1- }
- ON !*:NOTICE:*:#: { check_smileys $chan $nick $1- }
- alias check_smileys {
- if (!$1-) { return }
- var %t = $3-
- var %sm = :D :X :P :) :( : $+ $chr(123) : $+ $chr(125) :[ :] :O :0 :* ^^ : $+ $chr(36) :S
- var %i = 1
- while (%i <= $numtok(%t,32)) {
- var %text = $gettok(%t,%i,32)
- var %ii = 1
- while (%ii <= $numtok(%sm,32)) {
- var %sml = $gettok(%sm,%ii,32)
- if ($istok(%text,%sml,32)) {
- var %tot_sml = $calc(%tot_sml +1)
- var %last_sml = $addtok(%last_sml,%sml,32)
- }
- inc %ii
- }
- inc %i
- }
- if (%tot_sml) {
- var %form = $1 $+ ~ $+ $2
- var %sml_are = $readini(smileys.ini,n,%form,smileys)
- var %res = $calc(%tot_sml + %sml_are)
- writeini -n smileys.ini %form last_text %t
- writeini -n smileys.ini %form last_smiley %last_sml
- writeini -n smileys.ini %form smileys %res
- }
- }
- alias top5_smileys {
- var %f = smileys.ini
- if (!$isfile(%f)) { return }
- if (!$lines(%f)) { return }
- unset %topsml_nick
- if ($window(@.)) { window -c @. }
- if ($window(@ok)) { window -c @ok }
- window -h @.
- window -h @ok
- loadbuf $lines(%f) @. $qt(%f)
- var %t = $line(@.,0)
- var %i = 1
- while (%i <= %t) {
- var %l = $line(@.,%i)
- if (*smileys* iswm %l) && (%topsml_nick) { aline @ok %topsml_nick $remove(%l,smileys=) | unset %topsml_nick | goto next }
- if ($left(%l,1) == [) {
- var %tmp = $remove(%l,[,])
- var %chn = $gettok(%tmp,1,126)
- if (%chn !== $2) { goto next }
- set -e %topsml_nick $gettok(%tmp,2,126)
- }
- :next
- inc %i
- }
- unset %topsml_nick
- filter -cetuww 2 32 @ok @ok
- var %ii 1
- while (%ii <= $1) {
- var %list = $addtok(%list,$line(@ok,%ii),44)
- inc %ii
- }
- if (%list) {
- if ($me ison $2) { .msg $2 [ $+ $2 $+ ]: TOP $+ $1 Stats (smileys) are: $replace(%list,$chr(44),$+($chr(44),$chr(32))) }
- }
- elseif (!%list) {
- if ($me ison $2) { .msg $2 [ $+ $2 $+ ]: There are NOT any stats available at the moment on my database! }
- }
- window -c @ok
- window -c @.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement