Ulysses

Ulysses Stuff => General Chat & Help and Support => Topic started by: Darkblizzard on March 18, 2015, 05:47:00 PM

Title: Commands Use
Post by: Darkblizzard 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.
Title: Re: Commands Use
Post by: Megiddo on March 18, 2015, 05:50:28 PM
You mean that it doesn't echo to chat?
Title: Re: Commands Use
Post by: Darkblizzard 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.
Title: Re: Commands Use
Post by: Aaron113 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
Title: Re: Commands Use
Post by: Darkblizzard on March 18, 2015, 06:43:03 PM
Thank you!
Title: Re: Commands Use
Post by: Professor_Smiley on April 06, 2015, 06:29:56 AM
no problem
Title: Re: Commands Use
Post by: Buzzkill 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 (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.

Title: Re: Commands Use
Post by: Decicus 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 (https://github.com/jkralicky/Custom-ULX-Commands/blob/master/CustomCommands/lua/ulx/modules/sh/cc_util.lua#L514) and then back to what it was (https://github.com/jkralicky/Custom-ULX-Commands/blob/master/CustomCommands/lua/ulx/modules/sh/cc_util.lua#L524) after the command has been run.
Title: Re: Commands Use
Post by: Buzzkill 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 (https://github.com/jkralicky/Custom-ULX-Commands/blob/master/CustomCommands/lua/ulx/modules/sh/cc_util.lua#L514) and then back to what it was (https://github.com/jkralicky/Custom-ULX-Commands/blob/master/CustomCommands/lua/ulx/modules/sh/cc_util.lua#L524) 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.
Title: Re: Commands Use
Post by: Decicus 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.