change from
function onCastSpell(cid, var)
crit = getPlayerLevel(cid) / 15000
playerpos = getPlayerPosition(cid)
rand = math.random(0, 100)
local target = getCreatureTarget(cid)
if(target ~= 0) and rand >= 0 and rand <= crit then
doSendAnimatedText(playerpos, "Critical", 180)
return...