I know I've seen something similar to this, but at the moment I can't find it. I'll post the link as soon as I find it, though.
I've had no luck in finding the post I was mentioning, so here's a quick code that I think should work. I'm unable to test it at present.
on *:start:{
if !$hget(Commands) { .hmake Commands 10 }
if $exists(Commands.hsh) { .hload Commands Commands.hsh }
}
on *:load:{
if !$hget(Commands) { .hmake Commands 10 }
if $exists(Commands.hsh) { .hload Commands Commands.hsh }
}
on *:text:!addcmd*:*:{
if $hget(Commands,$2) {
.msg $nick That command has already been entered
}
else {
.hadd -m Commands $2 $3-
}
}
on *:text:*:*:{
if $hget(Commands,$1) {
$eval($hget(Commands,$1))
}
}
on *:exit:{
.hsave -o Commands Commands.hsh
}
on *:disconnect:{
.hsave -o Commands Commands.hsh
}