• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Addon doll 8.54 0.3.6pl1

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,812
Solutions
6
Reaction score
822
Well i got addon doll for 8.54 0.3.6pl1

I want that when someone press it, he gets warning saying, You can use it only 3 times, Do You Want to use it?
And then when press ok it goes and when he press the doll he gets outfit and it says, You got 2 more clickes!
And he get random outfit
And when he press Again It says, You Got Your Last Click!
And when he press it He get the outfit randomly and the doll disappears

Original Script
LUA:
local config = {
	itemid = 8982,
	effect = 52,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if (item.itemid == config.itemid) then
		local i = math.random(1, 6)
		local sets = {[1] = math.random(2, 74), [2] = math.random(76, 134), [3] = math.random(136, 160), [4] = math.random(192, 265), [5] = math.random(267, 301), [6] = math.random(303, 351)}
		local tmp = getCreatureOutfit(cid)
		tmp.lookType = sets[i]
		doCreatureChangeOutfit(cid, tmp)
		doSendMagicEffect(getCreaturePosition(cid), config.effect)
	end
	return true
end

rep++
 
LUA:
local config = {
	itemid = 8982,
	effect = 52,
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if (item.itemid == config.itemid) then
	  elseif getPlayerStorageValue(cid,60035) == -1 then
		local i = math.random(1, 6)
		local sets = {[1] = math.random(2, 74), [2] = math.random(76, 134), [3] = math.random(136, 160), [4] = math.random(192, 265), [5] = math.random(267, 301), [6] = math.random(303, 351)}
		local tmp = getCreatureOutfit(cid)
		tmp.lookType = sets[i]
		doCreatureChangeOutfit(cid, tmp)
		doSendMagicEffect(getCreaturePosition(cid), config.effect)
		doPlayerSendTextMessage(cid, 27,"2 times left")
		setPlayerStorageValue(cid,60035,3)
	elseif getPlayerStorageValue(cid,60035) == 3 then
		local i = math.random(1, 6)
		local sets = {[1] = math.random(2, 74), [2] = math.random(76, 134), [3] = math.random(136, 160), [4] = math.random(192, 265), [5] = math.random(267, 301), [6] = math.random(303, 351)}
		local tmp = getCreatureOutfit(cid)
		tmp.lookType = sets[i]
		doCreatureChangeOutfit(cid, tmp)
		doSendMagicEffect(getCreaturePosition(cid), config.effect)
		doPlayerSendTextMessage(cid, 27,"1 times left")
		setPlayerStorageValue(cid,60035,2)
	elseif getPlayerStorageValue(cid,60035) == 2 then
		local i = math.random(1, 6)
		local sets = {[1] = math.random(2, 74), [2] = math.random(76, 134), [3] = math.random(136, 160), [4] = math.random(192, 265), [5] = math.random(267, 301), [6] = math.random(303, 351)}
		local tmp = getCreatureOutfit(cid)
		tmp.lookType = sets[i]
		doCreatureChangeOutfit(cid, tmp)
		doSendMagicEffect(getCreaturePosition(cid), config.effect)
		doPlayerSendTextMessage(cid, 27,"addon doll gone")
		setPlayerStorageValue(cid,60035,0)
		doRemoveItem(item.uid, 1)
	end
	return true
end
 
Ye simply make it a uniqueID or action or w/e ..
LUA:
doSetItemActionId(item.uid, item.actionid-1)
And start the item at actionid 3 for example if u want 3 charges.. but since its the first use, set it to 1 less! or just set this above the thing i wrote above!
LUA:
if(item.actionid < 1) then
doSetItemActionId(item.uid, 3)
end

and when removing it:
LUA:
if(item.actionid == 1) then
doPlayerRemoveItem(cid, item.itemid, 1)
end

Hope this helps ;)
 
Code:
local config = {
	itemid = 8982,
	effect = 52,
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if (item.itemid == config.itemid) then
		if item.actionid >= 1 then
			local i = math.random(1, 6)
			local sets = {[1] = math.random(2, 74), [2] = math.random(76, 134), [3] = math.random(136, 160), [4] = math.random(192, 265), [5] = math.random(267, 301), [6] = math.random(303, 351)}
			local tmp = getCreatureOutfit(cid)
			tmp.lookType = sets[i]
			doCreatureChangeOutfit(cid, tmp)
			doSendMagicEffect(getCreaturePosition(cid), config.effect)
			if item.actionid == 1 then
				doPlayerRemoveItem(cid, item.itemid, 1)
			end
			doSetItemActionId(item.uid, item.actionid-1)
		elseif(item.actionid < 1) then
			doSetItemActionId(item.uid, 3)
		end
	end
	return true
end

Untested.
 
Back
Top