Es regcmd

From EventScripts Community Encyclopedia


Syntax: es_regcmd <command> <script>/<block> "<description>"

Note: Command parameters are described inside the < and > characters. Optional parameters are contained within [ and ] characters.

Variation of this command that doesn't expand variables: {{{x}}}


Registers a console command that can be issued server-side that will initiate the specified block of code upon use, passing it parameters. This command allows scripts to create their own reusable commands for rcon or other scripts to use.


  • command - Name of the command you want to create on the server-side console.
  • script - Name of the script that you want to initiate the block inside of.
  • block - Name of the block that you want to initiate.
  • description - A short description of what the command does.


block load
   es_regcmd test script/test "test command"
block test
   es_msg This command was run!

This will initiate the block test whenever the command test is run. So if I were to type:

test arg1 arg2 arg3

It would then message "This command was run!"


  • Once a command is registered, es_regcmd will fail on a subsequent attempt. Overwriting is currently not possible. You can use es_exists to test for existence (to avoid an error message in the console trying to reregister).

See also

  • Tutorial on es_regcmd
  • es_getargv - Used to get specific argument values passed to the console command
  • es_getargc - Gets the count of theargument values passed to the console command
  • es_getargs - Gets the entire command string passed to a console command created with es_regcmd.
  • es_exists var command

External links



blog comments powered by Disqus