kowal67612
New Member
- Joined
- Nov 7, 2023
- Messages
- 38
- Reaction score
- 4
he had to modify the script to teleport from Trainers to the player's city
LUA:
local config = {
leftTopCorner = {x = 31538, y = 30766},
rightDownCorner = {x = 31911, y = 30960},
zPos = 7,
tileItemId = 418, --tile item id for scanner, where you want to teleport player, ez to change for tile with uid if someone need
}
local function findFirstEmpty()
for x = config.leftTopCorner.x, config.rightDownCorner.x do
for y = config.leftTopCorner.y, config.rightDownCorner.y do
local tmpPos = {x=x, y=y, z = config.zPos};
local t = Tile(tmpPos)
if t ~= nil then
if(t:getThing():getId() == config.tileItemId and not t:getTopCreature()) then
return tmpPos
end
end
end
end
return false
end
function onStepIn(cid, item, fromPosition, itemEx, toPosition)
local availableTrainingSlot = findFirstEmpty()
if(availableTrainingSlot) then
cid:teleportTo(availableTrainingSlot)
cid:sendTextMessage(MESSAGE_INFO_DESCR, "Welcome.")
else
cid:sendTextMessage(MESSAGE_INFO_DESCR, "No available slots.")
end
return true
end