• 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 Problem in POTION, help here plx...

Status
Not open for further replies.

f@bio

Fudera Otserver
Joined
Jul 10, 2007
Messages
213
Reaction score
0
Location
Brasil
Hello friends, i'm have a question on potion and i'm need this for my server, help me plx...

- This is a STRONG HEALTH POTION script of TFS 0.2.11:
Code:
local MIN = 200
local MAX = 400
local EMPTY_POTION = 7634

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

    if not(isKnight(itemEx.uid) or isPaladin(itemEx.uid)) or getPlayerLevel(itemEx.uid) < 50 then
        doCreatureSay(itemEx.uid, "Only knights and paladins of level 50 or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return TRUE
    end

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

    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1) 
    doTransformItem(item.uid, EMPTY_POTION)
    return TRUE
end
- My problem is, the script don't work in new vocations, and my server have new vocations, the vocations XML of TFS go to 8 vocations, my vocations XML go to 16, i'm need this to new vocations can be use the potion, plx, help me friend and many thx for all...

No more,

F@bio
 
You'll need to modify this line:

if not(isKnight(itemEx.uid) or isPaladin(itemEx.uid)) or getPlayerLevel(itemEx.uid) < 50
then

at the bolded part. isKnight() and isPaladin() is functions made in global.lua. You'll need to make new functions for your new vocations. Just copy one of the functions and change the numbers in this line:

return (isInArray({4,8}, getPlayerVocation(cid)) == TRUE)

to maybe:
return (isInArray({9,13}, getPlayerVocation(cid)) == TRUE)

and do it for all your vocations. And don't forget to give the functions new names.
 
Hum.... i go to test this, many thx for you... i1, edit here if work or not... thx man....

Hey man many thx for you, it's now work correctly... close this tread if you want...
 
Last edited:
Status
Not open for further replies.
Back
Top