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

Script HoTA Help

hugq

Member
Joined
Mar 17, 2010
Messages
166
Reaction score
9
Hey.
I have problem with script for enchant HoTA by lever. When i put only helmet and when I push the lever then helmet disappears.

I don't know what can be wrong.
Code:
local config = {
  [1] = {{x=299, y=439, z=8}, 2342},
  [2] = {{x=299, y=440, z=8}, 2147}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

if item.itemid == 1945 then

  for _, t in pairs(config) do
  if getTileItemById(t[1], t[2]).uid == 0 then
    return doPlayerSendCancel(cid, 'You doesn\'t put all items on tites.')
  else
    doRemoveItem(getTileItemById(t[1], t[2]).uid, 1)
    doSendMagicEffect(t[1], CONST_ME_EXPLOSIONAREA)
   end
end
  doCreateItem(2343, 1, {x=299, y=439, z=8})
end
return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
You shouldn't use a lever, you should use onAddItem.

Here is a script that works (made by Cykotitan):

Lua:
function onAddItem(moveItem, tileItem, position)
	for i = 2335, 2341 do
		if moveItem.itemid ~= i and getTileItemById(position, i).uid == 0 then return end
	end
	for i = 2335, 2341 do
		local v = getTileItemById(position, i).uid
		doRemoveItem(v > 0 and v or moveItem.uid)
	end
	doCreateItem(2342, 1, position)
	doSendMagicEffect(position, CONST_ME_FIREAREA)
end
 
Back
Top