brunolopes
New Member
- Joined
- Nov 8, 2009
- Messages
- 49
- Reaction score
- 1
Hello, people. ^_^
I've found a script that I made a time ago and I tried to use for and tables to shorten it.
It's a smithing system where you use a hammer in some stacked items to create another item, example: Magic Sword.
I want to use a recipes table and for to short the script, but I'm not able to do that...
Here is the script
Thanks.
I've found a script that I made a time ago and I tried to use for and tables to shorten it.
It's a smithing system where you use a hammer in some stacked items to create another item, example: Magic Sword.
I want to use a recipes table and for to short the script, but I'm not able to do that...
Here is the script
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local positions = {
item1 = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 1},
item2 = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 2},
item3 = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 3},
item4 = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 4},
item5 = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 5}
}
local item1 = getThingFromPos(positions.item1)
local item2 = getThingFromPos(positions.item2)
local item3 = getThingFromPos(positions.item3)
local item4 = getThingFromPos(positions.item4)
local item5 = getThingFromPos(positions.item5)
if(item1.itemid == 2157 and item2.itemid == 2147 and item3.itemid == 5468 and item4.itemid == 3276 and item5.itemid == 2160) then
if(doRemoveItem(item1.uid, 3) and doRemoveItem(item2.uid, 10) and doRemoveItem(item3.uid, 1) and doRemoveItem(item4.uid, 1) and doRemoveItem(item5.uid, 60)) then
doCreateItem(2400, 1, positions.item1)
end
end
return true
end
Thanks.
Last edited: