• Print

Author Topic: Commands not show in chat  (Read 5455 times)

0 Members and 1 Guest are viewing this topic.

Offline mikson

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Commands not show in chat
« on: December 12, 2014, 08:58:53 am »
Hi everyone,

How to do in ULX mod to hide commands like "!menu", "!kick", etc. in the chat?
I want echo to stay, but hide only commands.

Thanks,
Mikson.

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Commands not show in chat
« Reply #1 on: December 12, 2014, 12:08:56 pm »
There's a boolean for it

Here's one of my commands:
Code: Lua
  1. function ulx.respawn( caling_ply, target_ply )
  2.         if not target_ply:Alive() then
  3.                 target_ply:Spawn()
  4.         end
  5. end
  6. local respawn = ulx.command( CATEGORY_NAME, "ulx respawn", ulx.respawn, "!respawn", true )
  7. respawn:addParam{ type=ULib.cmds.PlayerArg }
  8. respawn:defaultAccess( ULib.ACCESS_ADMIN )
  9. respawn:help( "Respawns a player -- does not work with TTT" )

You see at the end of line 6, there's a true
That makes the command not show up in chat for others to see (it still echos)
I didn't check all of the files, but most most of the commands that come with ULX in the Utilities file don't have that section for true or false at the end of the "line 6,"
I assume this is because if there's no true or false specifically stated there, it defaults to false
Nothing to worry about, though, you can just add it on if it's not there

For example, here's the who command
Code: Lua
  1. function ulx.who( calling_ply )
  2.         ULib.console( calling_ply, "ID Name                            Group" )
  3.  
  4.         local players = player.GetAll()
  5.         for _, player in ipairs( players ) do
  6.                 local id = tostring( player:UserID() )
  7.                 local nick = player:Nick()
  8.                 local text = string.format( "%i%s %s%s ", id, string.rep( " ", 2 - id:len() ), nick, string.rep( " ", 31 - nick:len() ) )
  9.  
  10.                 text = text .. player:GetUserGroup()
  11.  
  12.                 ULib.console( calling_ply, text )
  13.         end
  14. end
  15. local who = ulx.command( CATEGORY_NAME, "ulx who", ulx.who )
  16. who:defaultAccess( ULib.ACCESS_ALL )
  17. who:help( "See information about currently online users." )
In this case we would have to add on two things
One being the chat command, and the other being the true or false
So change line 15 from
Code: Lua
  1. local who = ulx.command( CATEGORY_NAME, "ulx who", ulx.who )
to
Code: Lua
  1. local who = ulx.command( CATEGORY_NAME, "ulx who", ulx.who, "!who", true )

Offline mikson

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Commands not show in chat
« Reply #2 on: December 13, 2014, 04:38:25 am »
Yes, thank you very much for help. I've done everything excepting... !menu. In with file I will find !menu declaration (where I have to add "true")?

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline mikson

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Commands not show in chat
« Reply #4 on: December 13, 2014, 07:25:43 am »
I mean !menu not !motd...
« Last Edit: December 13, 2014, 07:39:39 am by mikson »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Commands not show in chat
« Reply #5 on: December 13, 2014, 07:39:56 am »
https://github.com/Nayruden/Ulysses/blob/master/ulx/lua/ulx/modules/cl/xgui_client.lua#L531
I hate Github search. Wish they would find a way NOT to ignore all the characters used in code that would allow easier searching.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Commands not show in chat
« Reply #6 on: December 13, 2014, 07:51:37 am »
I give up.
That's commented out.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline mikson

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Commands not show in chat
« Reply #7 on: December 13, 2014, 07:58:43 am »
Exactly. This doesn't change anything.
If I uncomment it, there are many errors occurring (and of course doesn't work properly).
« Last Edit: December 13, 2014, 08:07:26 am by mikson »

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Commands not show in chat
« Reply #8 on: December 13, 2014, 03:59:45 pm »
Whoops, sorry. I read it wrong, I guess I'm used to people asking for motd-related questions or something.

Seems to me the "!menu" lies within some old ULib code (which is still supported I guess) here: https://github.com/Nayruden/Ulysses/blob/71dfac842aaa50c98832f5800684a59995b2299c/ulx/lua/ulx/modules/xgui_server.lua#L42

I personally don't have any idea how to work with that though.
« Last Edit: December 13, 2014, 05:22:12 pm by Decicus »
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Commands not show in chat
« Reply #9 on: December 13, 2014, 10:30:44 pm »
Stickly Man or Megiddo will have to explain.
I know ULib was modified to account/incorporate Xgui.
Didn't know we'd totally changed the menu commands.

Here's document for it - http://ulyssesmod.net/docs/files/lua/ulib/server/concommand-lua.html#addSayCommand
Seems to be similar in the options for hiding.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Commands not show in chat
« Reply #10 on: December 14, 2014, 07:28:43 am »
Change it to addSayCommand( "!menu", xgui_chatCommand, "ulx menu", true )
Experiencing God's grace one day at a time.

  • Print