• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Mana rune

salty

New Member
Joined
Mar 20, 2013
Messages
14
Reaction score
0
Hey im using this mana rune script and i was wondering if anyone could change so
it heals you as well and also remove so you can use it when you have full mana/hp. :3



PHP:
function onUse(cid, item, frompos, item2, topos) 

minMana = 10000 -- How much mana minium will you get? 
maxMana = 15000 -- How much mana max will you get? 
magToUse = 8 -- What magic level do you need to be to use the rune? 
useStats = true -- Shall given mana be affected by player level and magic level? 
runeID = 2294 -- Enter the item Id of the rune. 
loseCharges = false -- Write "true" if it shall lose charges. If not, then write something else such as "false". 
storeValue = 3567 -- Value where exhaust is saved. 
exhaustTime = 0 -- 1 = 1 second of exhaustion. 
animationColor = 44 -- The color of the "animation". 
mLvlLowMsg = "Your magic level is too low." -- Appears when player got too low magic level. 
missPlayerMsg = "You can only use this rune on players."-- Appears when you don't shoot on a player. 
exhaustMsg = "You are exhausted." -- Appears when you are exhausted. 

------------------------------DONT CHANGE UNDER THIS LINE---------------------------------------------------------------------------------------- 

if item.itemid == runeID then 
if getThingfromPos({x=topos.x, y=topos.y, z=topos.z, stackpos=253}).itemid > 0 then 
if getPlayerMagLevel(cid) >= magToUse then 
if (exhaust(cid, storeValue, 1) > 0) then 
if loseCharges == true or loseCharges == True then 
if item.type > 1 then 
doChangeTypeItem(item.uid, item.type-1) 
else 
doRemoveItem(item.uid, 1) 
end 
end 
newMana = math.random(minMana, maxMana) 
if useStats then 
newMana = newMana + getPlayerLevel(cid) + getPlayerMagLevel(cid) 
end 
manaNow = getPlayerMana(item2.uid) 
doPlayerAddMana(item2.uid, 999999) 
manaMax = getPlayerMana(item2.uid) 
doPlayerAddMana(item2.uid, - manaMax + manaNow) 
nMana = manaMax - manaNow 
if newMana > nMana then 
newMana = nMana 
end 
if getPlayerMana(item2.uid) == manaMax then 
if getPlayerPosition(cid).x == getPlayerPosition(item2.uid).x and getPlayerPosition(cid).y == getPlayerPosition(item2.uid).y then 
doPlayerSendCancel(item2.uid, "Your mana is already full.") 
doChangeTypeItem(item.uid, item.type) 
else 
doPlayerSendCancel(cid, "" .. getPlayerName(item2.uid) .. " mana is already full.") 
doChangeTypeItem(item.uid, item.type) 
end 
else 
if getPlayerPosition(cid).x == getPlayerPosition(item2.uid).x and getPlayerPosition(cid).y == getPlayerPosition(item2.uid).y then 
doSendMagicEffect(getPlayerPosition(cid), 12) 
else 
doSendMagicEffect(getPlayerPosition(cid), 14) 
doSendMagicEffect(getPlayerPosition(item2.uid), 12) 
doPlayerSendTextMessage(item2.uid, 23, "You received " .. newMana .. " mana.") 
doPlayerSendTextMessage(cid, 23, "You gave " .. getPlayerName(item2.uid) .. " " .. newMana .. " mana.") 
end 
doPlayerAddMana(item2.uid, newMana) 
doSendAnimatedText(getPlayerPosition(item2.uid), newMana, animationColor) 
end 
else 
doPlayerSendCancel(cid, exhaustMsg) 
end 
else 
doSendMagicEffect(getPlayerPosition(cid), 2) 
doPlayerSendCancel(cid, mLvlLowMsg) 
end 
else 
doSendMagicEffect(getPlayerPosition(cid), 2) 
doPlayerSendCancel(cid, missPlayerMsg) 
end 
return 1 
end 
end 


-- Exhaustion system (Made by Alreth, bugfix by me) 
-- DO NOT EDIT! 
function exhaust(cid, storeValue, exhaustTime) 

newExhaust = os.time() 
oldExhaust = getPlayerStorageValue(cid, storeValue) 
if (oldExhaust == nil or oldExhaust < 0) then 
oldExhaust = 0 
end 
if (exhaustTime == nil or exhaustTime < 0) then 
exhaustTime = 1 
end 
diffTime = os.difftime(newExhaust, oldExhaust) 
if (diffTime >= exhaustTime) then 
setPlayerStorageValue(cid, storeValue, newExhaust) 
return 1 
else 
return 0 
end 
end

- - - Updated - - -

bump
 
Last edited:
Im not reely shure if this is what you want but here:
Code:
local vocations = {1,2,3,4,5,6,7,8} 
 
function onUse(cid, item, frompos, item2, topos)
 
if isInArray(vocations,getPlayerVocation(cid)) then
 
doSendMagicEffect(topos,1)
doCreatureSay(cid,"Mixed Rune",19)
mini = (getPlayerLevel(cid) * 2.5 + getPlayerMagLevel(cid) * 3) * 4.6 - 25
maxi = (getPlayerLevel(cid) * 2.5 + getPlayerMagLevel(cid) * 3) * 5.2
 
    if doCreatureAddHealth(cid, math.random(mini, maxi)) == LUA_ERROR or doPlayerAddMana(cid, math.random(mini, maxi)) == LUA_ERROR then
        return FALSE
    end
else
 
        doPlayerSendCancel(cid, 'You cannot use this rune.')
end
    return true
end
Code:
    <action itemid="2294" event="script" value="hpmanarune.lua"/>

ALL CREDS TO Sirion_Mido
 
Back
Top