Martiimeus
●тнυg●ℓιƒє● ρα¢ 4 єνєя
As the title says my manarune isn't working yet idk why heres the error code:
And heres the script:
If some1 would help me I'd rep him ofc^^
:wub:*Using Mystic Spirit*
Code:
[27/07/2009 21:27:12] Lua Script Error: [Action Interface]
[27/07/2009 21:27:12] data/actions/scripts/tools/xmanarune.lua:onUse
[27/07/2009 21:27:12] data/actions/scripts/tools/xmanarune.lua:39: attempt to call global 'comparePos' (a nil value)
[27/07/2009 21:27:12] stack traceback:
[27/07/2009 21:27:12] data/actions/scripts/tools/xmanarune.lua:39: in function <data/actions/scripts/tools/xmanarune.lua:17>
And heres the script:
PHP:
-- Script 70% by Noxu, 30% by Paukus for help(Except for the exhaustion system).
-- If you edit this script, make sure to leave the credits to me, Noxu.
-- >>CONFIG<< --
local REMOVE_CHARGES = false
local MIN_MANA = 500
local MAX_MANA = 1000
local USE_STATS = true
local STORE_VALUE = 3567
local EXHAUST_TIME = 1
local ANIMATION_COLOR = 183
-- >>CONFIG<< --
local vocMultiply = {0.35, 0.35, 0.85, 1.05, 0, 0, 0.65, 1.05} -- Remove and/or comment it out if you wish not to use it.
local removeMana = 0
function onUse(cid, item, frompos, item2, topos)
if isPlayer(item2.uid) == 1 then
local maxMana = getPlayerMaxMana(item2.uid)
if vocMultiply and getPlayerVocation(cid) >= 1 and getPlayerVocation(cid) <= 8 then
removeMana = vocMultiply[getPlayerVocation(cid)]
end
local newMana = math.random(MIN_MANA, MAX_MANA)
if USE_STATS then
newMana = math.ceil(newMana + getPlayerLevel(cid) + getPlayerMagLevel(cid) - (newMana * removeMana))
end
if (maxMana - newMana) < 0 then
newMana = maxMana - getPlayerMana(cid)
end
if getPlayerMana(item2.uid) < maxMana then
if exhaust(cid, STORE_VALUE, EXHAUST_TIME) > 0 then
if REMOVE_CHARGES then
if item.type > 1 then
doChangeTypeItem(item.uid, item.type - 1)
else
doRemoveItem(item.uid, 1)
end
end
if comparePos(getPlayerPosition(cid), getPlayerPosition(item2.uid)) then
doSendMagicEffect(getPlayerPosition(cid), 12)
doPlayerSendTextMessage(cid, 23, "You received " .. newMana .. " mana.")
else
doSendMagicEffect(getPlayerPosition(cid), 14)
doSendMagicEffect(getPlayerPosition(item2.uid), 12)
doPlayerSendTextMessage(item2.uid, 23, "You received " .. newMana .. " mana from " .. getPlayerName(cid) .. ".")
doPlayerSendTextMessage(cid, 23, "You gave " .. getPlayerName(item2.uid) .. " " .. newMana .. " mana.")
end
doPlayerAddMana(item2.uid, 1000)
doSendAnimatedText(getPlayerPosition(item2.uid), newMana, ANIMATION_COLOR)
else
doPlayerSendCancel(cid, "You are exhausted.")
end
else
if comparePos(getPlayerPosition(cid), getPlayerPosition(item2.uid)) then
doPlayerSendCancel(item2.uid, "Your mana is already full.")
else
doPlayerSendCancel(cid, getPlayerName(item2.uid) .. " mana is already full.")
end
doSendMagicEffect(getPlayerPosition(cid), 2)
end
else
doPlayerSendCancel(cid, "You can only use this rune on players.")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
return 1
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
If some1 would help me I'd rep him ofc^^
:wub:*Using Mystic Spirit*
Last edited: