Author Topic: Commands Use  (Read 2868 times)

0 Members and 1 Guest are viewing this topic.

Offline Darkblizzard

  • Newbie
  • *
  • Posts: 39
  • Karma: 1
Commands Use
« on: March 18, 2015, 05:47:00 PM »
Hello,
I was wondering if there was a way where whenever you type a command such as "!ban lemon", it disappears and does the action?
Thank you.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Commands Use
« Reply #1 on: March 18, 2015, 05:50:28 PM »
You mean that it doesn't echo to chat?
Experiencing God's grace one day at a time.

Offline Darkblizzard

  • Newbie
  • *
  • Posts: 39
  • Karma: 1
Re: Commands Use
« Reply #2 on: March 18, 2015, 05:52:21 PM »
I mean like not when it says "(Someone) did this to this (Player), not that. I mean just typing out the command regularly and it works, but it just stays in chat. I want it to disappear when the command is used.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Commands Use
« Reply #3 on: March 18, 2015, 06:02:37 PM »
I believe he means not showing the "!slap" command in chat when he types it.  Remove the text so i doesn't show.  I don't believe this comes with ULX/ULib on default, but easy to change.  I've had to help someone with this before.

In file <gmod folder>/addons/ulib/lua/ulib/server/concommand.lua change line 68 to this:
Code: [Select]
return ""

So the whole function will look like this:
Code: [Select]
local function sayCmdCheck( ply, strText, bTeam )
local match
for str, data in pairs( ULib.sayCmds ) do
local str2 = str
if strText:len() < str:len() then -- Go ahead and allow commands w/o spaces
str2 = string.Trim( str )
end

if strText:sub( 1, str2:len() ):lower() == str2 then
if not match or match:len() <= str:len() then -- Don't rematch if there's a more specific one already.
match = str
end
end
end

if match then -- We've got a winner!
local data = ULib.sayCmds[ match ]

local args = string.Trim( strText:sub( match:len() + 1 ) ) -- Strip the caller command out
local argv = ULib.splitArgs( args )

-- ULib command callback
if data.__cmd then
local return_value = hook.Call( ULib.HOOK_COMMAND_CALLED, _, ply, data.__cmd, argv )
if return_value == false then
return nil
end
end

if not ULib.ucl.query( ply, data.access ) then
ULib.tsay( ply, "You do not have access to this command, " .. ply:Nick() .. "." )
-- Print their name to intimidate them :)
return "" -- Block from appearing
end

local fn = data.fn
local hide = data.hide

ULib.pcallError( fn, ply, match:Trim(), argv, args )
return ""
end

return nil
end
« Last Edit: March 18, 2015, 06:04:18 PM by Aaron113 »

Offline Darkblizzard

  • Newbie
  • *
  • Posts: 39
  • Karma: 1
Re: Commands Use
« Reply #4 on: March 18, 2015, 06:43:03 PM »
Thank you!

Offline Professor_Smiley

  • Newbie
  • *
  • Posts: 45
  • Karma: -24
Re: Commands Use
« Reply #5 on: April 06, 2015, 06:29:56 AM »
no problem

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: Commands Use
« Reply #6 on: April 06, 2015, 06:51:19 AM »
I'm a big fan of not changing core code when you don't have to.  Cobalt's Custom Commands (http://forums.ulyssesmod.net/index.php?topic=7268.0) provides, among other things, a !hide (ulx hide) command, which allows ulx commands to be issued without being reported in chat (or as part of log echo) and without requiring core mods which can get overwritten by updates.

This does of course require permissions be set for !hide, and may allow admins to run other commands in a hidden manner that you might find undesirable, which might require some mods to Custom Commands.

Just my $.02.  Cheers.


Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Commands Use
« Reply #7 on: April 06, 2015, 09:14:37 AM »
This does of course require permissions be set for !hide, and may allow admins to run other commands in a hidden manner that you might find undesirable, which might require some mods to Custom Commands.

The !hide command still makes the player (admin) run the command, so ULX/ULib kicks in with permissions either way. All !hide really does is temporarily get logecho to 0 and then back to what it was after the command has been run.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: Commands Use
« Reply #8 on: April 06, 2015, 09:32:23 AM »
The !hide command still makes the player (admin) run the command, so ULX/ULib kicks in with permissions either way. All !hide really does is temporarily get logecho to 0 and then back to what it was after the command has been run.

I meant that if he wanted (for example), slay to be usable through !hide, but kick to NOT be useable through hide, then some configuration/coding might be necessary.  I understand that the underlying permissions for slay and kick are still applied.

Hide doesn't just toggle logecho -- it also suppresses the command's presence in chat, which is what I believe the OP was looking for.

Never mind -- I'm being daft.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Commands Use
« Reply #9 on: April 06, 2015, 09:59:55 AM »
I meant that if he wanted (for example), slay to be usable through !hide, but kick to NOT be useable through hide, then some configuration/coding might be necessary.  I understand that the underlying permissions for slay and kick are still applied.

Ah, I misunderstood. Yes, that would essentially be a problem.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.