• Print

Author Topic: Custom Command Help!  (Read 5460 times)

0 Members and 1 Guest are viewing this topic.

Offline Reggie The Pikmin

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Custom Command Help!
« on: February 26, 2015, 01:46:33 pm »
anyone have an idea on how to set a custom command such as !addons for example , ive been attempting it with no luck.


Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Custom Command Help!
« Reply #1 on: February 26, 2015, 04:58:15 pm »
Are you looking to have it set up so you can open a webpage with a page of the server addons?
Once you get to know me, you'll find you'll have never met me at all.

Offline Reggie The Pikmin

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Custom Command Help!
« Reply #2 on: February 26, 2015, 05:28:16 pm »
yes also on if i was to say for instance !hi , it might come up with a message , ive seen it done on some servers and thought it might be cool to add , if you can help me id appreciate it!  :)

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Custom Command Help!
« Reply #3 on: February 26, 2015, 07:02:12 pm »
Both are tested and do work

"!addons"
Code: Lua
  1. function ulx.serveraddons(calling_ply)
  2.         calling_ply:SendLua("gui.OpenURL('[url]http://google.com[/url]')")
  3. end
  4. local serveraddons = ulx.command( CATEGORY_NAME, "ulx addons", ulx.serveraddons, "!addons", false )
  5. serveraddons:defaultAccess( ULib.ACCESS_ALL )
  6. serveraddons:help( "Opens a specified URL" )

"!hi"
Code: Lua
  1. function ulx.hi(calling_ply)
  2.         timer.Simple(0.1, function()
  3.                 calling_ply:SendLua("chat.AddText( Color(0, 255, 0), 'Hello!')")
  4.         end )
  5. end
  6. local hi = ulx.command( CATEGORY_NAME, "ulx hi", ulx.hi, "!hi", false )
  7. hi:defaultAccess( ULib.ACCESS_ALL )
  8. hi:help( "Hello!" )


Edit: SMF always forces me to put those url tags in my post even when I remove them
Idk why :(
« Last Edit: February 27, 2015, 05:17:46 am by Zmaster »

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Custom Command Help!
« Reply #4 on: February 26, 2015, 08:36:10 pm »
"!addons"
Code: Lua
  1. function ulx.serveraddons(calling_ply)
  2.         calling_ply:SendLua("gui.OpenURL('[url]http://google.com[/url]')")
  3. end
  4. local serveraddons = ulx.command( CATEGORY_NAME, "ulx addons", ulx.serveraddons, "!addons", false )
  5. serveraddons:defaultAccess( ULib.ACCESS_ALL )
  6. serveraddons:help( "Opens a specified URL" )

Remember to remove the url tags around your workshop URL.
Once you get to know me, you'll find you'll have never met me at all.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Custom Command Help!
« Reply #5 on: February 26, 2015, 11:20:18 pm »
Remember to remove the url tags around your workshop URL.

Like so:

Code: Lua
  1. function ulx.serveraddons(calling_ply)
  2.         calling_ply:SendLua("gui.OpenURL('i am url')")
  3. end
  4. local serveraddons = ulx.command( CATEGORY_NAME, "ulx addons", ulx.serveraddons, "!addons", false )
  5. serveraddons:defaultAccess( ULib.ACCESS_ALL )
  6. serveraddons:help( "Opens a specified URL" )

The forum's software likes to auto-tag URLs.
Out of the Garry's Mod business.

  • Print