Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)
function onUse(cid, item, fromPosition, itemEx, toPosition)
local manaAdd = {
["Sorcerer"]={math.random(75, 125), math.random(180, 220), math.random(280, 320)}, ["Druid"]={math.random(75, 125), math.random(180, 220), math.random(280, 320)}, ["Paladin"]={math.random(75, 125), math.random(180, 220), math.random(180, 220)}, ["Knight"]={math.random(75, 125), math.random(75, 125), math.random(75, 125)},
["Master Sorcerer"]={math.random(75, 125), math.random(180, 220), math.random(280, 320)}, ["Elder Druid"]={math.random(75, 125), math.random(180, 220), math.random(280, 320)}, ["Royal Paladin"]={math.random(75, 125), math.random(180, 220), math.random(180, 220)}, ["Elite Knight"]={math.random(75, 125), math.random(75, 125), math.random(75, 125)}
}
if(isPlayer(itemEx.uid) == TRUE) then
if(hasCondition(itemEx.uid, CONDITION_EXHAUST) == FALSE) then
if(getPlayerLevel(itemEx.uid) < 50) then
doCreatureAddMana(itemEx.uid, manaAdd[getPlayerVocationName(itemEx.uid)][1])
elseif(getPlayerLevel(itemEx.uid) >= 50) and (getPlayerLevel(itemEx.uid) < 80) then
doCreatureAddMana(itemEx.uid, manaAdd[getPlayerVocationName(itemEx.uid)][2])
else
doCreatureAddMana(itemEx.uid, manaAdd[getPlayerVocationName(itemEx.uid)][3])
end
doAddCondition(cid, exhaust)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getCreaturePosition(itemEx.uid), "Aaaah...", TEXTCOLOR_DARKYELLOW)
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
else
return FALSE
end
end
Could any1 fix it? When some player uses on another player he can spam him with potion and he didnt get exhaust.