Hi. My teleportto.lua is crashing Tibia client whenever I am trying to teleport as god to a player. I can use /c player and it works but /goto is crashing the client. When i execute /goto god teleports fine but when teleported if I move god char, the char that I teleported to is following god for 1 tile and then client is crashing (god client). Same happends when I move char that I teleported god to.
teleportto.lua
tibia client crash report
teleportto.lua
Code:
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return true
end
local creature = getCreatureByName(param)
local player = getPlayerByNameWildcard(param)
local waypoint = getWaypointPosition(param)
local tile = string.explode(param, ",")
local pos = {x = 0, y = 0, z = 0}
if(player ~= nil and (not isPlayerGhost(player) or getPlayerGhostAccess(player) <= getPlayerGhostAccess(cid))) then
pos = getCreaturePosition(player)
elseif(creature ~= nil and (not isPlayer(creature) or (not isPlayerGhost(creature) or getPlayerGhostAccess(creature) <= getPlayerGhostAccess(cid)))) then
pos = getCreaturePosition(creature)
elseif(type(waypoint) == 'table' and waypoint.x ~= 0 and waypoint.y ~= 0) then
pos = waypoint
elseif(tile[2] and tile[3]) then
pos = {x = tile[1], y = tile[2], z = tile[3]}
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
return true
end
if(not pos or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
return true
end
pos = getClosestFreeTile(cid, pos, true, false)
if(not pos or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
return true
end
local tmp = getCreaturePosition(cid)
if(doTeleportThing(cid, pos, true) and not isPlayerGhost(cid)) then
doSendMagicEffect(tmp, CONST_ME_POFF)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
end
return true
end
tibia client crash report
Code:
+---------------------------------------------------------------
Debug Assertion 8.60 Communication.cpp 1950
Thu Feb 28 00:02:07 2013
Graphic Engine: DirectX9 (2)
Operating System: Windows 7 Ultimate Edition 64 Bit in ENG
Processor: Intel Core 2 DUO E8400
Video Card: NVIDIA GeForce GTX 285
Last Packet Types: 109 030 162 101 109 131 100 108 180 030
Last Packet: 109 240 003 252 003 007 001 239 003 252 003 007 104 163 017 000
Player Position: [1008,1021,7]
Player Name: GOD Test (Test World)
Player Action: 049 057 050 046 049 054 056 046 049 046 049 053 055 058 055 049 055 050
Player.cpp 361: exception occurred, reason:
Network.cpp 946: exception occurred (ErrorCode = 0), reason:
Control.cpp 1331: exception occurred (Type = 109) (MainWindow = 34753984), reason:
Communication.cpp 2151: exception occurred, reason:
Communication.cpp 1950: Player object is not where it should be, reason:
hx: 8 hy: 6 hz: 0
Cylinder (1): (1771,0) (99,268437663)
Cylinder (2): (1771,0) (99,268437663)(-)(-)(-)(-)(-)(-)(-)(-)
----------------------------------------------------------------