Well It's my first script wich I use Hash Tables, feel free to rate
commands:
!greetsoff
!greetson
!setgreet
!delgreet
!private
!public
alias -l c2 return $+($chr(3),02,$1-,$chr(3))
alias -l c7 return $+($chr(3),07,$1-,$chr(3))
on *:CONNECT:{
if (!$hget(Option)) { hmake Option 100 }
if (!$hget(Greets)) { hmake Greets 100 }
if (!$hget(Optio)) { hmake Optio 100 }
else { /msg $me Hash tables successfully made. }
}
on $*:TEXT:/^[!@]greetsoff/Si:#:{
if ($hget(Option,$chan) == off) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** The command "),$c7(Greet),$c2(" is already) $c7(off),$c2(.)) }
elseif ($nick isop #) || ($nick ishop #) {
hdel Option $chan on
hadd Option $chan off
hsave Option Option.txt
.msg $chan $+($c2(**[),$c7(GREET),$c2(]** The command "),$c7(Greet),$c2(" is now) $c7(off)) $+ $c2(.)
}
else {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** Sorry) $c7($nick),$c2(, you do not have) $c7(access) $c2(to this command.)) } }
on $*:TEXT:/^[!@]greetson/Si:#:{
if ($hget(Option,$chan) == on) { .notice $nick $+($c2(**[),$c7(ERROR),$c2(]** The command "),$c7(Greet),$c2(" is already) $c7(on),$c2(.)) }
elseif ($nick isop #) || ($nick ishop #) {
hdel Option $chan off
hadd Option $chan on
hsave Option Option.txt
.msg $chan $+($c2(**[),$c7(GREET),$c2(]** The command "),$c7(Greet),$c2(" is now) $c7(on)) $+ $c2(.)
}
else {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** Sorry) $c7($nick),$c2(, you do not have) $c7(access) $c2(to this command.)) } }
on $*:TEXT:/^[!@](setgreet)/Si:#:{
if ($hget(Option,$chan) == off) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** The command "),$c7(Greet),$c2(" for) $c7($chan) $c2(is off. Ask an) $c7(Op) $c2(or) $c7(Halfop) $c2(to turn it on.)) }
else {
if ($hget(Greets,$address($nick,2)) != $null) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** You already have a) $c7(greet) $c2(used with your) $c7(host),$c2($chr(44) type) $c7(!delgreet) $c2(to remove it.)) }
else {
if (!$2) { .notice $nick $+($c2(**[),$c7(ERROR),$c2(]** You haven't) $c7(specified) $c2(a greet.)) }
else {
hadd Greets $address($nick,2) $2-
hsave Greets Greets.txt
.notice $nick $+($c2(**[),$c7(GREET),$c2(]** Your greet has been set to "),$c7($hget(Greets,$address($nick,2))),$c2(" with the host "),$c7($address($nick,2)),$c2(".)) } } } }
on $*:TEXT:/^[!@](delgreet)/Si:#:{
if ($hget(Option,$chan) == off) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** The command "),$c7(Greet),$c2(" for) $c7($chan) $c2(is off. Ask an) $c7(Op) $c2(or) $c7(Halfop) $c2(to turn it on.)) }
else {
if ($hget(Greets,$address($nick,2)) == $null) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** You do) $c7(not) $c2(have a) $c7(greet) $c2(used with your) $c7(host),$c2($chr(44) type) $c7(!setgreet <greet>) $c2(to set one.)) }
else {
.notice $nick $+($c2(**[),$c7(GREET),$c2(]** Your greet $chr(40)),$c7($hget(Greets,$address($nick,2))),$c2($chr(41) has been) $c7(deleted),$c2($chr(46)))
hdel Greets $address($nick,2)
hdel Optio $address($nick,2) on
hsave Greets Greets.txt } } }
on $*:TEXT:/^[!@](private)/Si:#:{
if ($hget(Option,$chan) == off) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** The command "),$c7(Greet),$c2(" for) $c7($chan) $c2(is off. Ask an) $c7(Op) $c2(or) $c7(Halfop) $c2(to turn it on.)) }
else {
if ($hget(Greets,$address($nick,2)) == $null) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** It's useless to) $c7(activate) $c2(the mode "),$c7(Private),$c2(" when you don't have any) $c7(greet) $c2(set.)) }
else {
if ($hget(Optio,$address($nick,2)) == on) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** The mode "),$c7(Private),$c2(" is already) $c7(on),$c2($chr(46) Type) $c7(!public) $c2(to undo it.)) }
else {
hdel Optio $address($nick,2) off
hadd Optio $address($nick,2) on
hsave Optio Optio.txt
.notice $nick $+($c2(**[),$c7(GREET),$c2(]** You have) $c7(activated) $c2(the mode "),$c7(Private),$c2(" for your greet. Type) $c7(!public) $c2(to undo it.)) } } } }
on $*:TEXT:/^[!@](public)/Si:#:{
if ($hget(Option,$chan) == off) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** The command "),$c7(Greet),$c2(" for) $c7($chan) $c2(is off. Ask an) $c7(Op) $c2(or) $c7(Halfop) $c2(to turn it on.)) }
else {
if ($hget(Greets,$address($nick,2)) == $null) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** It's useless to) $c7(activate) $c2(the mode "),$c7(Public),$c2(" when you don't have any) $c7(greet) $c2(set.)) }
else {
if ($hget(Optio,$address($nick,2)) == off) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** The mode "),$c7(Public),$c2(" is already) $c7(on),$c2($chr(46) Type) $c7(!private) $c2(to undo it.)) }
else {
hdel Optio $address($nick,2) on
hadd Optio $address($nick,2) off
hsave Optio Optio.txt
.notice $nick $+($c2(**[),$c7(GREET),$c2(]** You have) $c7(activated) $c2(the mode "),$c7(Public),$c2(" for your greet. Type) $c7(!private) $c2(to undo it.)) } } } }
on $*:TEXT:/^[!@](viewgreet)/Si:#:{
set %way $iif($left($1,1) == @,msg $chan,notice $nick)
if ($hget(Option,$chan) == off) {
.notice $nick $+($c2(**[),$c7(ERROR),$c2(]** The command "),$c7(Greet),$c2(" for) $c7($chan) $c2(is off. Ask an) $c7(Op) $c2(or) $c7(Halfop) $c2(to turn it on.)) }
else {
if (!$2) && ($hget(Greets,$address($nick,2)) == $null) {
%way $+($c2(**[),$c7(ERROR),$c2(]** You do) $c7(not) $c2(have a) $c7(greet) $c2(used with your) $c7(host),$c2($chr(46))) }
if (!$2) && ($hget(Greets,$address($nick,2)) != $null) {
%way $+($c2(**[),$c7(GREET),$c2(]** Your greet is "),$c7($hget(Greets,$address($nick,2))),$c2(".)) }
else {
if ($2 != $null) && ($hget(Greets,$address($2,2)) == $null) {
%way $+($c2(**[),$c7(ERROR),$c2(]**) $c7($2-) $c2(does) $c7(not) $c2(have a) $c7(greet) $c2(used with his) $c7(host),$c2($chr(46))) }
else {
if ($2 != $null) && ($hget(Greets,$address($2,2)) != $null) && ($hget(Optio,$address($2,2)) == on) {
%way $+($c2(**[),$c7(GREET),$c2(]**) $c7($2-) $c2(has the mode "),$c7(Private),$c2(" actived, wich means you) $c7(cannot) $c2(view) $c7($2-),$c2('s greet.)) }
else {
if ($2 != $null) && ($hget(Greets,$address($2,2)) != $null) && ($hget(Optio,$address($2,2)) != on) {
%way $+($c2(**[),$c7(GREET),$c2(]**) $c7($2-),$c2('s greet is "),$c7($hget(Greets,$address($2,2))),$c2(".)) } } } } } }
on *:JOIN:#:{
if ($hget(Option,$chan) == off) { halt }
else {
if ($hget(Greets,$address($nick,2)) == $null) { halt }
else {
if ($hget(Greets,$address($nick,2)) != $null) {
.msg $chan $+($c2($chr(40)),$c7($nick),$c2($chr(41))) $hget(Greets,$address($nick,2)) } } } }