• 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 Solved

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,398
Reaction score
165
Hello i got this scrip custom pot
it works good , but i want to put exaust like real potion and
Vocations i want that only
1,2,3 voc LEts say can use it
script
PHP:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 20000))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local level = 550
    local mana_add = math.random(4600,5600)
    if getPlayerLevel(cid) >= level then
        doCreatureAddHealth(cid, mana_add)
        for i = 1,3 do
        doSendMagicEffect(getThingPos(itemEx.uid), math.random(8,8)+i)
        end
        doCreatureSay(itemEx.uid, "Yeah!!", TALKTYPE_ORANGE_1)
    else
        doPlayerSendCancel(cid, "You Need More Levels To Use This.")
    end
    return true
end

thanks in advance

Aswell can i ask for same script but it should heal health and mana on use
 
Last edited:
it works , but if another voc try use it and it says "You Need More Levels To Use This."
how i can set so if wrong vocation using potion he get msg " This potion is not for your vocation use different potion"
 
it works , but if another voc try use it and it says "You Need More Levels To Use This."
how i can set so if wrong vocation using potion he get msg " This potion is not for your vocation use different potion"
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local vocations = {1,2,3}
    if(hasCondition(cid, CONDITION_EXHAUST)) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return true
    elseif not isInArray(vocations, getPlayerVocation(cid))
        doPlayerSend msg bla bla
        return true
    else
        local level = 550
        local mana_add = math.random(4600,5600)
        if getPlayerLevel(cid) >= level then
            doCreatureAddHealth(cid, mana_add)
            for i = 1,3 do
                doSendMagicEffect(getCreaturePosition(cid), math.random(8,8)+i)
            end
            doCreatureSay(cid, mana_add, TALKTYPE_ORANGE_1)
            doAddCondition(cid, exhaust)
        else
            doPlayerSendCancel(cid, "You Need More Levels To Use This.")
        end
    return true
    end
end

should work, change the msg string at isinarray
 
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local vocations = {1,2,3}
    if(hasCondition(cid, CONDITION_EXHAUST)) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return true
    elseif not isInArray(vocations, getPlayerVocation(cid))
        doPlayerSend msg bla bla
        return true
    else
        local level = 550
        local mana_add = math.random(4600,5600)
        if getPlayerLevel(cid) >= level then
            doCreatureAddHealth(cid, mana_add)
            for i = 1,3 do
                doSendMagicEffect(getCreaturePosition(cid), math.random(8,8)+i)
            end
            doCreatureSay(cid, mana_add, TALKTYPE_ORANGE_1)
            doAddCondition(cid, exhaust)
        else
            doPlayerSendCancel(cid, "You Need More Levels To Use This.")
        end
    return true
    end
end

should work, change the msg string at isinarray

this one aint working
PHP:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local vocations = {1,2,3}
    if(hasCondition(cid, CONDITION_EXHAUST)) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return true
    elseif not isInArray(vocations, getPlayerVocation(cid)) then
        doPlayerSendCancel(cid, "This potion is only for knights!.")
        return true
    else
        local level = 550
        local mana_add = math.random(4600,5600)
        if getPlayerLevel(cid) >= level then
            doCreatureAddHealth(cid, mana_add)
            for i = 1,3 do
                doSendMagicEffect(getCreaturePosition(cid), math.random(8,8)+i)
            end
            doCreatureSay(cid, mana_add, TALKTYPE_ORANGE_1)
            doAddCondition(cid, exhaust)
        else
            doPlayerSendCancel(cid, "You Need More Levels To Use This.")
        end
    return true
    end
end
 
when i copy paste ur script i get the wrong vocation message
you set it to a cancelmessage so it will show at the bottom of ur game square, not in chat, change messagetype if u want it in chat
 
Can you change the thread to solved when you've fixed the issue, for your future threads?
I was almost smashing my head against my keyboard reading through these posts, then got to the end realising there wasn't an issue any longer.

-- Edit.. wtfseriouslyomgwtfchangethefuckingtagnotthetitle!
 
Last edited by a moderator:
Back
Top