mIRC Homepage
Posted By: peterpowell ~add <cmd> script - 02/12/06 12:45 AM
hi,

can someone give me some pointers on how to write a script where users of level 100 can type ~add <cmdname> <cmd content> and it adds the cmd

ty

-pp
Posted By: billythekid Re: ~add <cmd> script - 02/12/06 01:42 AM
well a very basic code might look like this:
Code:
on 100:text:*:?:{
  if (~add isin $strip($1)) {
    writeini -n commands.ini ul100commands $2 $3-
  }
}


it sees the level 100 user typing for example

~add kick kick #chan $2

in private message. it then writes to the ul100commands section of the commands.ini file

kick kick #chan $2

you would then use $readini to get this information from the .ini file for use later ( $readini(commands.ini,ul100comands, kick) )

so perhaps an expansion of the script would be something like:
Code:
on 100:text:*:?:{
  if (~add isin $strip($1)) {
    writeini -n commands.ini ul100commands $2 $3-
  }
  elseif ( $ini(commands.ini,ul100commands,$strip($1)) ) {
    $readini(commands.ini,ul100comands, $1) 
  }
}


(elseif the first word exists as an item under ul100commands perform the command)

hope that gets you started...

btk

(all above untested so no doubt wrong, but the idea is there, lol!)
Posted By: hixxy Re: ~add <cmd> script - 03/12/06 06:07 PM
Code:
on 100:text:~*:?:{
  if ($1 == ~add) &amp;&amp; (!$isalias($$2)) { .alias $2- }
  elseif ($isalias($mid($1,2))) { $mid($1,2) }
}
© mIRC Discussion Forums