Ir para conteúdo

Featured Replies

  • Respostas 9
  • Visualizações 685
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • @Koring4 doCreatureSay(cid, "You have ".. tempo .." seconds.", 19) Para doCreatureSay(cid, "You have ".. tempo .." seconds.", TALKTYPE_ORANGE_1)  

  • Ahhh, percebi agora que o seu era tfs 1.x, eu testei no tfs 0.4. Erro meu, desculpe aí! Já que funcionou assim, tá tranquilo, mas segue o código para tfs 1.x:    

Postado
  • Autor

@Dwarfer  o código ficaria assim ?

 

Spoiler

local positions = {
	[1] = {pos = {x = 32944, y = 30807, z = 7}, id = 1721},
	[2] = {pos = {x = 32944, y = 30808, z = 7}, id = 1722},
	[3] = {pos = {x = 32943, y = 30807, z = 7}, id = 1116, toid = 1122},
	[4] = {pos = {x = 32943, y = 30808, z = 7}, id = 1116, toid = 1123},
}

local createpos = {
	[1] = {pos = {x = 32944, y = 30806, z = 7}, id = 1721},
	[2] = {pos = {x = 32944, y = 30809, z = 7}, id = 1722}
}

local tempo = 60

function onUse(cid, item, frompos, item2, topos)
	if getTileItemById(positions[1].pos, positions[1].id).uid < 100 then
		doPlayerSendCancel(cid, "Is already open.")
	return true
	end

	doCreatureSay(cid, "You have ".. tempo .." seconds.", 19)

	for i = 1, #positions do
		local obst = getTileItemById(positions[i].pos, positions[i].id).uid
		if i <= (#positions/2) and obst ~= 0 then
			doRemoveItem(obst, 1)
			doSendMagicEffect(positions[i].pos, 2)
			doCreateItem(createpos[i].id, 1, createpos[i].pos)
		elseif i > (#positions/2) and obst ~=0 then
			doTransformItem(obst, positions[i].toid)
		end
	end
	addEvent(criar_paredes, tempo*1000)
	return true
end

	function criar_paredes()
		for i = 1, #positions do
			if i <= (#positions/2) then
				doCreateItem(positions[i].id, 1, positions[i].pos)
				local obst = getTileItemById(createpos[i].pos, createpos[i].id).uid
				doSendMagicEffect(createpos[i].pos, 2)
				doRemoveItem(obst, 1)			
			elseif i > (#positions/2) then
				local obst = getTileItemById(positions[i].pos, positions[i].toid).uid
				doTransformItem(obst, positions[i].id)
			end
		end
		return true
	end

 

 

Postado

Ahhh, percebi agora que o seu era tfs 1.x, eu testei no tfs 0.4. Erro meu, desculpe aí!

Já que funcionou assim, tá tranquilo, mas segue o código para tfs 1.x:

 

Spoiler

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local tile = Tile(positions[1].pos)
if not tile:getItemById(positions[1].id) then
return doPlayerSendCancel(cid, "It's already opened.")
end
player:say("You have " .. tempo .. " seconds.", TALKTYPE_MONSTER_SAY)

for i =1, #positions do
local posi = positions[i].pos
local tile = Tile(posi)
local obst = tile:getItemById(positions[i].id)
if i <= (#positions/2) and obst then
obst:remove()
Position(posi):sendMagicEffect(2)
Game.createItem(createpos[i].id, 1, createpos[i].pos)
elseif i > (#positions/2) and obst then
obst:transform(positions[i].toid, 1)
end
end
addEvent(criar_paredes, tempo*1000)
return true
end

function criar_paredes()
for i = 1, #positions do
    if i <= (#positions/2) then
        Game.createItem(positions[i].id, 1, positions[i].pos)
        local posi = createpos[i].pos
        local tile = Tile(posi)
        local obst = tile:getItemById(createpos[i].id)
        Position(posi):sendMagicEffect(2)
        obst:remove()
    elseif i > (#positions/2) then
        local tile = Tile(positions[i].pos)
        local obst = tile:getItemById(positions[i].id)
    end
end
return true
end

 

 

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo