forked from TeamUlysses/ulib
Simplify the purpose of PostCommandCalled (#87)
This commit is contained in:
parent
e4272fe742
commit
fe5aedc7c9
@ -25,7 +25,6 @@ ULib.sayCmds = ULib.sayCmds or {}
|
||||
Revisions:
|
||||
|
||||
v2.10 - Made case-insensitive
|
||||
v2.72 - Added ULibPostCommandCalled
|
||||
]]
|
||||
local function sayCmdCheck( ply, strText, bTeam )
|
||||
local match
|
||||
@ -69,8 +68,7 @@ local function sayCmdCheck( ply, strText, bTeam )
|
||||
local fn = data.fn
|
||||
local hide = data.hide
|
||||
|
||||
local err = ULib.pcallError( fn, ply, match:Trim(), argv, args )
|
||||
hook.Call( ULib.HOOK_POST_COMMAND_CALLED, _, ply, data.__cmd, argv, hide, not err )
|
||||
ULib.pcallError( fn, ply, match:Trim(), argv, args )
|
||||
|
||||
if hide then return "" end
|
||||
end
|
||||
|
@ -948,8 +948,8 @@ local function translateCmdCallback( ply, commandName, argv )
|
||||
end
|
||||
end
|
||||
|
||||
cmd:call( isOpposite, unpack( args ) )
|
||||
hook.Call( ULib.HOOK_POST_TRANSLATED_COMMAND, _, ply, commandName, args )
|
||||
local callResult = cmd:call( isOpposite, unpack( args ) )
|
||||
hook.Call( ULib.HOOK_POST_TRANSLATED_COMMAND, _, ply, commandName, args, callResult )
|
||||
end
|
||||
|
||||
local function translateAutocompleteCallback( commandName, args )
|
||||
@ -1315,7 +1315,6 @@ end
|
||||
Revisions:
|
||||
|
||||
v2.62 - Initial
|
||||
v2.72 - Added ULibPostCommandCalled
|
||||
]]
|
||||
function cmds.execute( cmdTable, ply, commandName, argv )
|
||||
if CLIENT and not cmdTable.__client_only then
|
||||
@ -1330,7 +1329,6 @@ 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
|
||||
|
||||
|
@ -116,25 +116,6 @@ 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
|
||||
|
||||
@ -186,10 +167,12 @@ ULib.HOOK_PLAYER_TARGETS = "ULibPlayerTargets" -- Exactly the same as the above
|
||||
ply - The player that executed the command.
|
||||
commandName - The command that's being executed.
|
||||
translated_args - A table of the translated arguments, as passed into the callback function itself.
|
||||
callResult - The return value of the command function.
|
||||
|
||||
Revisions:
|
||||
|
||||
v2.40 - Initial
|
||||
v2.72 - Add the callResult parameter
|
||||
]]
|
||||
ULib.HOOK_POST_TRANSLATED_COMMAND = "ULibPostTranslatedCommand"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user