PHP:
local config = {
funnyEffect = "YES", -- Effect (YES/NO)
minimumLevel = 20,
maximumLevel = math.huge, -- for infinite type math.huge
}
local addMana = {
[{config.minimumLevel, 40}] = 500,
[{40, 80}] = 500,
[{80, 90}] = 500,
[{90, 100}] = 600,
[{100, 120}] = 700,
[{120, 199}] = 800,
[{200, config.maximumLevel}] = 1000,
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local level = getPlayerLevel(cid)
local effect = CONST_ME_MAGIC_GREEN
if level < config.minimumLevel then
doPlayerSendCancel(cid, "You need to be at least "..config.minimumLevel.." to use a manarune.")
return FALSE
end
if level >= config.maximumLevel then
doPlayerSendCancel(cid, "Your way to high level for this rune.")
return FALSE
end
for k, v in pairs(addMana) do
if level >= k[1] and level < k[2] then
doPlayerAddMana(cid, v)
doRemoveItem(item.uid, 1)
break
end
end
if config.funnyEffect == "YES" then
local pos = getPlayerPosition(cid)
local positions = {
{x=pos.x,y=pos.y,z=pos.z},
}
for i = 1, table.getn(positions) do
doSendMagicEffect(positions[i],effect)
end
end
return TRUE
end
Last edited: