elnelson
Lunaria World Dev
Good afternoon, i was wondering if you guys could help me to script a decontruction kit, like a reverse version of the construction kits.
this scripts set AID 3051 (may be used to avoid abuse trying to deconstruct non-house things)
this scripts set AID 3051 (may be used to avoid abuse trying to deconstruct non-house things)
Lua:
local CONSTRUCTIONS = {
--[boxed chair] = chair
[3901] = 1652
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(fromPosition.x == CONTAINER_POSITION) then
doPlayerSendCancel(cid, "Put the construction kit on the floor first.")
elseif(not getTileInfo(fromPosition).house) then
doPlayerSendCancel(cid,"You may construct this only inside a house.")
elseif(CONSTRUCTIONS[item.itemid] ~= nil) then
doTransformItem(item.uid, CONSTRUCTIONS[item.itemid]) --i was wondering if this data could be used to read inverted values, so chair (id 3051) id tranformed to boxed chair (id: 3901)
doSendMagicEffect(fromPosition, CONST_ME_POFF)
doItemSetAttribute(itemEx.uid, "aid", 3051)
else
return false
end
return true
end