Advertisement
westor

Top smileys

Nov 11th, 2014
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.48 KB | None | 0 0
  1. ON !*:TEXT:*:#: {
  2.   if ($strip($1,burci) == !topsm) {
  3.     if ($2) && ($2 isnum) { var %num = $2 }
  4.     if (!$2) { var %num = 10 }
  5.     if ($2) && ($2 !isnum) { var %num 10 }
  6.     if (%num >= 100) { .msg $chan [ $+ $nick $+ ]: Error, Incorrect parameter, try again and use an smaller number than $qt(%num) max is 100! | return }
  7.     top5_smileys %num $chan
  8.     return
  9.   }
  10.   check_smileys $chan $nick $1-
  11. }
  12. ON !*:ACTION:*:#: { check_smileys $chan $nick $1- }
  13. ON !*:NOTICE:*:#: { check_smileys $chan $nick $1- }
  14.  
  15. alias check_smileys {
  16.   if (!$1-) { return }
  17.   var %t = $3-
  18.   var %sm = :D :X :P :) :( : $+ $chr(123) : $+ $chr(125) :[ :] :O :0 :* ^^ : $+ $chr(36) :S
  19.   var %i = 1
  20.   while (%i <= $numtok(%t,32)) {
  21.     var %text = $gettok(%t,%i,32)
  22.     var %ii = 1
  23.     while (%ii <= $numtok(%sm,32)) {
  24.       var %sml = $gettok(%sm,%ii,32)
  25.       if ($istok(%text,%sml,32)) {
  26.         var %tot_sml = $calc(%tot_sml +1)
  27.         var %last_sml = $addtok(%last_sml,%sml,32)
  28.       }
  29.       inc %ii
  30.     }
  31.     inc %i
  32.   }
  33.   if (%tot_sml) {
  34.     var %form = $1 $+ ~ $+ $2
  35.     var %sml_are = $readini(smileys.ini,n,%form,smileys)
  36.     var %res = $calc(%tot_sml + %sml_are)
  37.     writeini -n smileys.ini %form last_text %t
  38.     writeini -n smileys.ini %form last_smiley %last_sml
  39.     writeini -n smileys.ini %form smileys %res
  40.   }
  41. }
  42.  
  43. alias top5_smileys {
  44.   var %f = smileys.ini
  45.   if (!$isfile(%f)) { return }
  46.   if (!$lines(%f)) { return }
  47.   unset %topsml_nick
  48.   if ($window(@.)) { window -c @. }
  49.   if ($window(@ok)) { window -c @ok }
  50.   window -h @.
  51.   window -h @ok
  52.   loadbuf $lines(%f) @. $qt(%f)
  53.   var %t = $line(@.,0)
  54.   var %i = 1
  55.   while (%i <= %t) {
  56.     var %l = $line(@.,%i)
  57.     if (*smileys* iswm %l) && (%topsml_nick) { aline @ok %topsml_nick $remove(%l,smileys=) | unset %topsml_nick | goto next }
  58.     if ($left(%l,1) == [) {
  59.       var %tmp = $remove(%l,[,])
  60.       var %chn = $gettok(%tmp,1,126)
  61.       if (%chn !== $2) { goto next }
  62.       set -e %topsml_nick $gettok(%tmp,2,126)
  63.     }
  64.     :next
  65.     inc %i
  66.   }
  67.   unset %topsml_nick
  68.   filter -cetuww 2 32 @ok @ok
  69.   var %ii 1
  70.   while (%ii <= $1) {
  71.     var %list = $addtok(%list,$line(@ok,%ii),44)
  72.     inc %ii
  73.   }
  74.   if (%list) {
  75.     if ($me ison $2) { .msg $2 [ $+ $2 $+ ]: TOP $+ $1 Stats (smileys) are: $replace(%list,$chr(44),$+($chr(44),$chr(32))) }
  76.   }
  77.   elseif (!%list) {
  78.     if ($me ison $2) { .msg $2 [ $+ $2 $+ ]: There are NOT any stats available at the moment on my database! }
  79.   }
  80.   window -c @ok
  81.   window -c @.
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement