dhrsantan
A.K.A Lbakiller
I'm using TFS 1.0
Trying to do a teleport if the player is standing on a certain title. and pulls the lever.
Trying to do a teleport if the player is standing on a certain title. and pulls the lever.
Code:
local roomCenter = {x = 541, y = 672, z = 6} -- the center of the boss room
local RangeX = 3 -- te range from the center to the edge of the bossroom on the x axis.
local RangeY = 3 -- te range from the center to the edge of the bossroom on the y axis.
local player1NewPos = {x = 547, y = 671, z = 6} -- where player one should be teleported to
local player1OldPos = {x = 555, y = 673, z = 6} -- the place where player one should stand
function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
local spectators = Game.getSpectators(roomCenter, false, true, 0, RangeX, 0, RangeY)
for i = 1, #spectators do
local spectator = spectators[i]
if spectator:isPlayer() then
print('test')
Player(cid):sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
return false
end
end
local player1 = player1OldPos:getTopCreature()
if player1:isPlayer() then
print('player 1 found')
--player1:teleportTo(player1NewPos, false)
end
end