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

Complicated function onUse()

Dylek

New Member
Joined
Jan 7, 2009
Messages
24
Reaction score
0
Hello. I am in need of a function that when we click on item then it change our outfit, and we have speed + 50 and we can't fight then. when we click on this item again then we will be back to our outfit and we can fight again. Please really I tried to write it by myself but I don't understand too much functions to make it work.

Greetings
 
Code:
local conditions = {}

conditions[1] = createConditionObject(CONDITION_EXHAUST)
setConditionParam(conditions[1], CONDITION_PARAM_SUBID, EXHAUST_WEAPON)
setConditionParam(conditions[1], CONDITION_PARAM_TICKS, -1)

conditions[2] = createConditionObject(CONDITION_PACIFIED)
setConditionParam(conditions[2], CONDITION_PARAM_TICKS, -1)

conditions[3] = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditions[3], CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditions[3], {lookType = 250})

conditions[4] = createConditionObject(CONDITION_HASTE)
setConditionParam(conditions[4], CONDITION_PARAM_TICKS, -1)
setConditionFormula(conditions[4], 0, 50, 0, 50)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not getCreatureCondition(cid, CONDITION_PACIFIED) then
		for i = 1, 4 do
			doAddCondition(cid, conditions[i])
		end
	else
		doRemoveCondition(cid, CONDITION_EXHAUST, EXHAUST_WEAPON)
		doRemoveCondition(cid, CONDITION_PACIFIED)
		doRemoveCondition(cid, CONDITION_OUTFIT)
		doRemoveCondition(cid, CONDITION_HASTE)
	end
	return true
end
 
Back
Top