Postado Janeiro 8, 2018 7 anos Fala galera consegui um spell de trap porém ela tem um bug que não remove os items criados alguém pode dar uma força? meu server é 8.54 tfs 0.3.6 local remove_time = 5 -- tempo em segundos para remover as magic wall function doShowTimeByPos(uid, pos, duration, type) type = type or 20 for i = 0, (duration - 1) do addEvent(function() if isCreature(uid) then doSendAnimatedText(pos, tostring(duration - i), type) end end, i * 1000) end return true end function onCastSpell(cid, var) if (getPlayerStorageValue(cid, 2343) - os.time()) > 0 then return doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) and doPlayerSendCancel(cid, "You are exhausted in Doton Doryu Heki for: "..(getPlayerStorageValue(cid, 2343) - os.time() ).." seconds.") and false end setPlayerStorageValue(cid, 2343, (os.time() + 30)) if getCreatureTarget(cid) ~= 0 then pos = getThingPosition(getCreatureTarget(cid)) else pos = getCreaturePosition(cid) end local posTile1 = {{x=pos.x+2,y=pos.y+2, z=pos.z,stackpos=1}, 5265} local posTile2 = {{x=pos.x+2,y=pos.y+1, z=pos.z,stackpos=1}, 5261} local posTile3 = {{x=pos.x+2,y=pos.y ,z=pos.z,stackpos=1}, 5261} local posTile4 = {{x=pos.x+2,y=pos.y-1, z=pos.z,stackpos=1}, 5261} local posTile5 = {{x=pos.x+2,y=pos.y-2, z=pos.z,stackpos=1}, 5262} local posTile6 = {{x=pos.x-2,y=pos.y+2, z=pos.z,stackpos=1}, 5261} local posTile7 = {{x=pos.x-2,y=pos.y+1, z=pos.z,stackpos=1}, 5750} local posTile8 = {{x=pos.x-2,y=pos.y ,z=pos.z,stackpos=1}, 5750} local posTile9 = {{x=pos.x-2,y=pos.y-1, z=pos.z,stackpos=1}, 5750} local posTile10 = {{x=pos.x-2,y=pos.y-2, z=pos.z,stackpos=1}, 5750} local posTile11 = {{x=pos.x-1,y=pos.y-2, z=pos.z,stackpos=1}, 5750} local posTile12 = {{x=pos.x,y=pos.y-2, z=pos.z,stackpos=1}, 5750} local posTile13 = {{x=pos.x+1,y=pos.y-2, z=pos.z,stackpos=1}, 5750} local posTile14 = {{x=pos.x-1,y=pos.y+2, z=pos.z,stackpos=1}, 5750} local posTile15 = {{x=pos.x,y=pos.y+2, z=pos.z,stackpos=1}, 5750} local posTile16 = {{x=pos.x+1,y=pos.y+2, z=pos.z,stackpos=1}, 5750} local posAll = {posTile1[1],posTile2[1],posTile3[1],posTile4[1],posTile5[1],posTile6[1],posTile7[1],posTile8[1],posTile9[1], posTile10[1], posTile11[1], posTile12[1], posTile13[1], posTile14[1], posTile15[1], posTile16[1]} local itemAll = {posTile1[2],posTile2[2],posTile3[2],posTile4[2],posTile5[2],posTile6[2],posTile7[2],posTile8[2],posTile9[2], posTile10[2], posTile11[2], posTile12[2], posTile13[2], posTile14[2], posTile15[2], posTile16[2]} for i=1, #posAll do if isWalkable(posAll[i]) then doCreateItem(itemAll[i], 1, posAll[i]) doShowTimeByPos(cid, posAll[i], 5, 210) end end addEvent(removeItem, remove_time*1000, posAll, itemAll) return true end function isWalkable(pos, creature, pz, proj) if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end local creature = getTopCreature(pos) if creature.type > 0 then return false end if getTilePzInfo(pos) and not pz then return false end local n = not proj and 3 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 removeItem(posAll, itemAll) for i=1, #posAll do for j=0, 255 do pos_stack = {x=posAll[i].x,y=posAll[i].y,z=posAll[i].z,stackpos=j} removeTile = getThingfromPos(pos_stack) if removeTile.itemid == itemAll[i] then doRemoveItem(removeTile.uid) end end end end bug: ele não remove o item criado após o tempo acabar Projeto ATS (Naruto)Informações AbaixoFacebookYoutubeDiscord Tutoriais / ConteúdosClique Aqui
Postado Janeiro 8, 2018 7 anos Solução Há um tempo eu tinha feito algo parecido: Spoiler local config = { exhaust_storage = 5750, exhaust_time = 30, -- walls conf walls_time = 10, area_size = 3, walls_pos = { ["vertical"] = 1111, ["horizontal"] = 1112, ["rightcorner"] = 1115, ["leftcorner"] = 1113 } } local function buildWalls(cid) local cid_pos = getThingPosition(cid) local size = config.area_size for x = -size, size do for y = -size, size do if(math.abs(x) == size or math.abs(y) == size) then local target_pos = {x = (cid_pos.x + x), y = (cid_pos.y + y), z = cid_pos.z} if(doTileQueryAdd(cid, target_pos) == 1 and not getTileInfo(target_pos).protection) then local create_item = nil if(x == -size and y == -size) then create_item = config.walls_pos["leftcorner"] elseif(x == size and y == size) then create_item = config.walls_pos["rightcorner"] elseif(math.abs(x) == size and not (x == size and y == -size)) then create_item = config.walls_pos["vertical"] else create_item = config.walls_pos["horizontal"] end doCreateItem(create_item, 1, target_pos) local _time = config.walls_time for i = 0, _time do addEvent(function() local uid = getTileItemById(target_pos, create_item).uid if(uid ~= 0) then if(i < _time) then doSendAnimatedText(target_pos, (_time - i), 180) else doRemoveItem(uid) end end end, 1000 * i) end end end end end end function onCastSpell(cid, var) if(isPlayer(cid) and exhaustion.check(cid, config.exhaust_storage)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, config.exhaust_storage) .. " segundos para usar novamente.") return false end exhaustion.set(cid, config.exhaust_storage, config.exhaust_time) buildWalls(cid) return true end
Postado Janeiro 8, 2018 7 anos Autor @MaTTch perfeito obrigado Projeto ATS (Naruto)Informações AbaixoFacebookYoutubeDiscord Tutoriais / ConteúdosClique Aqui
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.