Thanks, I simplified them so both commands will be like this:
--------------------------------------------------
function ulx.unafk( calling_ply, target_plys )
if target_plys !={} and not ULib.ucl.query( calling_ply, "ulx afk" ) then -- If there are targets but the player has no permission, the command will not be run
ULib.tsayError( calling_ply, "You can only use this command on yourself!", true ) -- Player is warned
return
else
for _,v in pairs(target_plys) do v:ConCommand("ttt_spectator_mode 0") end
ulx.fancyLogAdmin( calling_ply, "#A forced #T into player mode", target_plys )
end
end
local unafk = ulx.command( "TTT", "ulx unafk", ulx.unafk, "!unafk" )
unafk:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional }
unafk:defaultAccess( ULib.ACCESS_ALL )
unafk:help( "Disables spectate-only mode (for the n00bs)." )
----------------------------------------------------------------
function ulx.afk( calling_ply, target_plys )
if SERVER then ULib.ucl.registerAccess( "ulx afk" , ULib.ACCESS_OPERATOR, "Allows group to force spectator", "TTT" ) end
for _,v in pairs(target_plys) do v:ConCommand("ttt_spectator_mode 1") v:ConCommand("ttt_cl_idlepopup") end
ulx.fancyLogAdmin( calling_ply, "#A forced #T into spectator mode", target_plys )
end
local fspec = ulx.command( "TTT", "ulx afk", ulx.afk, "!afk" )
fspec:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional }
fspec:defaultAccess( ULib.ACCESS_SUPERADMIN )
fspec:help( "Forces the target(s) to spectator mode." )
I'll leave this for anyone who wants it. Hope it works well.