with onattack should look something like this:
local stages = {
{ from = 1, to = 9 }
{ from = 10, to = 19 }
{ from = 20, to = 29 }
{ from = 30, to = 39 }
{ from = 40, to = 49 }
{ from = 50, to = 59 }
{ from = 60, to = 999999 }
}
function onAttack(cid, target)
local level =...