Northnorial
Member
I made this script for a mana rune. But I don't know how to make it removing rune charges. Could you help me? 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local level = getPlayerLevel(cid)
local magicbonus = getPlayerMagLevel(cid)
local config = {
mana = level + magicbonus*5,
level = 50,
mlvl = 3,
itemid = 2314
}
if (getPlayerItemCount(cid, config.itemid) >= 1) and (getPlayerLevel(cid) >= config.level) and (getPlayerMagLevel(cid) >= config.mlvl) then
doPlayerAddMana(cid, config.mana)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
doSendAnimatedText(getCreaturePosition(cid), config.mana, TEXTCOLOR_LIGHTBLUE)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You gained "..config.mana.." mana.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You gained "..config.mana.." mana.")
else
doPlayerSendCancel(cid, "You need level "..config.level.." and magic level "..config.mlvl.." to use this rune.")
end
return TRUE
end