You are missing area lines. You had it in your first script.
Edit
Also, the following thingis not needed, if you dont want to use it:
if min < 250 then
min = 250
end
And last function can be simply this:
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
Last thing...