• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Town City not work

maikons

Member
Joined
Aug 1, 2015
Messages
227
Reaction score
17
Why this script not working?
/town cityname
04:03 Town carlin does not exists or has invalid temple position.


Code:
function onSay(cid, words, param, channel)
   if(param == '') then
  local str = ""
  for i, town in ipairs(getTownList()) do
  str = str .. town.name .. "\n"
  end

  doShowTextDialog(cid, 2160, str)
     return true
   end

   local t = string.explode(param, ",")
   local pos = getTownTemplePosition(tmp, false)
   if(not pos or isInArray({pos.x, pos.y}, 0)) then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists or has invalid temple position.")
     return true
   end

   pos = getClosestFreeTile(tid, pos)
   if(not pos or isInArray({pos.x, pos.y}, 0)) then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
     return true
   end

   tmp = getCreaturePosition(tid)
   if(doTeleportThing(tid, pos, true) and not isPlayerGhost(tid)) then
     doSendMagicEffect(tmp, CONST_ME_POFF)
     doSendMagicEffect(pos, CONST_ME_TELEPORT)
   end

   return true
end
 
Back
Top