• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Error Mr

ssiwyy158

Member
Joined
Jan 24, 2011
Messages
128
Solutions
2
Reaction score
13
TFS 0.4 r3884 8.6.

Hello. Script:


Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)
setConditionParam(exhaust, CONDITION_PARAM_SUBID, EXHAUST_HEALING)

function onUse(cid, item, fromPosition, itemEx, toPosition)
local min, max
local lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid)
if isSorcerer(cid) or isDruid(cid) then
min = lvl * 1.0 + mag * 1.0
max = lvl * 1.0 + mag * 1.0
elseif isPaladin(cid) then
min = lvl * 1.0 + mag * 1.0
max = lvl * 1.0 + mag * 1.0
elseif isKnight(cid) then
min = lvl * 0.5 + mag * 0.5
max = lvl * 1.0 + mag * 1.0
end
local rand = math.random(min, max)
if rand > 550 then
rand = 550
end
if rand < 350 then
rand = 350
end
if hasCondition(cid, CONDITION_EXHAUST, EXHAUST_HEALING) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
end
if not isPlayer(itemEx.uid) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end

return doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) and doPlayerAddMana(itemEx.uid, rand) and doAddCondition(cid, exhaust) and doCreatureSay(itemEx.uid, "Aaah...", TALKTYPE_ORANGE_1)
end

Console error when use rune:
Code:
https://zapodaj.net/3db5437de64ac.png.html
 
you local min, max line was not defined, you need to put numbers there (i've chosen 300, 800, you can change those to whatever you'd like)
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)
setConditionParam(exhaust, CONDITION_PARAM_SUBID, EXHAUST_HEALING)

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local min, max = 300, 800
    local lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid)
    if isSorcerer(cid) or isDruid(cid) then
        min = lvl * 1.0 + mag * 1.0
        max = lvl * 1.0 + mag * 1.0
    elseif isPaladin(cid) then
        min = lvl * 1.0 + mag * 1.0
        max = lvl * 1.0 + mag * 1.0
    elseif isKnight(cid) then
        min = lvl * 0.5 + mag * 0.5
        max = lvl * 1.0 + mag * 1.0
    end
    local rand = math.random(min, max)
    if rand > 550 then
        rand = 550
    end
    if rand < 350 then
        rand = 350
    end
    if hasCondition(cid, CONDITION_EXHAUST, EXHAUST_HEALING) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    end
    if not isPlayer(itemEx.uid) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
    end
    return doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) and doPlayerAddMana(itemEx.uid, rand) and doAddCondition(cid, exhaust) and doCreatureSay(itemEx.uid, "Aaah...", TALKTYPE_ORANGE_1)
end
 
you local min, max line was not defined, you need to put numbers there (i've chosen 300, 800, you can change those to whatever you'd like)
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)
setConditionParam(exhaust, CONDITION_PARAM_SUBID, EXHAUST_HEALING)

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local min, max = 300, 800
    local lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid)
    if isSorcerer(cid) or isDruid(cid) then
        min = lvl * 1.0 + mag * 1.0
        max = lvl * 1.0 + mag * 1.0
    elseif isPaladin(cid) then
        min = lvl * 1.0 + mag * 1.0
        max = lvl * 1.0 + mag * 1.0
    elseif isKnight(cid) then
        min = lvl * 0.5 + mag * 0.5
        max = lvl * 1.0 + mag * 1.0
    end
    local rand = math.random(min, max)
    if rand > 550 then
        rand = 550
    end
    if rand < 350 then
        rand = 350
    end
    if hasCondition(cid, CONDITION_EXHAUST, EXHAUST_HEALING) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    end
    if not isPlayer(itemEx.uid) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
    end
    return doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) and doPlayerAddMana(itemEx.uid, rand) and doAddCondition(cid, exhaust) and doCreatureSay(itemEx.uid, "Aaah...", TALKTYPE_ORANGE_1)
end



The same problem
 
Back
Top