forked from TeamUlysses/ulib
Add ULibPostCommandCalled (#80)
* Add hook for post command called * Document the hide param * Change tenses in defines * Update versions * Fix version numbers
This commit is contained in:
parent
8f86a5a188
commit
e4272fe742
@ -25,6 +25,7 @@ ULib.sayCmds = ULib.sayCmds or {}
|
||||
Revisions:
|
||||
|
||||
v2.10 - Made case-insensitive
|
||||
v2.72 - Added ULibPostCommandCalled
|
||||
]]
|
||||
local function sayCmdCheck( ply, strText, bTeam )
|
||||
local match
|
||||
@ -68,7 +69,9 @@ local function sayCmdCheck( ply, strText, bTeam )
|
||||
local fn = data.fn
|
||||
local hide = data.hide
|
||||
|
||||
ULib.pcallError( fn, ply, match:Trim(), argv, args )
|
||||
local err = ULib.pcallError( fn, ply, match:Trim(), argv, args )
|
||||
hook.Call( ULib.HOOK_POST_COMMAND_CALLED, _, ply, data.__cmd, argv, hide, not err )
|
||||
|
||||
if hide then return "" end
|
||||
end
|
||||
|
||||
|
@ -1315,6 +1315,7 @@ end
|
||||
Revisions:
|
||||
|
||||
v2.62 - Initial
|
||||
v2.72 - Added ULibPostCommandCalled
|
||||
]]
|
||||
function cmds.execute( cmdTable, ply, commandName, argv )
|
||||
if CLIENT and not cmdTable.__client_only then
|
||||
@ -1329,6 +1330,7 @@ function cmds.execute( cmdTable, ply, commandName, argv )
|
||||
local return_value = hook.Call( ULib.HOOK_COMMAND_CALLED, _, ply, commandName, argv )
|
||||
if return_value ~= false then
|
||||
cmdTable.__fn( ply, commandName, argv )
|
||||
hook.Call( ULib.HOOK_POST_COMMAND_CALLED, _, ply, commandName, argv )
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
ULib = ULib or {}
|
||||
|
||||
ULib.RELEASE = false -- Don't access these two directly, use ULib.pluginVersionStr("ULib")
|
||||
ULib.VERSION = 2.71
|
||||
ULib.VERSION = 2.72
|
||||
ULib.AUTOMATIC_UPDATE_CHECKS = true
|
||||
|
||||
ULib.ACCESS_ALL = "user"
|
||||
@ -116,6 +116,25 @@ ULib.HOOK_LOCALPLAYERREADY = "ULibLocalPlayerReady"
|
||||
]]
|
||||
ULib.HOOK_COMMAND_CALLED = "ULibCommandCalled"
|
||||
|
||||
--[[
|
||||
Hook: ULibPostCommandCalled
|
||||
|
||||
Called *on server* after a ULib command is run.
|
||||
|
||||
Parameters passed to callback:
|
||||
|
||||
ply - The player that executed the command.
|
||||
commandName - The command that was executed.
|
||||
args - The table of args for the command.
|
||||
hide - If triggered from a chat command, a boolean indicating if the output of the command should be hidden.
|
||||
success - If triggered from a chat command, a boolean indicating if the command ran successfully.
|
||||
|
||||
Revisions:
|
||||
|
||||
v2.72 - Initial
|
||||
]]
|
||||
ULib.HOOK_POST_COMMAND_CALLED = "ULibPostCommandCalled"
|
||||
|
||||
--[[
|
||||
Hook: ULibPlayerTarget
|
||||
|
||||
@ -467,6 +486,4 @@ if SERVER then
|
||||
util.AddNetworkString( "tsayc" )
|
||||
util.AddNetworkString( "ulib_repWriteCvar" )
|
||||
util.AddNetworkString( "ulib_repChangeCvar" )
|
||||
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user