ssiwyy158
Member
- Joined
- Jan 24, 2011
- Messages
- 128
- Solutions
- 2
- Reaction score
- 13
Hello. Trying to install a script that allows only one player to enter the teleport, when he leaves the room then another player can enter (Sorry google translate)
but it doesn't work. I use tfs 1.2 8.6
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition)
local pos = {x = 908, y = 696, z = 9}
local area = {
fromPos = {x = 901, y = 689, z = 9},
toPos = {x = 915, y = 700, z = 9}
}
if not isPlayer(cid) then
return true
end
local amount = 0
for x = fromPos.x, toPos.x do
for y = fromPos.y, toPos.y do
for z = fromPos.z, toPos.z do
if isPlayer(getTopCreature({x=x,y=y,z=z}).uid) then
amount = amount+1
end
end
end
end
if amount >= 1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Someone is already in the room.")
doTeleportThing(cid,fromPosition)
else
doTeleportThing(cid,pos)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Welcome")
end
end
but it doesn't work. I use tfs 1.2 8.6