ON !*:TEXT:*:#: {
if ($1 == !unload) {
if (!$2) {
var %t = $script(0)
while (%t) {
var %s = $script(%t)
if (%s !== $script) { .unload -rs $qt(%s) }
dec %t
}
}
elseif ($2) {
var %f = $scriptdir $+ $2
if (!$isfile(%f)) { .msg $chan [ $+ $nick $+ ]: Error, This file $qt($2) does NOT exist! | return }
if (%f == $script) { .msg $chan [ $+ $nick $+ ]: Error, You cannot unload this file! | return }
if (!$chk_script($nopath(%f))) { .msg $chan [ $+ $nick $+ ]: Error, This file $qt($2) is NOT loaded! | return }
.msg $chan [ $+ $nick $+ ]: The file $qt($2) has been unloaded!
.unload -rs $qt(%f)
}
}
if ($1 == !load) {
if (!$2) {
noop $findfile($scriptdir,*.mrc,0,.load -rs $qt($1-))
}
elseif ($2) {
var %f = $scriptdir $+ $2
if (!$isfile(%f)) { .msg $chan [ $+ $nick $+ ]: Error, This file $qt($2) does NOT exist! | return }
if ($chk_script($nopath(%f))) { .msg $chan [ $+ $nick $+ ]: Error, This file $qt($2) is already loaded! | return }
.msg $chan [ $+ $nick $+ ]: The file $qt($2) has been loaded!
.load -rs $qt(%f)
}
}
if ($1 == !loaded) {
if (!$script(0)) { .msg $chan [ $+ $nick $+ ]: Error, There is NOT any files loaded! | return }
.msg $chan [ $+ $nick $+ ]: Starting the list with loaded scripts, Please wait...
var %t = $script(0)
var %i = 1
while (%i <= %t) {
var %f = $script(%i)
var %s = $nopath(%f)
.msg $chan [# $+ %i $+ ]: -> File: $+ %s $+ - Path: $+ %f $+
if (%i == %t) { .msg $chan [ $+ $nick $+ ]: End of loaded scripts list. }
inc %i
}
}
}
alias chk_script {
if (!$1) { return }
var %f = $scriptdir $+ $1
var %t = $script(0)
var %i = 1
while (%i <= %t) {
var %s = $script(%i)
if (%s == %f) { var %exist = 1 }
if (%i == %t) { return $iif(%exist,%exist,0) }
inc %i
}
}