alias mta.getid {
var %a = 0
while (%a <= $mta.server($1).cmax) {
if ($+(*,$2,*) iswm $mta.nick($1,%a)) !return %a
!inc %a
}
!return -1
}
on *:SIGNAL:mta.command: {
Commands.checks $1-
if ($3 == !info) mta.text $1 Add-Commands-Command 1.0 by House MD.
elseif (($3 == !AddCom) || ($3 == !RemCom)) {
Addand.Ban $1-
}
elseif ($3 == !CreatedCom) mta.text $1 There are currently $lines(Commands.txt) created commands
}
alias Addand.Ban {
if ($mta.level($1,$2) < 5) mta.pm $1 $2 Error: Level 5 Admins Only!
elseif ($3 == !AddCom) {
if (!$4) mta.pm $1 $2 Error: !AddCom
if (!$5) mta.pm $1 $2 Error: !AddCom
else {
var %a = 1,%b = $lines(commands.txt)
while (%a <= %b) {
if ($4 iswm $read(commands.txt,%a)) {
mta.pm $1 $2 Error: Command Already Created
!halt
}
!inc %a
}
!write commands.txt $4
!writeini -n coms.ini command $4 $5-
mta.text $1 Command $4 created
}
}
elseif ($3 == !RemCom) {
if (!$4) mta.pm $1 $2 Error: !RemCom
else {
var %a = 1,%b = $lines(commands.txt)
while (%a <= %b) {
if ($4 iswm $read(commands.txt,%a)) {
!write -ds $+ $4 commands.txt
!remini -n coms.ini command $4
mta.text $1 command $4 removed
%a = $calc(%b + 2)
}
!inc %a
}
if (%a == $calc(%b + 1)) mta.pm $1 $2 Error: Command $4 has not been created.
}
}
}
alias Commands.checks {
var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$gus.getid($1,$4)),$2),%b = $3,%c = $lines(commands.txt),%d = 1
while (%d <= %c) {
if ($read(commands.txt,%d) iswm %b) {
mta.text $1 $readini(coms.ini,command,$read(commands.txt,%d))
%d = %c
}
!inc %d
}
}
You have to type !addcom and !remcom[/code]