With my clairvoyant skills I see that you put Nebel(); before the level_load() function ^^ Why do I know this? Because I guess that the engine crashes because the player pointer is invalid (this means that the player is not created yet).
So improve your function a bit:
function Nebel()
{
while (1)
{
if(player != NULL)
{
if (player.z<0)
{
camera.fog_start=100;
fog_color=2;
camera.fog_end=1000;
}
else
{
fog_color=0;
}
}
wait(1);
}
}