function onThink(interval, lastExecution, thinkInterval)
local maxDistance = 10
for _, pid in ipairs(getPlayersOnline()) do
local sums = getCreatureSummons(pid)
if #sums > 0 then
for i = 1, #sums do
if getThingPos(pid).z ~= getThingPos(sums[i]).z or
getDistanceBetween(getThingPos(pid), getThingPos(sums[i])) > maxDistance then
doTeleportThing(sums[i], getThingPos(pid))
doSendMagicEffect(getThingPos(pid), 21)
end
end
end
end
return true
end