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

Problem with UH script

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
Hi, i have problem with my uh script cuz i try add min level and vocation to use but after it not work ;/

Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 1000))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mlevel = getPlayerMagLevel(cid)
    local mana_leg = (getCreatureMaxHealth(cid) / 17)
    local mana_c = (getPlayerLevel(cid) * 4)
    local manafull = (mana_leg + mana_c)
    local mana_add = manafull
    if(getPlayerLevel(cid) >= 10000) and (getPlayerVocation(cid) == 8) then
    doCreatureAddHealth(cid, mana_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(itemEx.uid, "U-UH", TALKTYPE_ORANGE_1)
    else
            doCreatureSay(itemEx.uid, "WRONG!", TALKTYPE_ORANGE_1)
    end
    end
 
Solution
I know, but i have vocation Elite Knight and it not work
Try this, and show us a screenshot of the console.
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 1000))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mlevel = getPlayerMagLevel(cid)
    local mana_leg = (getCreatureMaxHealth(cid) / 17)
    local mana_c = (getPlayerLevel(cid) * 4)
    local manafull = (mana_leg + mana_c)
    local mana_add = manafull
    print("Player level is: " .. getPlayerLevel(cid))
    print("Player vocation is: " .. getPlayerVocation(cid))
    if getPlayerLevel(cid) >= 10000 and isInArray({4, 8}, getPlayerVocation(cid)) then...
Is the player greater than or equal to level 10k and has the vocation 8?
Because that is the only way that this line will execute
Lua:
    doCreatureAddHealth(cid, mana_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(itemEx.uid, "U-UH", TALKTYPE_ORANGE_1)
But if the script has an error then the server will not load it at all.

But then again it could just be the return true missing at end?
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 1000))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mlevel = getPlayerMagLevel(cid)
    local mana_leg = (getCreatureMaxHealth(cid) / 17)
    local mana_c = (getPlayerLevel(cid) * 4)
    local manafull = (mana_leg + mana_c)
    local mana_add = manafull
    if(getPlayerLevel(cid) >= 10000) and (getPlayerVocation(cid) == 8) then
        doCreatureAddHealth(cid, mana_add)
        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
        doCreatureSay(itemEx.uid, "U-UH", TALKTYPE_ORANGE_1)
    else
            doCreatureSay(itemEx.uid, "WRONG!", TALKTYPE_ORANGE_1)
    end
    return true -- this was missing
end
Sorry I have very limited knowledge exactly how the scripts work.
 
Is the player greater than or equal to level 10k and has the vocation 8?
Because that is the only way that this line will execute
Lua:
    doCreatureAddHealth(cid, mana_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(itemEx.uid, "U-UH", TALKTYPE_ORANGE_1)
But if the script has an error then the server will not load it at all.

But then again it could just be the return true missing at end?
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 1000))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mlevel = getPlayerMagLevel(cid)
    local mana_leg = (getCreatureMaxHealth(cid) / 17)
    local mana_c = (getPlayerLevel(cid) * 4)
    local manafull = (mana_leg + mana_c)
    local mana_add = manafull
    if(getPlayerLevel(cid) >= 10000) and (getPlayerVocation(cid) == 8) then
        doCreatureAddHealth(cid, mana_add)
        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
        doCreatureSay(itemEx.uid, "U-UH", TALKTYPE_ORANGE_1)
    else
            doCreatureSay(itemEx.uid, "WRONG!", TALKTYPE_ORANGE_1)
    end
    return true -- this was missing
end
Sorry I have very limited knowledge exactly how the scripts work.


If player have level 10k or more and if he is a Knight, he can use that UH but if he have level < 10k or he isn't knight then he get message "wrong"

Your script be wrong cuz if i use rune i get everytime message "WRONG"
 
If player have level 10k or more and if he is a Knight, he can use that UH but if he have level < 10k or he isn't knight then he get message "wrong"

Your script be wrong cuz if i use rune i get everytime message "WRONG"
Vocation 8 is Elite Knight.

Vocation 4 is Knight. (not in script.)

change
Lua:
if(getPlayerLevel(cid) >= 10000) and (getPlayerVocation(cid) == 8) then
to
Lua:
if getPlayerLevel(cid) >= 10000 and isInArray({4, 8}, getPlayerVocation(cid)) then
 
Vocation 8 is Elite Knight.

Vocation 4 is Knight. (not in script.)

change
Lua:
if(getPlayerLevel(cid) >= 10000) and (getPlayerVocation(cid) == 8) then
to
Lua:
if getPlayerLevel(cid) >= 10000 and isInArray({4, 8}, getPlayerVocation(cid)) then

I know, but i have vocation Elite Knight and it not work
 
I know, but i have vocation Elite Knight and it not work
Try this, and show us a screenshot of the console.
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 1000))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mlevel = getPlayerMagLevel(cid)
    local mana_leg = (getCreatureMaxHealth(cid) / 17)
    local mana_c = (getPlayerLevel(cid) * 4)
    local manafull = (mana_leg + mana_c)
    local mana_add = manafull
    print("Player level is: " .. getPlayerLevel(cid))
    print("Player vocation is: " .. getPlayerVocation(cid))
    if getPlayerLevel(cid) >= 10000 and isInArray({4, 8}, getPlayerVocation(cid)) then
        print(111)
        doCreatureAddHealth(cid, mana_add)
        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
        doCreatureSay(itemEx.uid, "U-UH", TALKTYPE_ORANGE_1)
    else
        print(222)
        doCreatureSay(itemEx.uid, "WRONG!", TALKTYPE_ORANGE_1)
    end
    return true -- this was missing
end
 
Solution
Try this, and show us a screenshot of the console.
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 1000))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mlevel = getPlayerMagLevel(cid)
    local mana_leg = (getCreatureMaxHealth(cid) / 17)
    local mana_c = (getPlayerLevel(cid) * 4)
    local manafull = (mana_leg + mana_c)
    local mana_add = manafull
    print("Player level is: " .. getPlayerLevel(cid))
    print("Player vocation is: " .. getPlayerVocation(cid))
    if getPlayerLevel(cid) >= 10000 and isInArray({4, 8}, getPlayerVocation(cid)) then
        print(111)
        doCreatureAddHealth(cid, mana_add)
        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
        doCreatureSay(itemEx.uid, "U-UH", TALKTYPE_ORANGE_1)
    else
        print(222)
        doCreatureSay(itemEx.uid, "WRONG!", TALKTYPE_ORANGE_1)
    end
    return true -- this was missing
end

Okey nvm, im so stupid...
Cuz i change name of Knight vocation to Elite Knight and i have voc number 4 with name "Elite Knight"...
My bad and thanks for help :D
 
Back
Top