kacpersky
Mr. Brightside
- Joined
- Jan 25, 2009
- Messages
- 499
- Reaction score
- 3
in actions:
spells:
i have this manarune in actions. This rune can use over and over, when i change
to 1. This rune who have 100 charges dissapear, not like 100, 99, 98, 97 ...
someone could help me ?
PHP:
-- Mana Rune - by Killavus. --
-- Feel free to edit! --
function onUse(cid, item, frompos, item2, topos)
local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
-- Exhausted Settings --
local exhausted_seconds = 1.8 -- How many seconds manarune will be unavailible to use. --
local exhausted_storagevalue = 7000 -- Storage Value to store exhaust. It MUST be unused! --
-- Exhausted Settings END --
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 3) - 40
local mana_maximum = (level * 4) + (mlevel * 4)
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
-- We check the charges. --
if(item.type > 100) then
-- Exhausted check. --
if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
-- Entity is player? --
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doChangeTypeItem(item.uid, item.type - 1)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can use this rune only on players.")
end
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
end
else
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
else
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid, 0)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can use this rune only on players.")
end
end
end
return 1
end
spells:
PHP:
<rune name="Manarune" id="2276" allowfaruse="1" charges="100" lvl="8" maglv="0" exhaustion="2000" blocktype="solid" script="custom/polymorph.lua" />
i have this manarune in actions. This rune can use over and over, when i change
PHP:
doRemoveItem(item.uid, 0)
someone could help me ?