Postado Fevereiro 21, 2015 10 anos local maxItems = 2 --Quantidade máxima de itens empilhados. local tableId = 3805 --ID da mesa do depot. function isWalkable(pos, creature, proj, pz) -- By Nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end if getTopCreature(pos).uid > 0 and creature then return false end if getTileInfo(pos).protection and pz then return false end local n = not proj and 2 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function canThrowObject(fromPos, toPos) -- by OrochiElf while(fromPos.x ~= toPos.x or fromPos.y ~= toPos.y) do local fromPos = getPosByDir(fromPos, getDirectionTo(fromPos, toPos)) if fromPos.x == toPos.x and fromPos.y == toPos.y then return true elseif not isWalkable(fromPos) then return false end end return true end function onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos) if getTileItemById(toPos, tableId).uid > 0 then if not canThrowObject((fromPos.x == 65535 and fromPos.y == 64) and getThingPos(cid) or fromPos, toPos) then return doPlayerSendCancel(cid, "Sorry, not possible.") and false elseif getTileInfo(toPos).items - 1 >= maxItems then return doPlayerSendCancel(cid, "Only "..maxItems.." items above the depot.") and false end end return true end Editado Fevereiro 21, 2015 10 anos por zipter98 (veja o histórico de edições) não respondo pms solicitando suporte em programação/scripting
Postado Fevereiro 21, 2015 10 anos Autor local maxItems = 2 --Quantidade máxima de itens empilhados. local tableId = xxx --ID da mesa do depot. function onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos) if getTileItemById(toPos, tableId).uid > 0 then if not isSightClear(fromPos, toPos) then return doPlayerSendCancel(cid, "Sorry, not possible.") and false elseif getTileInfo(toPos).items - 1 >= maxItems then return doPlayerSendCancel(cid, "Only "..maxItems.." items above the depot.") and false end end return true end qual e a tag que devo adicionar em movements ? I like
Postado Fevereiro 21, 2015 10 anos Este código, na verdade, é um creaturescript, não um moveevent. Em login.lua, registre: registerCreatureEvent(cid, "moveDepot") Tag: <event type="moveitem" name="moveDepot" event="script" value="nome_do_arquivo.lua"/> não respondo pms solicitando suporte em programação/scripting
Postado Fevereiro 21, 2015 10 anos Autor Este código, na verdade, é um creaturescript, não um moveevent. Em login.lua, registre: registerCreatureEvent(cid, "moveDepot") Tag: <event type="moveitem" name="moveDepot" event="script" value="nome_do_arquivo.lua"/> ue deu n ta dando para jogar itens em cima ainda I like
Postado Fevereiro 21, 2015 10 anos Você configurou o ID da mesa do depot corretamente? Há algum erro na distro? não respondo pms solicitando suporte em programação/scripting
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.