Ir para conteúdo

[Encerrado] Ajuda com alavancas


Posts Recomendados

Bom dia, preciso de ajuda em 1 coisa neste script que eu elaborei mas nao consgui terminar.

 

O player não é teleportado, mas o monstro e criado e se estiver alguém na sala ele avisa que não pode descer.

 

So preciso que ele teleporte para o newPos, alguem pode me ajudar??

 

Se puder +Rep

 

Segue:

Spoiler

local t, player = {
	
newPos = {
{x=33358, y=31404, z=10},
{x=33360, y=31408, z=10},        
{x=33360, y=31405, z=10},
{x=33361, y=31407, z=10},
{x=33358, y=31406, z=10},
{x=33362, y=31406, z=10},
{x=33357, y=31408, z=10},
{x=33360, y=31407, z=10},
{x=33361, y=31406, z=10},
{x=33358, y=31405, z=10},
{x=33360, y=31409, z=10},
{x=33361, y=31404, z=10},
{x=33358, y=31407, z=10},
{x=33359, y=31406, z=10},
{x=33361, y=31408, z=10}	
	},

area = {
		
fromX = 33351, toX = 33367,
		
fromY = 31399, toY = 31415,
		
z = 10
	}
}, 
{0, 0}

function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)
	
local creaturesList = {}
	
for x = -radiusx, radiusx do
		
for y = -radiusy, radiusy do
			
if not (x == 0 and y == 0) then
				
creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z, stackpos = 253})
	
if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then

table.insert(creaturesList, creature.uid)
				
end
			
end
		
end
	
end

	
local creature = getTopCreature(position)
	
if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
		
if not(table.find(creaturesList, creature.uid)) then
			
table.insert(creaturesList, creature.uid)
		
end
	
end
    
return creaturesList
end

function Wave1()
       
doSendMagicEffect(getCreaturePosition(doCreateMonster('rat', {x = 33358, y = 31401, z = 10})), CONST_ME_TELEPORT)
	
	
end

function onUse(cid, item, fromPosition, itemEx, toPosition)	
local fromPos = {x=33357, y=31404, z=9} -- posição superior esquerda do mapa.
local toPos = {x=33362, y=31409, z=9} -- posição inferior direita do mapa.
local players = getPlayerInArea(fromPos, toPos)

if not failed then
		
if #getCreaturesInRange({x=33359, y=31406,z=10}, 10, 9, FALSE, TRUE) > 0 then
			
doPlayerSendTextMessage(cid,25, "Some people are already in the arena.")
				
return true
		
end
		
for i = 1, #players do
			
doTeleportThing(players[i], t.newPos[i])
		
end
		
Wave1()
		
doTransformItem(item.uid, 1946)
	
else
		
doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
	
end
	
return true

end

function getPlayerInArea(fromPos, toPos) -- by jhon992

local online = getPlayersOnline()
local failed = false
local players = {}

for i=1, #online do
if isInArea(getPlayerPosition(online[i]), fromPos, toPos) then
failed = true
end
end
return players
end

 

 

Editado por Everson Miranda
Link para o comentário
Compartilhar em outros sites

  • 5 months later...
Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...