3

I'm an administrator on a couple TF2 servers, and I've installed a couple Sourcemod plugins (MeleeMode, ClassChooser, etc.). However, to get these to work the way I want, I have to set variables manually through the console like

sm_cvar sm_meleemode_enabled 1

While I know how to set up a local alias for a console command, I'd like to be able to create a server-wide "shortcut" so that all the admins will be able to use it without any setup on their end. I'd like them to be able to just open the console and type

meleeon

and this command would execute. Is there something I can add to the server.cfg or autoexec.cfg that will do this? Or maybe another workable solution?

1 Answer 1

7

The server alias syntax is the same as on the client side. You can place aliases inside server.cfg or choose to separate them into their own file for the sake of neatness.

server.cfg

exec aliases.cfg

aliases.cfg

alias "meleeon" "sm_cvar sm_meleemode_enabled 1;sm_cvar example 0"
alias "meleeoff" "sm_cvar sm_meleemode_enabled 0;sm_cvar example 1"

You should also be able to change the default values of cvars registered in SourceMod plugins or have them vary by map. Just ask if that interests you.

4
  • 1
    Ahh - this was what I was missing. I tried putting that alias line right into server.cfg, but the aliases never registered. Thank you!
    – Jeffrey
    Commented Jul 19, 2010 at 13:53
  • I just tried this last night, and I couldn't get it to work. meleeon and meleeoff were never registering as commands. I used sourcemod to reload server.cfg, and even tried map changes.
    – Jeffrey
    Commented Jul 22, 2010 at 13:58
  • @Jeffrey: As I recall, sm_cvar is actually a chat command, so you may need to put say before it.
    – user2974
    Commented Sep 1, 2010 at 14:44
  • What about for something that is a single command? say sm_bmerasmus, i want it to just be bemeras, no changing of server cvars, just a command to do something ingame
    – user48883
    Commented May 21, 2013 at 0:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .