local zone = {
xS = 111,
xE = 999,
yS = 111,
yE - 999,
zS = 6,
zE = 9,
}
function onSay()
local playerPos = player:getPosition()
for x=zone.xS, zone.xE do
for y=zone.yS, zone.yE do
for z=zone.zS, zpne.zE do
if comparePos(playerPos, {x=x, y=y, z=z}) then
return false, player:teleportTo(player:getTown():getTemplePosition())
end
end
end
end
return false
end
local zone = {
from = {x = 111, y = 111, z = 6}
to = {x = 999, y = 999, z = 9}
}
-- Add function to global.lua to allow it to be used in other scripts as well.
function inrange(playerPos, zone)
-- If player X position is between configured zone (from X) and (to X)
if playerPos.x >= zone.from.x and playerPos.x <= zone.to.x then
-- If player Y position is between configured zone (from Y) and (to Y)
if playerPos.y >= zone.from.y and playerPos.y <= zone.to.y then
-- If player Z position is between configured zone (from Z) and (to Z)
if playerPos.z >= zone.from.z and playerPos.z <= zone.to.z then
return true
end -- Z
end -- Y
end -- X
return false
end
function onSay()
if inrange(player:getPosition(), zone) == true then
player:teleportTo(player:getTown():getTemplePosition())
end
return false
-- I think you can use return true here if you don't want chat to contain the talkaction word.
end
Forgot to mention 0.3.6sorry guys
![]()
function onSay(cid)
if inrange(getCreaturePosition(cid), zone) == true then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
return false
-- I think you can use return true here if you don't want chat to contain the talkaction word.
end
<talkaction words="!exit" value="exitas.lua"/>
local zone = {
from = {x = 1003, y = 996, z = 7}
to = {x = 1004, y = 997, z = 7}
}
-- Add function to global.lua to allow it to be used in other scripts as well.
function inrange(playerPos, zone)
-- If player X position is between configured zone (from X) and (to X)
if playerPos.x >= zone.from.x and playerPos.x <= zone.to.x then
-- If player Y position is between configured zone (from Y) and (to Y)
if playerPos.y >= zone.from.y and playerPos.y <= zone.to.y then
-- If player Z position is between configured zone (from Z) and (to Z)
if playerPos.z >= zone.from.z and playerPos.z <= zone.to.z then
return true
end -- Z
end -- Y
end -- X
return false
end
function onSay(cid)
if inrange(getCreaturePosition(cid), zone) == true then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
return true
end
local config = {
fromPosition = {x = 1003, y = 996, z = 7},
toPosition = {x = 1004, y = 997, z = 7}
}
function onSay(cid, words, param)
if isInRange(getCreaturePosition(cid), config.fromPosition, config.toPosition) then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
return true
end