Hello
im trying to add magic level scrolls and skill scroll based in vocations to my server
but i got an error when i try to use this magic scroll script
this is the magicscroll.lua file
but i got this error when i use the item
the script is based on mana spent
im trying to add magic level scrolls and skill scroll based in vocations to my server
but i got an error when i try to use this magic scroll script
this is the magicscroll.lua file
Lua:
local t = {
[12466] = {
[{1, 5}] = {100, 100}, -- {MAX_LEVEL, SPENT_MANA}
[{2, 6}] = {100, 100},
[{3, 7}] = {25, 100},
[{4, 8}] = {10, 100}
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
for voc, b in pairs(k) do
if(isInArray(voc, getPlayerVocation(cid))) then
if(getPlayerMagLevel(cid) < b[1]) then
doPlayerAddSpentMana(cid, b[2] / getConfigInfo('rateMagic'))
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid, 1)
else
return doPlayerSendCancel(cid, "You have reached the maximum level.")
end
end
end
return true
end
but i got this error when i use the item
Code:
[Error - Action Interface]
data/actions/scripts/magicscroll.lua:onUse
Description:
data/actions/scripts/magicscroll.lua:11: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in function 'pairs'
data/actions/scripts/magicscroll.lua:11: in function <data/actions/scripts/magicscroll.lua:10>
the script is based on mana spent