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

Solved [MANARUNE SCRIPT] Vocation help

Acrenactive

★Designer★
Joined
Mar 21, 2013
Messages
224
Reaction score
56
Location
Los Angels L.A
hey how i do so only druid and sorcerer can use this rune?

Code:
local MIN = 1323
local MAX = 1423

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayer(itemEx.uid) == FALSE then
        return FALSE
    end

    if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return TRUE
    end

    if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
        return FALSE
    end

    doAddCondition(cid, exhaust)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(itemEx.uid, "Aohhh...", TALKTYPE_ORANGE_1)

    return TRUE
end
 
Code:
if isSorcerer(cid) or isDruid(cid) then
     --- the part that starts with if hasCondition here.. till doCreatureSay
else
     doCreatureSay(cid, "Only for sorcerers and druids", TALKTYPE_ORANGE_1)
end
 
Add it around this part
Code:
if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
     doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
     return TRUE
end

if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
     return FALSE
end

doAddCondition(cid, exhaust)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(itemEx.uid, "Aohhh...", TALKTYPE_ORANGE_1)
So the if statement (if isSorcerer(cid) or isDruid(cid) then) should be above that.
The else part should be under that.
 
Code:
local MIN = 1323
local MAX = 1423

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
if isPlayer(itemEx.uid) == FALSE then
return FALSE
end

if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
if isSorcerer(cid) or isDruid(cid) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end

if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
return FALSE
end

doAddCondition(cid, exhaust)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(itemEx.uid, "Aohhh...", TALKTYPE_ORANGE_1)

return TRUE
end


--------------------------------------------------------------------------------------
can you fix this script i dont understand how you mean ? :)
 
Code:
if isSorcerer(cid) or isDruid(cid) then
     if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
         return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
     end

     if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
         return false
     end
     doAddCondition(cid, exhaust)
     doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
     doCreatureSay(itemEx.uid, "Aohhh...", TALKTYPE_ORANGE_1)
else
     doCreatureSay(cid, "Only for sorcerers and druids", TALKTYPE_ORANGE_1)
end
Like this it will only do that part of the script if the person who uses the mana rune is a druid or a sorcerer, if not, you will see that orange message: "Only for sorcerers and druids"
 
Code:
local MIN = 1323
local MAX = 1423

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

  function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayer(itemEx.uid) == FALSE then
        return FALSE
    end

   if isSorcerer(cid) or isDruid(cid) then
     if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
         return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
     end

     if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
         return false
     end
     doAddCondition(cid, exhaust)
     doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
     doCreatureSay(itemEx.uid, "Aohhh...", TALKTYPE_ORANGE_1)
else
     doCreatureSay(cid, "Only for sorcerers and druids", TALKTYPE_ORANGE_1)
end

this error i get in console


Code:
[Error - LuaScriptInterface::loadFile] data/actions/scripts/manarune3.lua:27: 'end' expected (to close 'function' at line 7) near '<eof>'
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/manarune3.lua)
data/actions/scripts/manarune3.lua:27: 'end' expected (to close 'function' at line 7) near '<eof>'
Reloaded actions.
 
if i want paladin druid and sorcerer can use it how i do

Code:
if isSorcerer(cid) or isDruid(cid) then

and if i only want knight use it
can you do one with sorcerer druid and paladin. after that can you do one only knight script ? i hope you understand me.
 
You can do
Code:
if isSorcerer(cid) or isDruid(cid) or isPaladin(cid) then

Or you can do
Code:
if not isKnight(cid) then

If you only want a knight to be able to use it
Code:
if isKnight(cid) then
 
Back
Top