Komic
MChem
- Joined
- Jun 8, 2007
- Messages
- 359
- Reaction score
- 51
Code:
function onAddItem(moveitem, tileitem, pos)
helmnum = moveitem.itemid+40000
helmstatus = getGlobalStorageValue(helmnum)
if moveitem.itemid == 2335 then
if helmstatus ~= 1 then
setGlobalStorageValue(helmnum,1)
if getGlobalStorageValue(42336) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42341) == 1 then
doTransformItem(moveitem.uid, 2342)
for q = 2, 8 do
doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
end
for p = 42335, 42341 do
setGlobalStorageValue(p,0)
end
end
else
doRemoveItem(moveitem.uid,1)
doPlayerAddItem(cid,moveitem.uid,1)
doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
end
elseif moveitem.itemid == 2336 then
if helmstatus ~= 1 then
setGlobalStorageValue(helmnum,1)
if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42341) == 1 then
doTransformItem(moveitem.uid, 2342)
for q = 2, 8 do
doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
end
for p = 42335, 42341 do
setGlobalStorageValue(p,0)
end
end
else
doRemoveItem(moveitem.uid,1)
doPlayerAddItem(cid,moveitem.uid,1)
doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
end
elseif moveitem.itemid == 2337 then
if helmstatus ~= 1 then
setGlobalStorageValue(helmnum,1)
if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42336) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42341) == 1 then
doTransformItem(moveitem.uid, 2342)
for q = 2, 8 do
doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
end
for p = 42335, 42341 do
setGlobalStorageValue(p,0)
end
end
else
doRemoveItem(moveitem.uid,1)
doPlayerAddItem(cid,moveitem.uid,1)
doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
end
elseif moveitem.itemid == 2338 then
if helmstatus ~= 1 then
setGlobalStorageValue(helmnum,1)
if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42336) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42341) == 1 then
doTransformItem(moveitem.uid, 2342)
for q = 2, 8 do
doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
end
for p = 42335, 42341 do
setGlobalStorageValue(p,0)
end
end
else
doRemoveItem(moveitem.uid,1)
doPlayerAddItem(cid,moveitem.uid,1)
doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
end
elseif moveitem.itemid == 2339 then
if helmstatus ~= 1 then
setGlobalStorageValue(helmnum,1)
if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42336) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42341) == 1 then
doTransformItem(moveitem.uid, 2342)
for q = 2, 8 do
doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
end
for p = 42335, 42341 do
setGlobalStorageValue(p,0)
end
end
else
doRemoveItem(moveitem.uid,1)
doPlayerAddItem(cid,moveitem.uid,1)
doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
end
elseif moveitem.itemid == 2340 then
if helmstatus ~= 1 then
setGlobalStorageValue(helmnum,1)
if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42336) == 1 and getGlobalStorageValue(42341) == 1 then
doTransformItem(moveitem.uid, 2342)
for q = 2, 8 do
doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
end
for p = 42335, 42341 do
setGlobalStorageValue(p,0)
end
end
else
doRemoveItem(moveitem.uid,1)
doPlayerAddItem(cid,moveitem.uid,1)
doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
end
elseif moveitem.itemid == 2341 then
if helmstatus ~= 1 then
setGlobalStorageValue(helmnum,1)
if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42336) == 1 then
doTransformItem(moveitem.uid, 2342)
for q = 2, 8 do
doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
end
for p = 42335, 42341 do
setGlobalStorageValue(p,0)
end
end
else
doRemoveItem(moveitem.uid,1)
doPlayerAddItem(cid,moveitem.uid,1)
doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
end
end
return 1
end
This is like in RL tibia where you don't have to pull a lever to make the helmet it happens naturally. Atm it doesn't work and I don't know why as it is the first time that I have made a script with this function and also using for/do in it, so can someone try to fix for me?