In shrubbot.cfg
[command]
command = spec
exec = putteam [i] s; specplayer [i] "[1?]"
desc = spec any player
syntax = [name]
levels = 0 1 2 3 4 5
In Lua:
function et_ConsoleCommand(command)
if et.trap_Argv(0) == "specplayer" then
if et.trap_Argc() == 3 then
local clientNum = et.trap_Argv(1)
local targetClientNum = et.ClientNumberFromString(et.trap_Argv(2))
et.gentity_set(clientNum, "sess.spectatorState", 2)
et.gentity_set(clientNum, "sess.spectatorClient", targetClientNum)
end
return 1
end
return 0
end
Notice that the Lua hook is now ConsoleCommand and not ClientCommand.