Dex Script
Dex Script
on *:exit:{
hfree -w enemy.*
unsetall
}
ctcp *:version:*:{
ctcpreply $nick version [#0,1tH3# #4,0DaRk# #9,0kN!ghT#]
}
on *:sockopen:*:{
if ($sockerr > 0) {
echo -s $chr(35) $+ $findtok($shift.nick,$sockname,32) could not connect to
the server
sockclose $sockname
halt
}
echo -s $chr(35) $+ $findtok($shift.nick,$sockname,32) connected: $sockname
sockwrite -nt $sockname $1- nick $sockname
sockwrite -nt $sockname user $gettok($shift.iden,$findtok($shift.nick,
$sockname,32),32) x x :[#0,1tH3# #4,0DaRk# #9,0kN!ghT#]
sockwrite -nt $sockname pass $gettok($shift.pass,$findtok($shift.nick,
$sockname,32),32)
}
on *:sockclose:*:{
if (!%c) {
var %k = $findtok($shift.nick,$sockname,32)
.timershift $+ %k 1 $calc(%k * 5) sockopen $gettok($shift.nick,%k,32)
$gettok($shift.serv,%k,32) $gettok($shift.port,%k,32)
echo -s $chr(35) $+ %k started, socket has been opened
if (%e) {
if ($sock($gettok($shift.nick,%e,32))) { sockwrite -nt $gettok($shift.nick,
%e,32) part $shift.chan }
while (%e <= $numtok($shift.nick,32)) {
if (%e == $numtok($shift.nick,32)) { set %e 0 }
if ($sock($gettok($shift.nick,$calc(%e + 1),32))) {
sockwrite -nt $gettok($shift.nick,$calc(%e + 1),32) join $shift.chan
set %e $calc(%e + 1)
break
}
inc %e
}
}
}
}
on *:sockread:*:{
:shift.read
sockread -f %shift
if ($sockbr == 0) return
tokenize 32 %shift
if (($2 == mode) && ($3 == $shift.chan) && ($sockname isin $5)) {
if (-o isin $4) { sockwrite -nt $sockname ChanServ op $shift.chan $sockname }
var %j = $nick($shift.chan,0)
while %j {
if ($hfind(enemy.nick,$nick($shift.chan,%j),0,W)) { sockwrite -nt $sockname
kick $shift.chan $nick($shift.chan,%j) :[#0,1tH3# #4,0DaRk# #9,0kN!ghT#] }
dec %j
}
}
elseif (($2 == join) && ($shift.chan isin $3)) {
if ($hfind(enemy.host,$gettok($mid($1,2,$len($1)),2,$asc(@)),0,W)) {
if (($gettok($mid($1,2,$len($1)),1,33) != $sockname) &&
($gettok($mid($1,2,$len($1)),1,33) != $me)) { sockwrite -nt $sockname kick
$shift.chan $gettok($mid($1,2,$len($1)),1,33) :[#0,1tH3# #4,0DaRk# #9,0kN!ghT#] }
}
elseif ($hfind(enemy.nick,$gettok($mid($1,2,$len($1)),1,33),0,W)) {
if (($gettok($mid($1,2,$len($1)),2,$asc(@)) !iswm $address($sockname,5)) &&
($gettok($mid($1,2,$len($1)),2,$asc(@)) !iswm $address($me,5)) && (!
$hfind(enemy.host,$gettok($mid($1,2,$len($1)),2,$asc(@)),0,W))) { hadd -m
enemy.host $gettok($mid($1,2,$len($1)),2,$asc(@)) }
sockwrite -nt $sockname kick $shift.chan $gettok($mid($1,2,$len($1)),1,33) :
[#0,1tH3# #4,0DaRk# #9,0kN!ghT#]
}
}
elseif (($2 == kick) && ($3 == $shift.chan) && ($4 == $sockname) || ($4 == $me))
{
if (($gettok($mid($1,2,$len($1)),1,33) != $sockname) &&
($gettok($mid($1,2,$len($1)),1,33) != $me) && (!$hfind(enemy.nick,
$gettok($mid($1,2,$len($1)),1,33),0,W))) { hadd -m enemy.nick
$gettok($mid($1,2,$len($1)),1,33) }
if (($gettok($mid($1,2,$len($1)),2,$asc(@))) &&
($gettok($mid($1,2,$len($1)),2,$asc(@)) !iswm $address($sockname,5)) &&
($gettok($mid($1,2,$len($1)),2,$asc(@)) !iswm $address($me,5)) && (!
$hfind(enemy.host,$gettok($mid($1,2,$len($1)),2,$asc(@)),0,W))) { hadd -m
enemy.host $gettok($mid($1,2,$len($1)),2,$asc(@)) }
if (%e) {
if ($sock($gettok($shift.nick,%e,32))) { sockwrite -nt $gettok($shift.nick,
%e,32) part $shift.chan }
while (%e <= $numtok($shift.nick,32)) {
if (%e == $numtok($shift.nick,32)) { set %e 0 }
if ($sock($gettok($shift.nick,$calc(%e + 1),32))) {
sockwrite -nt $gettok($shift.nick,$calc(%e + 1),32) join $shift.chan
set %e $calc(%e + 1)
break
}
inc %e
}
}
}
elseif ($2 == 001) {
sockwrite -nt $sockname join $shift.base
if ((%e) && ($gettok($shift.nick,%e,32) !ison $shift.chan)) {
sockwrite -nt $sockname join $shift.chan
set %e $findtok($shift.nick,$sockname,32)
}
}
elseif ($2 == 451) {
sockwrite -nt $sockname $1- nick $sockname
sockwrite -nt $sockname user $gettok($shift.iden,$findtok($shift.nick,
$sockname,32),32) x x :[#0,1tH3# #4,0DaRk# #9,0kN!ghT#]
sockwrite -nt $sockname pass $gettok($shift.pass,$findtok($shift.nick,
$sockname,32),32)
sockwrite -nt $sockname join $shift.base
if ((%e) && ($gettok($shift.nick,%e,32) !ison $shift.chan)) {
sockwrite -nt $sockname join $shift.chan
set %e $findtok($shift.nick,$sockname,32)
}
}
elseif (($1 == ping || $2 == ping)) { sockwrite -nt $sockname pong $2- }
goto shift.read
}
menu status,channel,nicklist,query {
SoniWar
.Socket
.. $+ $iif(($me !ison $shift.base),$style(2)) Open:{
var %a = 1
while (%a <= $numtok($shift.nick,32)) {
if (!$sock($gettok($shift.nick,%a,32))) {
.timershift $+ %a 1 $calc(%a * 5) sockopen $gettok($shift.nick,%a,32)
$gettok($shift.serv,%a,32) $gettok($shift.port,%a,32)
echo -s $chr(35) $+ %a started, socket has been opened
}
inc %a
}
unset %c
}
.. $+ $iif(($me !ison $shift.base),$style(2)) Close:{
var %b = 1
set %c %b
while (%b <= $numtok($shift.nick,32)) {
if ($sock($gettok($shift.nick,%b,32))) {
sockclose $gettok($shift.nick,%b,32)
echo -s $chr(35) $+ %b stopped, socket has been closed
}
inc %b
}
.timershift* off
unset %e
}
.Shifter
.. $+ $iif(((%e) || ($me !ison $shift.base) || ($me !ison $shift.chan)),
$style(2)) Join:{
var %d = 1
while (%d <= $numtok($shift.nick,32)) {
if ($sock($gettok($shift.nick,%d,32))) {
sockwrite -nt $gettok($shift.nick,%d,32) join $shift.chan
set %e %d
break
}
inc %d
}
}
.. $+ $iif((!%e),$style(2)) Part:{
sockwrite -nt $gettok($shift.nick,%e,32) part $shift.chan
unset %e
}
.. $+ $iif((!%e),$style(2)) Cycle:{
if ($sock($gettok($shift.nick,%e,32))) { sockwrite -nt $gettok($shift.nick,
%e,32) part $shift.chan }
while (%e <= $numtok($shift.nick,32)) {
if (%e == $numtok($shift.nick,32)) { set %e 0 }
if ($sock($gettok($shift.nick,$calc(%e + 1),32))) {
sockwrite -nt $gettok($shift.nick,$calc(%e + 1),32) join $shift.chan
set %e $calc(%e + 1)
break
}
inc %e
}
}
.Enemy
.. $+ $iif((($menu == status) || ($menu == query) || (!%e)),$style(2)) Kick:{
if ($menu == nicklist) {
if (($$1 != $gettok($shift.nick,%e,32)) && ($$1 != $me)) {
if (!$hfind(enemy.nick,$$1,0,W)) { hadd -m enemy.nick $$1 }
if (($ial($$1).host) && (!$hfind(enemy.host,$ial($$1).host,0,W))) { hadd
-m enemy.host $ial($$1).host }
sockwrite -nt $gettok($shift.nick,%e,32) kick $shift.chan $$1 :[#0,1tH3#
#4,0DaRk# #9,0kN!ghT#]
}
}
elseif ($menu == channel) {
var %input = $?="Enter plain or wildcard nick:"
if ((%input) && (%input !iswm $gettok($shift.nick,%e,32)) && (%input !iswm
$me)) {
if (!$hfind(enemy.nick,%input,0,W)) { hadd -m enemy.nick %input }
if (($ial(%input).host) && (!$hfind(enemy.host,$ial(%input).host,0,W)))
{ hadd -m enemy.host $ial(%input).host }
var %f = $nick($shift.chan,0)
while %f {
if ($hfind(enemy.nick,$nick($shift.chan,%f),0,W)) { sockwrite -nt
$sock($gettok($shift.nick,%e,32)) kick $shift.chan $nick($shift.chan,%f) :
[#0,1tH3# #4,0DaRk# #9,0kN!ghT#] }
dec %f
}
}
}
}
.. $+ $iif(((!$hget(enemy.nick)) && (!$hget(enemy.host))),$style(2)) Clear:{
hfree -w enemy.*
if ($gettok($shift.nick,%e,32) ison $shift.chan) { sockwrite -nt
$gettok($shift.nick,%e,32) privmsg $shift.chan :#0,9[`CLEAR`] }
else {
var %g = 1
while (%g <= $numtok($shift.nick,32)) {
if ($sock($gettok($shift.nick,%g,32))) {
sockwrite -nt $gettok($shift.nick,%g,32) privmsg $shift.base :[#0,1tH3#
#4,0DaRk# #9,0kN!ghT#]
break
}
inc %g
}
}
}
.. $+ $iif(((!$hget(enemy.nick)) && (!$hget(enemy.host))),$style(2)) List:{
var %h = $hget(enemy.nick,0).item
while (%h) {
echo -s $hget(enemy.nick,%h).item
dec %h
}
var %i = $hget(enemy.host,0).item
while (%i) {
echo -s $hget(enemy.host,%i).item
dec %i
}
}
}
}