General > Developers Corner
Don't Show Commands
Zmaster:
I want to make it so when a player types something in chat that is a command (ex: !slay Zmaster), the command will go through and work, but that message won't appear in chat for everyone to see.
Where/how would I do that? If I'm thinking right, I would do it somewhere in the gamemode itself, but I'm not entirely sure
Cobalt:
You mean the chat command or the part that says "x kicked y" in chat?
Zmaster:
The chat command
Cobalt:
The 5th arg in ulx.command hides the chat message if set to true. Go into the lua and add it in for each command you want to hide chat messages for.
Zmaster:
So I tried what you said with the !slay command and it worked fine
Then I found my undercover command to add that 5th arg to it and I saw there was already a 5th arg in it and it was true, yet when I type !uc in chat it still shows me saying that?
--- Code: ---// Undercover Command
function ulx.undercover( calling_ply )
if calling_ply:IsUserGroup("owner") then
calling_ply:SetUserGroup("ucowner")
elseif calling_ply:IsUserGroup("ucowner") then
calling_ply:SetUserGroup("owner")
end
ulx.fancyLogAdmin( calling_ply, true, "#A went undercover" )
end
local undercover = ulx.command( CATEGORY_NAME, "ulx undercover", ulx.undercover, "!uc", true )
undercover:addParam{ type=ULib.cmds.PlayerArg }
undercover:defaultAccess( ULib.ACCESS_ADMIN )
undercover:help( "Makes Mods undercover (no mod tag)" )
// Undercover Command
--- End code ---
Here's the code for my !slay command (this one is working properly - the other isn't)
--- Code: --------------------------------- Slay ------------------------------
function ulx.slay( calling_ply, target_plys )
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
elseif not v:Alive() then
ULib.tsayError( calling_ply, v:Nick() .. " is already dead!", true )
elseif v:IsFrozen() then
ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
else
v:Kill()
table.insert( affected_plys, v )
end
end
ulx.fancyLogAdmin( calling_ply, "#A slayed #T", affected_plys )
end
local slay = ulx.command( CATEGORY_NAME, "ulx slay", ulx.slay, "!slay", true )
slay:addParam{ type=ULib.cmds.PlayersArg }
slay:defaultAccess( ULib.ACCESS_ADMIN )
slay:help( "Slays target(s)." )
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version