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

Trying to add vocation and lvl to a pot

Toast

New Member
Joined
Feb 28, 2008
Messages
150
Reaction score
0
Im trying to make this so only a lvl 300 knight can use this pot.
Server is 8.40 TFS 0.3.2 Any help would be great thanks

HTML:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) -- 10 minutes
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, 5)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if doTargetCombatCondition(0, cid, condition, CONST_ME_MAGIC_RED) == LUA_ERROR then
		return FALSE
	end

	doRemoveItem(item.uid)
	return TRUE
end
 
Code:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) -- 10 minutes
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, 5)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isKnight(cid) ~= TRUE or getPlayerLevel(cid) < 300 then
		return TRUE, doCreatureSay(cid, "Only knights of level 300 or above may drink this fluid.", TALKTYPE_ORANGE_1)
	elseif doTargetCombatCondition(0, cid, condition, CONST_ME_MAGIC_RED) == 1 then
		return TRUE, doRemoveItem(item.uid)
	end
end
 
Doesnt work.
Code:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 2 * 60 * 1000) -- 2 minutes
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, 20)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if doTargetCombatCondition(0, cid, condition, CONST_ME_MAGIC_RED) == LUA_ERROR then
		return FALSE
	end
	if isKnight(cid) and getPlayerLevel(cid) >= 300 then
		doRemoveItem(item.uid)
		return TRUE
	else
		doCreatureSay(cid, "Only knights of level 300 or above may drink this fluid.", TALKTYPE_ORANGE_1)
	end
end
 
Back
Top