• Print

Author Topic: Custom ULX Commands?  (Read 10114 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Custom ULX Commands?
« on: June 22, 2015, 01:09:43 am »
So I recently purchased a server and I'm pretty new to the whole coding scene, I know some basic Lua and I'm pretty good at html, but I need some help with making new commands (this is for gmod TTT btw).  Basically I want to make a command that when you type !workshop that will bring people to the workshop for our group so they can download everything in there, I already have a resources.lua but I excluded some of the larger files for downloading time reasons.  How would I be able to make a command that does that?
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: Custom ULX Commands?
« Reply #1 on: June 22, 2015, 06:34:40 pm »
I could send you a code, or I could send you to here, someone's made it for all users.
However if you want to do the more "difficult" way, then here:
Code: Lua
  1. CATEGORY_NAME = "Links"
  2. LINK = "http://steamcommunity.com/workshop/"
  3.  
  4. function ulx.workshop( calling_ply )
  5.     calling_ply:SendLua([[gui.OpenURL(LINK)]])
  6. end
  7.  
  8. local workshop = ulx.command( CATEGORY_NAME, "ulx workshop", ulx.workshop, "!workshop", true )
  9. workshop:help( "Open's the workshop on steam!" )
  10. workshop:defaultAccess( ULib.ACCESS_ALL )

Make a new file in the SH file (in the addons/ulx etc) and call it links.lua (or something else with .lua) then paste the code and edit LINK = .. and save, then it should be done.
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Custom ULX Commands?
« Reply #2 on: June 23, 2015, 03:37:08 am »
Here ya go! This is the command I released: Click Here

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Custom ULX Commands?
« Reply #3 on: June 23, 2015, 11:33:50 am »
A even better way... Look at the default ULX commands.  They show pretty much any way to use it.  Look at other people's work (^^^).  Also you can check out the docs here which may help you further http://ulyssesmod.net/docs/  (more specifically http://ulyssesmod.net/docs/files/lua/ulib/shared/commands-lua.html)

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: Custom ULX Commands?
« Reply #4 on: June 23, 2015, 06:39:40 pm »
Here ya go! This is the command I released: Click Here

Already linked yours -.-
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==

  • Print