What I’m tring to do
Yo, I was wondering if there is any way to handle the commands without affecting the original registered handler
example
@some-resource/server.lua
:
local whatever = {}
RegisterCommand("savestuff", function(_, args)
table.insert(whatever, args)
end)
@my-resource/server.lua
:
AddCommandHandler("savestuff", function(_,args)
print("stuff saved:")
for _,arg in ipairs(args) do print(arg) end
end)
where AddCommandHandler
is some kind of native/function that I’d like to find something similar to it.
What is the point
That kind of native/event/function would be much effective when it comes to the built-in commands
such as set
, add_principal
, etc…
example
AddCommandHandler("set", function(_,args)
print(args[1] .. " is set to be " .. args[2]) -- "bool_convar is set to be true"
end)
Why do I even need to do so
that would give access to unreachable stuff by default, such as player principals, as we could use the native IsPlayerAceAllowed
to check the if an ace is allowed for a certain player, but we are not able to check their principals, for example we want to know if the player -who have access to fly command for example- is in gourp admin
or superadmin
assuming that last two groups have the access to fly command, with handle command case, we could store the changes in principals or so.
Some natives I’ve tried to use
RegisterConsoleListener
it appears that it listens to the outputs -prined lines- and not the inputs -commands-
GetConsoleBuffer
it was effective but it returns punch of lines that aren’t necessary, which by turn consume the memory,
and it should be called everytime to check and prase the commands, which is even worst than the previous acts, so we are in the same place.
lmk if you have any idea, thanks for your time reading this topic…