Ir para conteúdo

Featured Replies

Postado
Em 28/01/2018 em 16:19, egyptPOWER disse:

Opa, testa agora meu bom

 


function onUse(cid, item, frompos, item2, topos)

 -- POSIÇÃO DOS ALTARES --
 
 altar1 = {x = 111, y = 111, z = 1, stackpos = 1} -- ALTAR 1 --
 getaltar1 = getThingfromPos(altar1)
 altar2 = {x = 222, y = 222, z = 2, stackpos = 1} -- ALTAR 2 --
 getaltar2 = getThingfromPos(altar2)
 altar3 = {x = 333, y = 333, z = 3, stackpos = 1} -- ALTAR 3 --
 getaltar3 = getThingfromPos(altar2)
 altar4 = {x = 444, y = 444, z = 4, stackpos = 1} -- ALTAR 4 --
 getaltar4 = getThingfromPos(altar3)
 altar5 = {x = 555, y = 555, z = 5, stackpos = 1} -- ALTAR 5 --
 getaltar5 = getThingfromPos(altar4)
 altar6 = {x = 666, y = 666, z = 6, stackpos = 1} -- ALTAR 6 --
 getaltar6 = getThingfromPos(altar6)


 switchUID= 10102 -- UID da Alavanca
 switchID = 1945 -- ID da Alavanca
 switch2ID = 1946 -- ID da Alavanca após utilizada
 item1	= 1111 -- Item de sacrificio 1
 item2 = 1111 -- Item de sacrificio 2
 item3	= 1111 -- Item de sacrificio 3
 item4	= 1111 -- Item de sacrificio 4
 item5 = 1111 -- Item de sacrificio 5
 item6 = 1111 -- Item de sacrificio 6
 
 tpto = {x = 111, y = 111, z = 1, stackpos = 1} -- Aonde o player será teleportado --
 
 if item.uid == switchUID and item.itemid == switchID and getaltar1.itemid == item1 and getaltar2.itemid == item2 and getaltar3.itemid == item3 and getaltar4.itemid == item4 and getaltar5.itemid == item5 and getaltar6.itemid == item6 then
	doSendMagicEffect(cid, 2)
	doTeleportThing(cid, tpto)
	doSendMagicEffect(tpto, 10)
	doRemoveItem(getaltar1.uid, 1)
	doRemoveItem(getaltar2.uid, 1)
	doRemoveItem(getaltar3.uid, 1)
	doRemoveItem(getaltar4.uid, 1)
	doRemoveItem(getaltar5.uid, 1)
	doRemoveItem(getaltar6.uid, 1)
 elseif item.uid == switchUID and item.itemid == switch2ID then
	doTransformItem(item.uid, item.itemid-1)
 else
	doPlayerSendCancel(cid, "Desculpe, você precisa colocar os items corretos nos altares.")
 end
 
	return true
end

!

 

Boa noite meu consagrado, poderia adcionar checagem de players também? por exemplo eu queria que teleportassem 4 players que estivessem em x posição.

por exemplo, estaria os items nos altares e se os players estivessem no local certo, eles iriam teleportar, Obrigado!

  • Respostas 6
  • Visualizações 620
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Opa, testa agora meu bom   function onUse(cid, item, frompos, item2, topos) -- POSIÇÃO DOS ALTARES -- altar1 = {x = 111, y = 111, z = 1, stackpos = 1} -- ALTAR 1 -- getaltar1 = getThing

  • luanluciano93
    luanluciano93

    local ALTARES = { {POSITION = Position(106, 984, 6), ITEM_ID = }, -- posicao altar e item 1 {POSITION = Position(106, 985, 6), ITEM_ID = }, -- posicao altar e item 2 {POSITION = Position(106, 986,

Posted Images

Postado
local ALTARES = {
	{POSITION = Position(106, 984, 6), ITEM_ID = }, -- posicao altar e item 1
	{POSITION = Position(106, 985, 6), ITEM_ID = }, -- posicao altar e item 2
	{POSITION = Position(106, 986, 6), ITEM_ID = }, -- posicao altar e item 3
	{POSITION = Position(106, 987, 6), ITEM_ID = }, -- posicao altar e item 4
	{POSITION = Position(106, 987, 6), ITEM_ID = }, -- posicao altar e item 5
	{POSITION = Position(106, 987, 6), ITEM_ID = }, -- posicao altar e item 6
}

local playerPosition = {
	Position(106, 987, 6),
	Position(106, 987, 6),
	Position(106, 987, 6),
	Position(106, 987, 6)
}
local newPosition = {
	Position(106, 987, 6),
	Position(106, 987, 6),
	Position(106, 987, 6),
	Position(106, 987, 6)
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	local ok = true
	for i = 1, #ALTARES do
		local tile = Tile(ALTARES[i].POSITION)
		if tile then
			local item = tile:getItemById(ALTARES[i].ITEM_ID)
			if not item then
				ok = false
			end
		end
	end
	
	if ok then
		local players = {}
		for _, position in ipairs(playerPosition) do
			local topPlayer = Tile(position):getTopCreature()
			if not topPlayer or not topPlayer:isPlayer() then
				player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
				return false
			end
			players[#players + 1] = topPlayer
		end
		
		for i, targetPlayer in ipairs(players) do
			playerPosition[i]:sendMagicEffect(CONST_ME_POFF)
			targetPlayer:teleportTo(newPosition[i], false)
			targetPlayer:getPosition():sendMagicEffect(CONST_ME_ENERGYAREA)
		end

		for i = 1, #ALTARES do
			local tile = Tile(ALTARES[i].POSITION)
			if tile then
				local item = tile:getItemById(ALTARES[i].ITEM_ID)
				if item then
					item:remove()
				end
			end
		end
	else
		player:sendTextMessage(MESSAGE_INFO_DESCR, "Desculpe, você precisa colocar os items corretos nos altares.")
		player:getPosition():sendMagicEffect(CONST_ME_POFF)
	end
	
	item:transform(item.itemid == 1945 and 1946 or 1945)
	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