glacier_rat

Untitled

May 31st, 2010
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 3.52 KB | None | 0 0
  1. On $*:TEXT:/^[!@.]setvid/Si:#: {
  2.   if ($nick isvoice $chan) || ($nick ishop $chan) || ($nick isop $chan) {
  3.     if ($($+(*,$2,*)) iswm $readini(youtube.ini,Vids,Videos)) {
  4.       notice $nick This video has already been added! Please set another.
  5.     }
  6.     else {
  7.       writeini youtube.ini Vids Videos $readini(youtube.ini,Vids,Videos) $2
  8.       writeini youtube.ini Vids Vidnum $calc($readini(youtube.ini,Vids,Vidnum) + 1)
  9.       writeini youtube.ini Vids $readini(youtube.ini,Vids,Vidnum) $replace($2-,|,$chr(34))
  10.       writeini youtube.ini Ratings $readini(youtube.ini,Vids,Vidnum) 0
  11.       writeini youtube.ini Ratenum $readini(youtube.ini,Vids,Vidnum) 0
  12.       notice $nick Your youtube link has been saved. It's id number is $readini(youtube.ini,Vids,Vidnum) $+ . Type !vid $readini(youtube.ini,Vids,Vidnum) to see it.
  13.     }
  14.   }
  15.   else {
  16.     notice $nick You must have atleast voice to perform this command.
  17.   }
  18. }
  19. On $*:TEXT:/^[!@.]vid/Si:#: {
  20.   if ($2 isnum) && ($readini(youtube.ini,Vids,$2) != $null) {
  21.     $iif($left($1,1) == @,msg $chan,notice $nick) Youtube ID $2 $+ : $readini(youtube.ini,Vids,$2) $+ . Channel User Rating: $readini(youtube.ini,Ratings,$2)
  22.   }
  23.   else {
  24.     notice $nick The Youtube ID $2 doesn't exist, please try another.
  25.   }
  26. }
  27. On $*:TEXT:/^[!@.]clearvid/Si:#: {
  28.   if ($nick isop $chan) {
  29.     if ($2 == all) {
  30.       remini youtube.ini Vids
  31.       remini youtube.ini Ratings
  32.       remini youtube.ini Ratenum
  33.       remini youtube.ini Rated
  34.       notice $nick All Youtube links and ratings have been removed.
  35.     }
  36.     elseif ($2 isnum) && ($readini(youtube.ini,Vids,$2) != $null) {
  37.       remini youtube.ini Vids $2
  38.       remini youtube.ini Ratings $2
  39.       remini youtube.ini Ratenum $2
  40.       remini youtube.ini Rated $2
  41.       notice $nick Youtube video $2 has been removed and it's ratings purged.
  42.     }
  43.     else {
  44.       notice $nick This Youtube link ID doesn't exist, please try another.
  45.     }
  46.   }
  47.   else {
  48.     notice $nick You must be a channel operator to perform this command.
  49.   }
  50. }
  51. On $*:TEXT:/^[!@.]rate/Si:#: {
  52.   if ($($+(*,$nick,*)) iswm $readini(youtube.ini,Rated,$2)) {
  53.     notice $nick You have already rated this video, you can't rate twice!
  54.   }
  55.   elseif ($3 isnum 1-5) && ($readini(youtube.ini,Vids,$2) != $null) {
  56.     writeini youtube.ini Ratenum $2 $calc($readini(youtube.ini,Ratenum,$2) + 1)
  57.     writeini youtube.ini Ratings $2 $calc(($readini(youtube.ini,Ratings,$2) + $3) / $readini(youtube.ini,Ratenum,$2))
  58.     writeini youtube.ini Rated $2 $readini(youtube.ini,Rated,$2) $nick
  59.     notice $nick Your rating for this video has been added, it's average rating is now: $readini(youtube.ini,Ratings,$2)
  60.   }
  61.   else {
  62.     notice $nick Invalid Youtube ID/Rating. Please make sure the ID you have provided exists by using !vid [idnumber] and that your rating is between 1-5.
  63.   }
  64. }
  65. On $*:TEXT:/^[!.@]topvids/Si:#: {
  66.   if ($readini(youtube.ini,Ratings,1) != $null) {
  67.     if ($left($1,1) == @) {
  68.       set %z @
  69.     }
  70.     $iif($left($1,1) == @,msg $chan,notice $nick) Videos with a rating of 4 or higher:
  71.     topvids
  72.     unset %z
  73.   }
  74.   else {
  75.     $iif($left($1,1) == @,msg $chan,notice $nick) There are no videos that have a rating of 4 or more.
  76.   }
  77. }
  78. alias topvids {
  79.   var %g 1
  80.   while (%g <= $ini(youtube.ini,Ratings,0)) {
  81.     if ($readini(youtube.ini,Ratings,%g) >= 4) {
  82.       $iif(%z == @,msg $chan,notice $nick) $chr(149) $readini(youtube.ini,Vids,%g) with a rating of $readini(youtube.ini,Ratings,%g)
  83.     }
  84.     inc %g
  85.   }
  86. }
  87.  
  88. /* Will list all videos with a rating of 4 or more */
Add Comment
Please, Sign In to add comment