• Print

Author Topic: Custom chat command aliases for console commands  (Read 14850 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Custom chat command aliases for console commands
« Reply #30 on: June 11, 2016, 04:21:00 pm »
So just making sure:

To add another command I change out the parameters like this?:
Code: Lua
  1. function ulx.killme( calling_ply )
  2.  
  3.   calling_ply:ConCommand( "kill" )
  4.  
  5. end
  6. local killme = ulx.command( "Aliases", "ulx killme", ulx.killme, { "!kill" } )
  7. killme:defaultAccess( ULib.ACCESS_ALL )
  8. killme:help( "Causes the player to commit suicide" )

If you were trying to make a command for kill, yes that's how you would do it. Except, you don't need to add the "!kill" in a table (the {}) because there is only one of them.


In other words:

Code: Lua
  1. function ulx.killme( calling_ply )
  2.  
  3.   calling_ply:ConCommand( "kill" )
  4.  
  5. end
  6. local killme = ulx.command( "Aliases", "ulx killme", ulx.killme, "!kill" )
  7. killme:defaultAccess( ULib.ACCESS_ALL )
  8. killme:help( "Causes the player to commit suicide" )
« Last Edit: June 11, 2016, 04:24:07 pm by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Chiller252

  • Jr. Member
  • **
  • Posts: 59
  • Karma: 3
  • On a Journey to Combine Technology and Design
    • Personal Website
Re: Custom chat command aliases for console commands
« Reply #31 on: June 11, 2016, 04:36:57 pm »
Gotcha, cool cool.

Well I'm not rly running into any issues so I'll just let this thread die down until inevitably someone raises it from the dead.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Custom chat command aliases for console commands
« Reply #32 on: June 11, 2016, 04:37:28 pm »
Or, you could lock it in the bottom-left if you want to :)
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

  • Print