_SOLVED_
_PROBLEM_
I can get it to work with a number range (50 > 100)
But I can not get it to work with level numbers:
The error I get in the console is:
Lua:
function onCastSpell(cid, item, fromPosition, toPosition)
local level = getPlayerLevel(cid)
local mana = math.random(level, (level*2))
doPlayerAddMana(cid, mana)
doSendAnimatedText(getPlayerPosition(cid), '+' .. mana, TEXTCOLOR_PURPLE)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
end
_PROBLEM_
I can get it to work with a number range (50 > 100)
But I can not get it to work with level numbers:
Lua:
function onCastSpell(cid, item, fromPosition, toPosition)
local min = level
local max = (level*2)
local mana = math.random(min, max)
doPlayerAddMana(cid, mana)
doSendAnimatedText(getPlayerPosition(cid), '+' .. mana, TEXTCOLOR_PURPLE)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
end
The error I get in the console is:
attempt to perform arithmetic on global 'level' (a nil value)
Last edited: