Advertisement
westor

Cricket Announcer for DeMoN v1.0

Jun 29th, 2019
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.62 KB | None | 0 0
  1. ON *:JOIN:#: {
  2.   if ($nick == $me) && (%cricket_ [ $+ [ $chan ] ]) { .timer[CRICKET_ $+ $chan $+ ] 0 300 cricket $chan }
  3. }
  4.  
  5. ON *:TEXT:!*:#: {
  6.   tokenize 32 $strip($1-)
  7.  
  8.   if ($1 == !cricket) {
  9.     if (!$2) {
  10.       if (!%cricket_ [ $+ [ $chan ] ]) { set -eu1 %cricket_ $+ $chan 1 }
  11.       cricket $chan
  12.       return
  13.     }
  14.  
  15.     if ($2) && ($2 !== ON) && ($2 !== OFF) { msg $chan $nick Error, Cricket AUTO Announcer, Please enter ON or OFF option! | return }
  16.  
  17.     if ($2 == ON) {
  18.       if (%cricket_ [ $+ [ $chan ] ]) { msg $chan $nick Error, Cricket AUTO Announcer is already enabled for this channel! | return }
  19.       set %cricket_ $+ $chan 1
  20.       msg $chan $nick Cricket AUTO Announcer has just enabled for this channel.
  21.       .timer[CRICKET_ $+ $chan $+ ] 0 300 cricket $chan
  22.     }
  23.     if ($2 == OFF) {
  24.       if (!%cricket_ [ $+ [ $chan ] ]) { msg $chan $nick Error, Cricket AUTO Announcer is already disabled for this channel! | return }
  25.       set %cricket_ $+ $chan 0
  26.       msg $chan $nick Cricket AUTO Announcer has just disabled for this channel.
  27.       .timer[CRICKET_ $+ $chan $+ ] off
  28.     }
  29.   }
  30.  
  31. }
  32.  
  33. alias cricket {
  34.   if (!$1) || ($1 !ischan) || (!%cricket_ [ $+ [ $1 ] ]) { return }
  35.   var %s = cricket_ $+ $rand(1,100000000000)
  36.   sockclose %s
  37.   sockopen %s cricscore-api.appspot.com 80
  38.   sockmark %s $1
  39. }
  40.  
  41. ON *:SOCKOPEN:cricket_*:{
  42.   if ($sockerr) {
  43.     var %chan = $sock($sockname).mark
  44.     if ($me ison %chan) { msg %chan Cricket: Error opening socket! - Error Details: $sock($sockname).wsmsg }
  45.     return
  46.   }
  47.  
  48.   sockwrite -nt $sockname GET /csa?id=1144513 HTTP/1.1
  49.   sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0
  50.   sockwrite -nt $sockname Content-Type: application/json
  51.   sockwrite -nt $sockname Host: $sock($sockname).addr
  52.   sockwrite -nt $sockname $crlf
  53. }
  54.  
  55. ON *:SOCKREAD:cricket_*:{
  56.   if ($sockerr) {
  57.     var %chan = $sock($sockname).mark
  58.     if ($me ison %chan) { msg %chan Cricket: Error reading socket! - Error Details: $sock($sockname).wsmsg }
  59.     sockclose $sockname
  60.     return
  61.   }
  62.  
  63.   var %x
  64.   sockread %x
  65.  
  66.   if (*HTTP/1.1* iswm %x) && (*200* !iswm %x) {
  67.     var %chan = $sock($sockname).mark
  68.     if ($me ison %chan) { msg %chan Cricket: Error parsing socket! - Error Details: %x }
  69.     sockclose $sockname
  70.     return  
  71.   }
  72.  
  73.   if ($+(*,$chr(123),*) iswm %x) {
  74.     var %chan = $sock($sockname).mark
  75.  
  76.     if ($me ison %chan) { msg %chan 3༒2ẸČĹĮƤŜẸ ŜČŘĮƤŤ3༒ 1||5 Cʀɪᴄᴋᴇᴛ UᴘᴅᴀᴛᴇS 1||3 $gettok(%x,4,34) 1||3 $gettok(%x,8,34) }
  77.  
  78.     sockclose $sockname
  79.   }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement