;iddaa sorgulama
;release: 0.1
;Author: Alience
on *:text:!iddaa*:#iddaa: {
  if $sock(ida) { msg $chan $nick şu anda iişlem yapılıyor biraz sonra tekrar deneyin! | return }
  hadd -m iddaa chan $chan
  hadd -m iddaa nick $nick
  if $regex($2,^\d\d(\.|\\|\/|\-)\d\d(\.|\\|\/|\-)\d\d\d\d) && !$3 { 
    if $calc(($ctime($date) - $ctime($2)) / 86400) < 30 { hadd -m iddaa type count | hadd -m iddaa date $2 | ida $calc(($ctime($date) - $ctime($2)) / 86400) }
    else { msg $chan $nick 30 günden erken olan maçlara bakabilirsiniz! | return }
  }
  elseif $regex($2,^\d\d(\.|\\|\/|\-)\d\d(\.|\\|\/|\-)\d\d\d\d)  {
    if $regex($3,^\d\d\d$) { 
      echo oke
      hadd -m iddaa type code
      hadd -m iddaa match $3
      hadd -m iddaa date $2 
      ida $calc(($ctime($date) - $ctime($2)) / 86400)
    }
    elseif $regex($3,^(\d\d|\d)$) {
      ;sayfa istemi
      hadd -m iddaa type page
      hadd -m iddaa match $3
      hadd -m iddaa date $2 
      hadd -m iddaa end $calc($3 + 6)
      ida $calc(($ctime($date) - $ctime($2)) / 86400)
    }
  }
  elseif !$2 {
    hadd -m iddaa type count | hadd -m iddaa date 0 | ida 0
  }
  elseif $regex($2,^\d\d\d$) { 
    hadd -m iddaa type code
    hadd -m iddaa match $2
    hadd -m iddaa date 0
    ida 0
  }
  elseif $regex($2,^(\d\d|\d)$) {
    ;sayfa istemi
    hadd -m iddaa type page
    hadd -m iddaa match $2
    hadd -m iddaa date 0 
    hadd -m iddaa end $calc($2 + 6)
    ida 0
  }
}
alias ida {
  sockopen ida 
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...] 80
  hadd -m iddaa count 0
  if $1 { hadd -m iddaa request $1 }
  else { hdel -m iddaa request }
}
on *:sockopen:ida: {
  sockwrite -n $sockname GET 
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]= $+ $iif($hget(iddaa,request),$v1,0) HTTP/1.1 $crlf   
  sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) $crlf  
  sockwrite -n $sockname Accept: */* $crlf   
  sockwrite -n $sockname Host: 
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...] $crlf  
  sockwrite -n $sockname Connection: Keep-Alive $+ $crlf $+ $crlf
}
on *:sockread:ida: {  
  var %gstr, %match = 0
  sockread %gstr 
  if $regex(%gstr,<Match) { hdel -m iddaa temp }
  if $regex(%gstr,matchkod=) { 
    hadd -m iddaa temp $hget(iddaa,temp) KOD: $+ $noqt($regsubex(%gstr,(^.*=),$null)) 
    if $hget(iddaa,type) == code { 
      if $hget(iddaa,match) == $noqt($regsubex(%gstr,(^.*=),$null)) {     
        hadd -m iddaa type codeok
      }
    }
  }
  if $regex(%gstr,takimlar=) {  hadd -m iddaa temp $hget(iddaa,temp) Takımlar: $+ $remove($strip($regsubex(%gstr,(^.*=),$null)),") }
  if $regex(%gstr,lig=) {  hadd -m iddaa temp $hget(iddaa,temp)  Lig: $+ $noqt($regsubex(%gstr,(^.*=),$null)) }
  if $regex(%gstr,scorehalfhome=) {  hadd -m iddaa temp $hget(iddaa,temp)  İlk Yarı: $+ $noqt($regsubex(%gstr,(^.*=),$null)) $+ - }
  if $regex(%gstr,scorehalfaway=) {  hadd -m iddaa temp $hget(iddaa,temp)  $+ $noqt($regsubex(%gstr,(^.*=),$null))  }
  if $regex(%gstr,scorecurrenthome=) {  hadd -m iddaa temp $hget(iddaa,temp)  Maç Sonucu: $+ $noqt($regsubex(%gstr,(^.*=),$null)) $+ - }
  if $regex(%gstr,scorecurrentaway=) {  hadd -m iddaa temp $hget(iddaa,temp)  $+ $noqt($regsubex(%gstr,(^.*=),$null))  }
  if $regex(%gstr,</Match>) { 
    if $hget(iddaa,type) == count {
      hinc iddaa count 1
    }
    else {
      if $hget(iddaa,type) == codeok {
        msg $hget(iddaa,chan) $hget(iddaa,nick) $ghta($hget(iddaa,temp))
        sockclose $sockname
      }
      elseif $hget(iddaa,type) == page {
        hinc iddaa count 1
        if $hget(iddaa,count) >= $hget(iddaa,match) && $hget(iddaa,count) < $hget(iddaa,end) {
          msg $hget(iddaa,chan) $hget(iddaa,nick) $ghta($hget(iddaa,temp))
        }
        if $hget(iddaa,count) >= $hget(iddaa,end) { sockclose $sockname | msg $hget(iddaa,chan) $hget(iddaa,nick) - iddaa listeleme SONU }
      }
    }
    hdel -m iddaa temp
  }
  if $regex(%gstr,</LiveScore>) {
    sockclose $sockname 
    if $hget(iddaa,type) == count {
      var %date = $hget(iddaa,date)
      if %date != 0 {
        msg $hget(iddaa,chan) $hget(iddaa,nick) %date tarihine ait toplam $hget(iddaa,count) maç sonucu mevcut, maç listesini görebilmek için !iddaa %date 1 
        msg $hget(iddaa,chan) $hget(iddaa,nick) %date tarihine ait koda göre arama yapmak için !iddaa %date kod yazmalısınız.
      }
      else {
        msg $hget(iddaa,chan) $hget(iddaa,nick) Bu güne ait toplam $hget(iddaa,count) maç sonucu mevcut, maç listesini görebilmek için !iddaa 1 
        msg $hget(iddaa,chan) $hget(iddaa,nick) Bu güne ait koda göre arama yapmak için !iddaa kod yazmalısınız.
      }
    }
    elseif $hget(iddaa,type) == page {
      msg $hget(iddaa,chan) $hget(iddaa,nick) - iddaa listeleme SONU
    }
  }
}
;ghta: get html code to ascii code 
;Author: Alience
;Date: 06/10/2009 
;release: 0.1
alias ghta {
  return $replace($1-,İ,İ,ı,ı,Ö,Ö,Ö,Ö,ö,ö,ö,ö,Ü,Ü,Ü,Ü,ü,ü,ü,ü,Ç,Ç,Ç,Ç,ç,ç,ç,ç,Ğ,Ğ,ğ,ğ,Ş,Ş,ş,ş,₤,€)
}