For stencil shadow you must manage 3 things:

1. Setting shadow_stencil, before loading your level. As far as I see, you already managed that.

2. Having a model with SHADOW flag, and it must not be a transparent model, because transparent models dont throw shadows. Now when you ask "What is a transparent model"? you find transparency described in the manual under "Entities".

3. Not switching off the sun.

Hope this helps.