alias admin { return BURIAL }
alias slogan { return Server In Hell }
alias dc { return 09/09/2004 }
alias servername { return 127.0.0.1 }
alias welcome {
  sockwrite -n $1 : $+ 127.0.0.1 001 $1 :Welcome to Sux IRC Server!
  sockwrite -n $1 : $+ 127.0.0.1 002 $1 :Your host is $sock($sockname).ip
  sockwrite -n $1 : $+ 127.0.0.1 003 $1 :This server was created on $dc
  sockwrite -n $1 : $+ 127.0.0.1 251 $1 :There are $calc($sock(*,0)-5) user(s)
  sockwrite -n $1 : $+ 127.0.0.1 254 $1 :0 channel(s) formed
  sockwrite -n $1 : $+ 127.0.0.1 250 $1 :Total connections: $sock(*,0)
  sockwrite -n $1 : $+ 127.0.0.1 391 $1 : $+ [ $servername ] Thu Sep $date
  sockwrite -n $1 : $+ 127.0.0.1 375 $1 :- $servername Message of the day -
  motd $1
}
alias motd {
  if ($1) {
    var %ob6to = $lines(motd.txt)
    while (%ha != %ob6to) {
      inc %ha
      sockwrite -n $1 : $+ 127.0.0.1 372 $1 : - [ $read(motd.txt, g, %ha) ]
    }
    unset %ha
    sockwrite -n $1 : $+ 127.0.0.1 376 $1 :End of /MOTD command
  }
}
alias snotice {
  if ($1) {
    sockwrite -n $1 notice :-= [ SERVER MESSAGE ] =-
    var %ob6to = $lines(motd.txt)
    while (%ha != %ob6to) {
      inc %ha
      sockwrite -n $1 notice : $+ $read(motd.txt, g, %ha)
    }
    unset %ha
    sockwrite -n $1 notice :-= [ END OF MOTD ] =-
  }
}
alias ser {
  .hmake ircd 1000
  .hmake join 10000
  .hmake chan 10000
  socklisten server1 4000
  socklisten server2 6667
  socklisten server3 6668
  socklisten server4 6669
  socklisten server5 7000
  echo -a Server stared
  socklist
}
on *:SOCKLISTEN:*:{
  sockaccept user
  sockwrite -n user notice :Welcome to Sux IRC Network!
  sockwrite -n user notice :Listening on port 4000,6667,6668,6669,7000
  sockwrite -n user notice :Total users online: $calc($sock(*,0)-5)
  sockwrite -n user notice :Type /info for help
}
on *:SOCKCLOSE:*:{ sockwrite -n * $sockname has quit }
on *:SOCKREAD:*:{
  sockread %temp
  if ($sock(*,0) >= $hget(ircd).size) {
    sockwrite -n $sockname notice :The server is full ( $+ $hget(ircd).size users).Try again later.
    sockclose $sockname
    return
  }
  if ($gettok(%temp,1,32) == NICK) {
    if ($sock($sockname) == user) {
      if ($sock($remove($gettok(%temp,2,32),:)) == $remove($gettok(%temp,2,32),:)) {
        sockwrite -n $sockname notice :This nickname is being used by someone else.Please change it and connect again.
        sockclose $sockname
        return
      }
      sockrename $sockname $remove($gettok(%temp,2,32),:)
      welcome $sockname
      snotice $sockname
      sockwrite -n * notice : $+   $+ $sockname $+  ( $+ $sock($sockname).ip $+ ) has joined the party line
      return
    }
    else {
      if ($sock($remove($gettok(%temp,2,32),:)) != $remove($gettok(%temp,2,32),:)) {
        var %nick = $remove($sockname,:)
        sockwrite -n $sockname : $+ $sockname NICK : $+ $remove($gettok(%temp,2,32),:)
        hadd ircd $remove($gettok(%temp,2,32),:) $gettok($hget(ircd,$sockname),1,32) $gettok($hget(ircd,$sockname),2-,32)
        hdel ircd $sockname
        sockrename $sockname $remove($gettok(%temp,2,32),:)
        sockwrite -n * notice : $+   $+ %nick $+  has changed his nickname to  $+ $sockname $+ 
        return
      }
      else { sockwrite -n $sockname :This nickname  $+ $remove($gettok(%temp,2,32),:) $+  is busy.Try other. | return }
    }
  }
  if ($gettok(%temp,1,32) == QUIT) {
    hdel ircd $sockname
    sockwrite -n * notice : $+  $+ $sockname $+  ( $+ $sock($sockname).ip $+ ) has quit ( $+ $remove($gettok(%temp,2-,32),:) $+ )
    sockclose $sockname
    return
  }
  if ($gettok(%temp,1,32) == PING) { sockwrite -n $sockname PONG :What? | return }
  if ($gettok(%temp,1,32) == WHOIS) {
    if ($sock($gettok(%temp,2,32),n) == 1) {

      sockwrite -n $sockname : $+ 127.0.0.1 311 $sockname $+ : $+ $gettok(%temp,2,32) $gettok(%temp,2,32) $gettok($hget(ircd,$gettok(%temp,2,32)),1,64) $gettok($gettok($hget(ircd,$gettok(%temp,2,32)),2,64),1,32) $gettok($hget(ircd,$gettok(%temp,2,32)),2-,32)

      if ($hget(join,$gettok(%temp,2,32))) {
        sockwrite -n $sockname : $+ 127.0.0.1 319 $sockname $+ : $+ $gettok(%temp,2,32) $gettok(%temp,2,32) : $+ [ $hget(join,$gettok(%temp,2,32)) ]
      }
      sockwrite -n $sockname : $+ 127.0.0.1 312 $sockname $+ : $+ $gettok(%temp,2,32) $gettok(%temp,2,32) :using 127.0.0.1 ( $+ $slogan $+ )
      sockwrite -n $sockname : $+ 127.0.0.1 317 $sockname $+ : $+ $gettok(%temp,2,32) $gettok(%temp,2,32) $sock($gettok(%temp,2,32)).ls 
      sockwrite -n $sockname : $+ 127.0.0.1 318 $sockname $+ : $+ $gettok(%temp,2,32) $gettok(%temp,2,32) :End of /WHOIS list.

      if ($gettok(%temp,2,32) == $admin) {
        sockwrite -n $admin notice : $+ $sockname $+  just kiss your ass.
        return
      }
      return
    }
    else { sockwrite -n $sockname :No Such Nick  $+ $gettok(%temp,2,32) $+  | return }
  }
  if ($gettok(%temp,1,32) == PRIVMSG) {
    if ($sock($gettok(%temp,2,32),n) == 1) {
      sockwrite -n $gettok(%temp,2,32) : $+ $sockname $+ ! $+ $gettok($hget(ircd,$sockname),1,32) privmsg $gettok(%temp,2,32) : $+ $gettok($gettok(%temp,3-,32),1-,58)
      return
    }
    else { sockwrite -n $sockname :No Such Nick  $+ $gettok(%temp,2,32) $+  | return }
  }
  if ($gettok(%temp,1,32) == INFO) {
    sockwrite -n $sockname :Available commands: "/lusers" "/nick" "/quit" "/whois" "/x <nick> <message>"
    sockwrite -n $sockname :mIRC Server written by BURIAL.You have dumb questions just like the whole server?Mail me at slipknot@starazagora.net
  }
  if ($gettok(%temp,1,32) == LUSERS) {
    sockwrite -n $sockname : $+ 127.0.0.1 372 $sockname : $+ There are $calc($sock(*,0)-5) user(s) online and 5 invisible on 1 server
    sockwrite -n $sockname : $+ 127.0.0.1 250 $sockname :-
    return
  }
  if ($gettok(%temp,1,32) == ISON) {
    var %skiv = 0
    var %text = $gettok(%temp,2-,32)
    var %total = $gettok($gettok(%temp,2-,32),0,32)
    while (%skiv != %total) {
      inc %skiv
      if ($sock($gettok($gettok(%temp,2-,32),%skiv,32)) == $gettok($gettok(%temp,2-,32),%skiv,32)) {
        sockwrite -n $sockname :* $gettok($gettok(%temp,2-,32),%skiv,32) is on IRC
      }
    }
    return
  }
  if ($gettok(%temp,1,32) == JOIN) {
    sockwrite -n $sockname : $+ 127.0.0.1 366 $sockname $gettok(%temp,2,32) :End of /NAMES list.
    hadd join $sockname $hget(join,$sockname) $gettok(%temp,2,32)
    sockwrite -n $sockname : $+ $sockname JOIN $gettok(%temp,2,32)
    hadd chan $gettok(%temp,2,32) $hget(chan,$gettok(%temp,2,32)) $sockname


    var %tot = $gettok($hget(chan,$gettok(%temp,2,32)),*,32)
    var %fak = 0
    while (%tot != %fak) {
      inc %fak
      sockwrite -n $gettok($hget(chan,$gettok(%temp,2,32)),%fak,32) : $+ 127.0.0.1 353 $gettok($hget(chan,$gettok(%temp,2,32)),%fak,32) = $gettok(%temp,2,32) : $+ $hget(chan,$gettok(%temp,2-,32))
    }


  }
  if ($gettok(%temp,1,32) == PART) {
    var %chans = $hget(join, $sockname)
    var %users = $hget(chan,$gettok(%temp,2,32))

    hdel chan $gettok(%temp,2,32)
    hadd chan $gettok(%temp,2,32) $remove(%users,$sockname)

    hdel join $sockname
    hadd join $sockname $remove(%chans,$gettok(%temp,2,32))

    echo -a VSI4KO: $gettok($hget(chan, $gettok(%temp,2,32)),*,32)

    var %tot = $gettok($hget(chan, $gettok(%temp,2,32)),*,32)
    var %fak = 0
    while (%tot != %fak) {
      inc %fak
      echo -a FAK: %fak
      echo -a USER: $gettok($hget(chan,$gettok(%temp,2,32)),%fak,32)
      sockwrite -n $gettok($hget(chan,$gettok(%temp,2,32)),%fak,32) : $+ 127.0.0.1 353 $gettok($hget(chan,$gettok(%temp,2,32)),%fak,32) = $gettok(%temp,2,32) : $+ $hget(chan,$gettok(%temp,2-,32))
    }
    return
  }
  if ($gettok(%temp,1,32) == USER) {
    hadd ircd $sockname $gettok(%temp,2,32) $+ @ $+ $sock($sockname).ip $gettok($gettok(%temp,5-,32),1,58)
    return
  }
  if ($gettok(%temp,1,32) == NOTIFY) { echo -a NOTIFY | return }
  else { sockwrite -n $sockname :No Such Command | return }
}
Published in: mIRC
Download

Related snippets