Hi Vedran and welcome!
It is often easier to get a visa in a neighboring country than in your own country. So I think you will be able to get a visa in Spain, BUT since you don't have an airplane ticket, you will probably have to show evidence of sufficient funds for your stay. A valid credit card may be sufficient, or travellers cheques. If you can get a letter from your school stating that you are a full-time student, or a student ID card, that will help.
Most countries visa requirements are designed to ensure that people don't come in on a visa and then decide to stay in the country and go on public assistance/welfare. So it also helps to look respectable and clean cut (get a haircut before you go to the embassy).
I would ask the Moroccan embassy in Croatia whether a student visa is available, which will be easier for you to obtain, and possibly cheaper. If not, and they insist on employment status, then you will have to take your chances in Spain.
Good luck and let us know how you go.
"It matters not what goal you seek
Its secret here reposes:
You've got to dig from week to week
To get Results or Roses."
'One world, two wheels'