• Print

Author Topic: add commands  (Read 10325 times)

0 Members and 1 Guest are viewing this topic.

Offline ddog777

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
add commands
« on: July 23, 2014, 06:57:17 pm »
I am the owner of a Garrys mod server and i use ULX admin mod i would like to know how to add commands such as the give command, open cells command, re spawn command.

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: add commands
« Reply #1 on: July 23, 2014, 08:22:03 pm »
give command
As in...give weapons?

open cells command
I assume by "open cells" you mean by opening the cell doors for a JailBreak server?

re spawn command.
This one is fairly easy for some gamemodes, but is more complicated in others (such as TTT)

So I guess my question is: Are all of these commands for the same gamemode? In which case, which gamemode? JailBreak?

Offline ddog777

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: add commands
« Reply #2 on: July 23, 2014, 08:50:54 pm »
Yes I want to add them to ulx for jailbreak

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: add commands
« Reply #3 on: July 23, 2014, 09:13:19 pm »
Honestly, I'm still really new to Lua and don't know too much about it yet, so I'm not sure what to do for the give weapons command or open cells command, but I'm sure there's multiple people on this forum that can help you with that

I might've been able to get the respawn command for you, however

Put this in the file: garrysmod/addons/ulx/lua/ulx/modules/sh/util.lua

Code: Lua
  1. function ulx.respawn( target_ply )
  2.  
  3.         if not target_ply:Alive() then
  4.                 target_ply:Spawn()
  5.         elseif target_ply:Alive() then
  6.                 return end
  7.  
  8. ulx.fancyLogAdmin( calling_ply, true, "#A respawned #T" )
  9. end
  10.  
  11. local respawn = ulx.command( CATEGORY_NAME, "ulx respawn", ulx.respawn, "!respawn", true )
  12. respawn:addParam{ type=ULib.cmds.PlayersArg }
  13. respawn:defaultAccess( ULib.ACCESS_ADMIN )
  14. respawn:help( "Respawns a player" )

Let me know if it gives you any errors when you run that
« Last Edit: July 23, 2014, 09:20:07 pm by Zmaster »

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: add commands
« Reply #4 on: July 24, 2014, 12:22:08 am »
Quote
"Use the search bar, Luke."

And Master, if you wrote that function, the elseif part isn't needed.

Code: Lua
  1. function ulx.respawn( target_ply )
  2.  
  3.         if not target_ply:Alive() then
  4.                 target_ply:Spawn()
  5.         end
  6.  
  7. ulx.fancyLogAdmin( calling_ply, true, "#A respawned #T" )
  8. end
  9.  
  10. local respawn = ulx.command( CATEGORY_NAME, "ulx respawn", ulx.respawn, "!respawn", true )
  11. respawn:addParam{ type=ULib.cmds.PlayersArg }
  12. respawn:defaultAccess( ULib.ACCESS_ADMIN )
  13. respawn:help( "Respawns a player" )
Out of the Garry's Mod business.

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: add commands
« Reply #5 on: July 24, 2014, 12:31:53 am »
I did, thanks for letting me know :P

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: add commands
« Reply #6 on: July 24, 2014, 12:36:32 am »
The ULX Help and Support section of the forum isn't the best place to discuss how to do things in code.
First, I'd recommend searching our RELEASES section of the forum...many commands there, some might work in Jailbreak.
Second, search for keywords in our DEVELOPER'S CORNER of the forum. Many non-release but good code discussions there.
In fact, since this seems to be more a code discussion than a 'where do I find stuff for ULX' topic now, moving to dev corner.

I'm pretty sure I've seen the exact same give and respawn discussions here on the forum before, and am reasonably sure you might find other code examples.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline ATomIC

  • Newbie
  • *
  • Posts: 4
  • Karma: -3
Re: add commands
« Reply #7 on: July 24, 2014, 02:59:22 pm »
give command
The give command is a custom command on sale in CoderHire, but can be found in hundreds of different places. I don't feel like exploiting the known give command so here is where you can get it: http://coderhire.com/scripts/view/704 :)

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: add commands
« Reply #8 on: July 24, 2014, 09:53:44 pm »
Or, 100% free, by two different authors, for give weapon command in our RELEASES section.
We have many pages of releases. Don't just stop at the first page.

The word "give" is not difficult to find using the search box.
/index.php/topic,6183.0.html
/index.php/topic,7223.0.html
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

  • Print