/op /mode # +ooo $$1 $2 $3
/dop /mode # -ooo $$1 $2 $3 
/j /join #$$1 $2- | /splay  $mircdirsounds\join.wav
/cc /clearall
/opme /.msg chanserv op $chan $me
/deopme /.msg chanserv deop $chan $me
/pingme /ctcp $me ping
/p /part # 15,1  4,1SakaryA ScripT 4,1
/w /whois $$1
/k /kick # $$1 15,1 4,1SakaryA ScripT 4,1 { /splay $mircdirsounds/Kick.wav }
/q /query $$1
/p /part #
/n notice $$1 $2-
/cls /clear
/send /dcc send $1 $2
/chat /dcc chat $1
/ping /ctcp $$1 ping
/pass /nickserv identify $1
/umode /mode $me $1-
cF2 .msg nickserv identify $$?*="Enter Your Identify Password"
/cbox {
  /say  $+ $2 $+ , $+ $2 $3- 
  /say  $+ $1 $+ , $+ $2 $3- 1,1 
  /say  $+ $2 $+ , $+ $2 $3- 1,1 
  /say 0,0 01,01 $3- 
}
/about {
  /window -a @About 100 100 335 270
  /titlebar @About SakaryA Script by  &McKruGer
  /aline @About %b&rversion 4By 44M4c8K2r13u4G12e1r
  /aline @About Thanks for using 4SakaryA1Script.  
  /aline @About Gosh, who would of thought that SakaryA Script
  /aline @About would be such a big hit! Everyone who 
  /aline @About we know who has it, loves it! And they are impressed!
  /aline @About Wow, we still can't believe it, and we doubt you can either
  /aline @About We spent over 50 hours on this script, and it 
  /aline @About payed off!  
  /aline @About We really, really, REALLY, hope you enjoy it as much as we 
  /aline @About do, and once again, we ask you to contact me with bug 
  /aline @About reports, and comments!
  /aline @About Thanks again for using the SakaryA Script
  /aline @About /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  /aline @About Please, Enjoy SakaryA Script and
  /aline @About be on the look out for v2.0 
  /aline @About ----------------------------------------------------
  /aline @About E-Mail  at Beyaz@Europe.com
  /aline @About And e-mail McKruGer at Beyaz@Europe.com
  /aline @About Find us in #SakaryA on SuperOnline 
  /aline @About l8r
}
/advertz {
  /say %b&rversion 4By 44 McKruGer 4Download Site : http://www.Sakarytr.cjb.nEt
}
; ReCreate Log Windows
/rlogs {


}
; Time - 0 = military h:m:s / 1 = military h:m / 2 = standard h:m:s am/pm / 3 = standard h:m am/pm
; ////// 4 = standard h:m:s / 5 = standard h:m
; Use like so: <command> <other command info> $lavatime(<format num>) <other command info>
; Example: //echo The current time is: $lavatime(5)
/lavatime {
  if ($1 == 0) /set %ltrval $time
  elseif ($1 == 1) {
    /set %temp1 $time
    /set %temp2 $len(%temp1)
    /dec %temp2
    /dec %temp2
    /dec %temp2
    /set %ltrval $mid(%temp1,1,%temp2)
    /unset %temp1
    /unset %temp2
  }
  elseif ($1 == 2) {
    /set %temp1 $time
    /if ($len(%temp1) == 7) {
      /set %th $mid(%temp1,1,1)
      /set %tm $mid(%temp1,3,2)
      /set %ts $mid(%temp1,6,2)
      /set %ap AM
      /if (%th == 0) /set %th 12
    } 
    else {
      /set %th $mid(%temp1,1,2)
      /set %tm $mid(%temp1,4,2)
      /set %ts $mid(%temp1,7,2)
      /if (%th < 12) /set %ap AM
      elseif (%th == 12) /set %ap PM
      else {
        /set %th %th - 12
        /set %ap PM
      }
    }
    /set %ltrval %th $+ : $+ %tm $+ : $+ %ts %ap
    /unset %temp1
    /unset %th
    /unset %tm
    /unset %ts
    /unset %ap
  }
  elseif ($1 == 3) {
    /set %temp1 $time
    /if ($len(%temp1) == 7) {
      /set %th $mid(%temp1,1,1)
      /set %tm $mid(%temp1,3,2)
      /set %ap AM
      /if (%th == 0) /set %th 12
    } 
    else {
      /set %th $mid(%temp1,1,2)
      /set %tm $mid(%temp1,4,2)
      /if (%th < 12) /set %ap AM
      elseif (%th == 12) /set %ap PM
      else {
        /set %th %th - 12
        /set %ap PM
      }
    }
    /set %ltrval %th $+ : $+ %tm %ap
    /unset %temp1
    /unset %th
    /unset %tm
    /unset %ap
  }
  elseif ($1 == 4) {
    /set %temp1 $time
    /if ($len(%temp1) == 7) {
      /set %th $mid(%temp1,1,1)
      /set %tm $mid(%temp1,3,2)
      /set %ts $mid(%temp1,6,2)
      /if (%th == 0) /set %th 12
    } 
    else {
      /set %th $mid(%temp1,1,2)
      /set %tm $mid(%temp1,4,2)
      /set %ts $mid(%temp1,7,2)
      /if (%th > 12) /set %th %th - 12
    }
    /set %ltrval %th $+ : $+ %tm $+ : $+ %ts
    /unset %temp1
    /unset %th
    /unset %tm
    /unset %ts
  }
  elseif ($1 == 5) {
    /set %temp1 $time
    /if ($len(%temp1) == 7) {
      /set %th $mid(%temp1,1,1)
      /set %tm $mid(%temp1,3,2)
      /if (%th == 0) /set %th 12
    } 
    else {
      /set %th $mid(%temp1,1,2)
      /set %tm $mid(%temp1,4,2)
      /if (%th > 12) /set %th %th - 12
    }
    /set %ltrval %th $+ : $+ %tm
    /unset %temp1
    /unset %th
    /unset %tm
  }
  return %ltrval
  /unset %ltrval
}
-
; Channel Resynch
/resynch {
  /set %i $opnick($1,0)
  /msg $1 1================================================
  /msg $1 6                                 $1 3Resynch
  /msg $1 1================================================
  :rloop1
  /if (%i > 0) {
    /if (($opnick($1,%i) != $me) && ($opnick($1,%i) != ChanServ)) {
      /mode $1 -o $opnick($1,%i)
    }
    /dec %i
    goto rloop1
  }
  /set %i $vnick($1,0)
  :rloop2
  /if (%i > 0) {
    /if (($vnick($1,%i) != $me) && ($vnick($1,%i) != ChanServ)) {
      /mode $1 -v $vnick($1,%i)
    }
    /dec %i
    goto rloop2
  }
  /set %i $opnick($1,0)
  :rloop3
  /if (%i > 0) {
    /if (($opnick($1,%i) != $me) && ($opnick($1,%i) != ChanServ)) {
      /mode $1 +o $opnick($1,%i)
    }
    /dec %i
    goto rloop3
  }
  /set %i $vnick($1,0)
  :rloop4
  /if (%i > 0) {
    /if (($vnick($1,%i) != $me) && ($vnick($1,%i) != ChanServ)) {
      /mode $1 +v $vnick($1,%i)
    }
    /dec %i
    goto rloop4
  }
}
; Away Stuff
/iamaway {
  /set %temp1 $calc($ctime - %tgone)
  /amsg 6 $me 4has been 12away because:8 %reasonaway 2since8 %timeaway 4for6 $duration(%temp1) $+ 11.
  /if (%pageron == 1) {
    /amsg 6To page 10me, 3type: 7/ctcp6 $me 5PAGE 1<message>
  }
  /unset %temp1
}
/aanowon {
  /.enable #autoaway
  /set %isaway 1
  /set %isaway2 ON
  /set %timeaway $lavatime(3)
  /set %reasonaway $?="Reason you are going away:"
  /.away %reasonaway
  /.timer11 off
  /if (%isan == 1) /nick %annick | /unset %annick
  /set %isan $?="Change nick to awaynick (1 = yes, 0 = no):"
  /if (%isan == $null) /set %isan 0
  /if (%isan != 0 && %isan != 1) /set %isan 0
  /if (%isan == 1) {
    /set %annick $me
    /nick %ancnick
  } 
  /set %pageron $?="Set Pager On (1 = yes, 0 = no):"
  /if (%pageron == $null) /set %pageron 0
  /if (%pageron != 0 && %pageron != 1) /set %pageron 0
  /set %tmwg 0
  /amsg 6 $me 4 has been 12away because:8 %reasonaway $+ 2.
  /if (%pageron == 1) {
    /amsg 6To page 10me, 3type: 7/ctcp6 $me 5PAGE 1<message>
  }
  /.timer5 0 $?="Time between away notifications:" /iamaway
  /set %tgone $ctime
}
/aanowoff {
  /.disable #autoaway
  /set %isaway 0
  /set %isaway2 OFF
  /if (%isan == 1) /nick %annick | /unset %annick | /set %isan 0
  /set %pageron 0
  /.away
  /set %temp1 $calc($ctime - %tgone)
  /aline @AwayLog [[ Total Messages : %tmwg ]] [[ Gone For : $duration(%temp1) ]]
  /.timer5 off
  /amsg 6 $me 3is now 2back8 (let's throw money to him). 7He was 9gone2 for9 $duration(%temp1) $+ 5.
  /unset %temp1
  /unset %tgone
  /unset %timeaway
}
/aaidle {
  if ($idle >= %aaidletime) {
    /.enable #autoaway
    /set %isaway 1
    /set %isaway2 OFF
    /set %timeaway $lavatime(3)
    /set %reasonaway Auto Away
    /set %tgone $ctime
    /.away %reasonaway
    /.timer11 off
    /set %aatime 0
    /set %aatime2 OFF
    /if (%isan == 1) /nick %annick | /unset %annick
    /if (%aaidlenick == 1) {
      /set %annick $me
      /nick %ancnick
      /set %isan 1
    }
    /if (%aaidlepage == 1) /set %pageron 1
    else /set %pageron 0 
    /set %tmwg 0
    /amsg 6 $me 4is 8away 11 becuase hes been13 %reasonaway $+ 5.
    /if (%pageron == 1) {
      /amsg 6To page 10me, 3type: 7/ctcp6 $me 5PAGE 1<message>
    }
    /.timer5 0 $?="Time between anouncements:" /iamaway
  }
}
/encrypt {
  /if ($2 == $null) /set %temp4 $?="Encrypted Message to Send:"
  else /set %temp4 $2-
  /set %temp5 $encryptmsg(%temp4)
  /msg $$1 5Encrypted Message2 %temp5
  /echo 6mirk3cript 7has 8decrypted 7an 8encrypted 2message 10from6 $me $+ :16 $decryptmsg(%temp5)
  /unset %temp4
  /unset %temp5  
}
/decrypt {
  /if ($2 == $null) /set %temp4 $?="Message to Decrypt:"
  else /set %temp4 $2-
  /echo $active 6mirk3cript 7has 8decrypted 7an 8encrypted 2message 10from6 $$1 $+ :16 $decryptmsg(%temp4)
  /unset %temp4
}
/encrypt2 {
  /if ($1 == $null) /set %temp4 $?="Encrypted Message to Send:"
  else /set %temp4 $1-
  /set %temp5 $encryptmsg(%temp4)
  /echo 5Encrypted Message2 %temp5
  /echo 6mirk3cript 7has 8decrypted 7an 8encrypted 2message 10from6 $me $+ :16 $decryptmsg(%temp5)
  /unset %temp4
  /unset %temp5
}
/encryptmsg {
  /if ($1 == $null) return $null
  /set %temp1 $1-
  /set %temp2 1
  /set %temp3 $len(%temp1)
  /set %temp4 
  :encloop1
  /if (%temp2 <= %temp3) {
    /set %temp5 $rand(1,9)
    /set %temp6 $asc($mid(%temp1,%temp2,1) + %temp5)
    /set %temp4 %temp4 $+  $+ $len($asc($mid(%temp1,%temp2,1))) $+  $+ %temp5 $+ %temp6
    /inc %temp2
    /goto encloop1
  }
  /unset %temp1
  /unset %temp2
  /unset %temp3
  /unset %temp5
  /unset %temp6
  return $backwards(%temp4)
}
/decryptmsg {
  /if ($1 == $null) return $null
  /set %temp1 $backwards($1-)
  /set %temp2 1
  /set %temp3 $len(%temp1)
  /set %temp4
  /set %temp6 0
  :encloop2
  /if (%temp2 <= %temp3) {
    %temp6 = %temp2 + 4
    /if ($mid(%temp1,%temp6,2) == 32) {
      /inc %temp2 7
      /set %temp5 $mid(%temp1,%temp2,1)
      /inc %temp2 3
      /set %temp4 %temp4 $+ $chr(32) $+ $chr($mid(%temp1,%temp2,%temp5))
      /inc %temp2 %temp5
      /goto encloop2
    }
    else {
      /inc %temp2
      /set %temp5 $mid(%temp1,%temp2,1)
      /inc %temp2 3
      /set %temp4 %temp4 $+ $chr($mid(%temp1,%temp2,%temp5))
      /inc %temp2 %temp5
      /goto encloop2
    }
  }
  /unset %temp1
  /unset %temp2
  /unset %temp3
  /unset %temp5
  /unset %temp6
  return %temp4
}
/backwards {
  /if ($1 == $null) return $null
  /set %temp1 $1-
  /set %temp2 $len(%temp1) + 1
  /set %temp3
  :encloop3
  /dec %temp2
  /if (%temp2 > 0) {
    /if ($mid(%temp1,%temp2,1) == $chr(32)) {
      /dec %temp2
      /set %temp3 %temp3 $mid(%temp1,%temp2,1)
      /goto encloop3
    }
    /set %temp3 %temp3 $+ $mid(%temp1,%temp2,1)
    /goto encloop3
  }
  /unset %temp1
  /unset %temp2
  return %temp3
  /unset %temp3
}
jbinit {
  set %wavedir $$sdir="Directory for Wave Files"
  set %mididir $$sdir="Directory for MIDI Files"
  set %mp3dir $$sdir="Directory for Mp3 Files"
  set %mp3player $$dir="Select a MP3 Player" *.exe
}
jblist {
  clear @JukeBox
  aline @JukeBox $findfile(%wavedir,*.wav,@JukeBox)
  dline @JukeBox $line(@JukeBox,0,0)
  aline @JukeBox $findfile(%mididir,*.mid,@JukeBox)
  dline @JukeBox $line(@JukeBox,0,0)
  aline @JukeBox $findfile(%mp3dir,*.mp3,@JukeBox)
  dline @JukeBox $line(@JukeBox,0,0)
  aline @JukeBox $findfile(%mp3dir,*.m3u,@JukeBox)
  dline @JukeBox $line(@JukeBox,0,0)
  aline @JukeBox $findfile(%mp3dir,*.pls,@JukeBox)
  dline @JukeBox $line(@JukeBox,0,0)
}
jbplay {
  if (.wav isin $nopath($1-)) {
    splay " $+ $1- $+ "
    set %wavcur $1-
  }
  else if (.mid isin $nopath($1-)) {
    splay " $+ $1- $+ "
    set %midcur $1-
  }
  else if (.mp3 isin $nopath($1-)) {
    run %mp3player " $+ $1- $+ "
  }
  else {
    message Unknown file type
  }
}
wranplay {
  :redow
  set %temp0 $rand(1,$line(@JukeBox,0,0))
  if (.wav isin $nopath($line(@JukeBox,%temp0,0))) {
    splay " $+ $line(@JukeBox,%temp0,0) $+ "
  }
  else {
    goto redow
  }
  unset %temp0
}
mranplay {
  :redom
  set %temp0 $rand(1,$line(@JukeBox,0,0))
  if (.mid isin $nopath($line(@JukeBox,%temp0,0))) {
    splay " $+ $line(@JukeBox,%temp0,0) $+ "
  }
  else {
    goto redom
  }
  unset %temp0
}
mpranplay {
  :redomp
  set %temp0 $rand(1,$line(@JukeBox,0,0))
  if (.mp3 isin $nopath($line(@JukeBox,%temp0,0))) {
    run %mp3player " $+ $line(@JukeBox,%temp0,0) $+ "
  }
  else {
    goto redomp
  }
  unset %temp0
}
ransong {
  set %temp0 $rand(1,$line(@JukeBox,0,0))
  if (.mp3 isin $nopath($line(@JukeBox,%temp0,0))) {
    run %mp3player " $+ $line(@JukeBox,%temp0,0) $+ "
  }
  else {
    splay " $+ $line(@JukeBox,%temp0,0) $+ "
  }
  unset %temp0
}
; ASCII text
; Thanks SiLo1 for this!!
cw {
  set %rk *1
  %rk = $replace(%rk,0,0)
  %rk = $replace(%rk,1,)
  %rk = $replace(%rk,2,)
  %rk = $replace(%rk,3,)  
  %rk = $replace(%rk,ae,)
  %rk = $replace(%rk,a,)
  %rk = $replace(%rk,b,)
  %rk = $replace(%rk,c,)
  %rk = $replace(%rk,d,)
  %rk = $replace(%rk,e,)
  %rk = $replace(%rk,f,F)
  %rk = $replace(%rk,g,G)
  %rk = $replace(%rk,h,H)
  %rk = $replace(%rk,i,)
  %rk = $replace(%rk,j,J)
  %rk = $replace(%rk,k,K)
  %rk = $replace(%rk,l,)
  %rk = $replace(%rk,m,M)
  %rk = $replace(%rk,n,)
  %rk = $replace(%rk,o,)
  %rk = $replace(%rk,p,P)
  %rk = $replace(%rk,q,q)
  %rk = $replace(%rk,r,)
  %rk = $replace(%rk,s,)
  %rk = $replace(%rk,t,T)
  %rk = $replace(%rk,u,)
  %rk = $replace(%rk,v,V)
  %rk = $replace(%rk,w,\\`)
  %rk = $replace(%rk,x,)
  %rk = $replace(%rk,y,)
  %rk = $replace(%rk,z,Z)
  %rk = $replace(%rk,?,)
  %rk = $replace(%rk,!,!)
  say %rk
  unset %rk
}
/cpscheck { 
  if ($send(0) == 0) { halt }
  set %cpscheckloops 1
  :start1
  if $send(%cpscheckloops).cps == n/a goto start2
  if $send(%cpscheckloops).cps == 0 goto start2
  if $send(%cpscheckloops).cps < %fserv.min.cps {
    /notice $send(%cpscheckloops) 3I'm sorry, but your send fell below7 %fserv.min.cps 3so it was stopped!
    /close -s $send(%cpscheckloops)
    { goto start2 } 
    if ($send(%cpscheckloops).lra < 30000) { goto start2 }
    :start2
    inc %cpscheckloops
    if (%cpscheckloops <= $send(0)) { goto start1 }
    /unset %cpscheckloops 
  }
  cF2 .msg nickserv identify $$?*="Enter Your Identify Password"
