Lua:
local POTIONS = {
[6542] = {health = {3500, 4000}, level = 1, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion --SUPER DUPER HP
[6543] = {mana = {1800, 2700}, level = 1, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- SUPER DUPER MANA
[6541] = {health = {1000, 2000}, mana = {550, 1000}, level = 500, vocations = {3, 7}, vocStr = "paladins"} -- SUPER spirit potion
}
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
if(hasCondition(cid, CONDITION_EXHAUST)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(cid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return true
end
local health = potion.health
if(health and not doCreatureAddHealth(cid, math.ceil(math.random(health[1], health[2]) ))) then
return false
end
local mana = potion.mana
if(mana and not doPlayerAddMana(cid, math.ceil(math.random(mana[1], mana[2]) ))) then
return false
end
doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_BLUE)
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doAddCondition(cid, exhaust)
doRemoveItem(item.uid, 1)
return true
end
over and over I get bug:
Code:
'<eof>' expected near 'end'
The hell is wrong!?!
I'm using Notepad++ so I purely see I have correct nr of 'ends'
I Lost something but I don't know what
=)
Sorry For DOUBLE POST, PLEASE DELETE the second ONE, It was coused by a lag ;/
This code for food instead potion (without use with, just use)
Last edited: