Step 1: Use the condition of the plane.
Since the line lies in the \( ZOX \) plane, the direction cosine along the \( y \)-axis is zero.
\[
m = 0
\]
Step 2: Use the angle with the \( Z \)-axis.
If the line makes an angle of \( 30^\circ \) with the \( Z \)-axis, then
\[
n = \cos 30^\circ = \frac{\sqrt{3}}{2}
\]
Step 3: Use the relation between direction cosines.
\[
l^2 + m^2 + n^2 = 1
\]
\[
l^2 + 0 + \left(\frac{\sqrt{3}}{2}\right)^2 = 1
\]
Step 4: Solve for \( l \).
\[
l^2 = 1 - \frac{3}{4} = \frac{1}{4}
\Rightarrow
l = \pm \frac{1}{2}
\]
Step 5: Conclusion.
Hence, the direction cosines are
\[
\left( \pm \frac{1}{2}, 0, \frac{\sqrt{3}}{2} \right)
\]