Estava faltando um 'end' também:
function onStatsChange(cid, attacker, type, combat, value)
local item = 2160
local pos = {x = 979, y = 1461, z = 4}
local monsters = {"dwarf", "dwarf guard", "dwarf geomancer"}
if not isMonster(attacker) then
return true
end
if isInArray(monsters, getCreatureName(attacker):lower()) and getTileItemById(pos, item).uid > 0 then
player:setStorageValue(70065, os.time() + 120)
if player:getStorageValue(70065) > os.time() then
if type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS then
return false
end
end
return true
end
end