Teleportation fix thanks to Twitchy

Closes #94
This commit is contained in:
Lucas Nicodemus 2011-06-20 00:15:47 -06:00
parent 4d200ee24a
commit b8c3b85cd9

View file

@ -412,11 +412,18 @@ namespace TShockAPI
public static void Teleport(int ply, int x, int y) public static void Teleport(int ply, int x, int y)
{ {
Main.player[ply].position.X = x; int oldSpawnX = Main.spawnTileX;
Main.player[ply].position.Y = y; int oldSpawnY = Main.spawnTileY;
NetMessage.SendData(0x0d, -1, ply, "", ply); Main.spawnTileX = x;
NetMessage.SendData(0x0d, -1, -1, "", ply); Main.spawnTileY = y;
NetMessage.syncPlayers(); //Send only that player the new spawn point data
NetMessage.SendData(7, ply, -1, "", 0, 0f, 0f, 0f);
//Force them to respawn
NetMessage.SendData(12, ply, -1, "", ply, 0.0f, 0.0f, 0.0f);
//Reset to old spawnpoint and send spawn data back to player
Main.spawnTileX = (int)oldSpawnX;
Main.spawnTileY = (int)oldSpawnY;
NetMessage.SendData(7, ply, -1, "", 0, 0f, 0f, 0f);
} }
public static void Teleport(int ply, float x, float y) public static void Teleport(int ply, float x, float y)