parent
4d200ee24a
commit
b8c3b85cd9
1 changed files with 12 additions and 5 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue