kimokimo
Kimo
can anyone make or give me level based manarune its simple script
+rep
function math.Round(number)
if number >= 0 then
return math.floor(number+.5)
else
return math.ceil(number-.5)
end
end
function onUse(cid, item, frompos, item2, topos)
-- Config
local magiclveq = 1
local levelreq = 8
local effect = 12
-- Config
if isPlayer(item2.uid) then
if getPlayerMagLevel(item2.uid) >= magiclveq then
if getPlayerLevel(item2.uid) >= leveleq then
-- Formula
local level = getPlayerLevel(item2.uid)
local magic = getPlayerMagLevel(item2.uid)
local min = (level * 7.33) + (magic * 4) - 50
local max = (level * 9.33) + (magic * 5) - 10
local addMana = doPlayerAddMana(math.round(min,max))
-- Formula
doPlayerAddMana(item2.uid, math.Round(addMana))
doSendMagicEffect(getCreaturePosition(item2.uid), effect)
doSendAnimatedText(getCreaturePosition(item2.uid), ""..mathRound(addMana).."")
doRemoveItem(item.uid, 1)
end
else
doPlayerSendCancel(cid, "Sorry, not enough level.")
end
else
doPlayerSendCancel(cid, "Sorry, not enough magic level.")
else
doPlayerSendCancel(cid, "Sorry, not possible.")
end
return true
end
Put this in your lib/050-functions.lua:
LUA:function math.Round(number) if number >= 0 then return math.floor(number+.5) else return math.ceil(number-.5) end endLUA:function onUse(cid, item, frompos, item2, topos) -- Config local magiclveq = 1 local levelreq = 8 local effect = 12 -- Config if isPlayer(item2.uid) then if getPlayerMagLevel(item2.uid) >= magiclveq then if getPlayerLevel(item2.uid) >= leveleq then -- Formula local level = getPlayerLevel(item2.uid) local magic = getPlayerMagLevel(item2.uid) local min = (level * 7.33) + (magic * 4) - 50 local max = (level * 9.33) + (magic * 5) - 10 local addMana = doPlayerAddMana(math.round(min,max)) -- Formula doPlayerAddMana(item2.uid, math.Round(addMana)) doSendMagicEffect(getCreaturePosition(item2.uid), effect) doSendAnimatedText(getCreaturePosition(item2.uid), ""..mathRound(addMana).."") doRemoveItem(item.uid, 1) end else doPlayerSendCancel(cid, "Sorry, not enough level.") end else doPlayerSendCancel(cid, "Sorry, not enough magic level.") else doPlayerSendCancel(cid, "Sorry, not possible.") end return true end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(isPlayer(itemEx.uid) == true) then
local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
local heal = level * 9 + mlevel * 1 - 100
local maxheal = level * 8 + mlevel * 1
doPlayerAddMana(cid, math.abs(heal, maxheal))
doSendMagicEffect(getThingPos(itemEx.uid), 12)
else
doPlayerSendCancel(cid,"Can Only Use On Creatures")
end
return true
end