Added Teleportation
This commit is contained in:
parent
480dee53b5
commit
b3968666d7
1 changed files with 56 additions and 1 deletions
|
|
@ -58,7 +58,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
public override string Author
|
public override string Author
|
||||||
{
|
{
|
||||||
get { return "nicatronTg, High, Mav, and Zach"; }
|
get { return "The TShock Team"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Description
|
public override string Description
|
||||||
|
|
@ -279,6 +279,46 @@ namespace TShockAPI
|
||||||
StartInvasion();
|
StartInvasion();
|
||||||
handler.Handled = true;
|
handler.Handled = true;
|
||||||
}
|
}
|
||||||
|
if (msg.Length > 9 && msg.Substring(0, 9) == "/password")
|
||||||
|
{
|
||||||
|
string passwd = msg.Remove(0, 9).Trim();
|
||||||
|
Netplay.password = passwd;
|
||||||
|
SendMessage(ply, "Server password changed to: " + passwd);
|
||||||
|
handler.Handled = true;
|
||||||
|
}
|
||||||
|
if (msg == "/save")
|
||||||
|
{
|
||||||
|
WorldGen.saveWorld();
|
||||||
|
SendMessage(ply, "World saved.");
|
||||||
|
handler.Handled = true;
|
||||||
|
}
|
||||||
|
if (msg == "/spawn")
|
||||||
|
{
|
||||||
|
Teleport(ply, Main.player[ply].SpawnX * 16, Main.player[ply].SpawnY * 16);
|
||||||
|
SendMessage(ply, "Teleported to your spawnpoint.");
|
||||||
|
handler.Handled = true;
|
||||||
|
}
|
||||||
|
if (msg.Length > 3 && msg.Substring(0, 3) == "/tp")
|
||||||
|
{
|
||||||
|
string player = msg.Remove(0, 3).Trim();
|
||||||
|
if (!(FindPlayer(player) == -1) && !(player == ""))
|
||||||
|
{
|
||||||
|
Teleport(ply, (int) Main.player[FindPlayer(player)].position.X, (int) Main.player[FindPlayer(player)].position.Y);
|
||||||
|
SendMessage(ply, "Teleported to " + player);
|
||||||
|
handler.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (msg.Length > 7 && msg.Substring(0, 7) == "/tphere")
|
||||||
|
{
|
||||||
|
string player = msg.Remove(0, 7).Trim();
|
||||||
|
if (!(FindPlayer(player) == -1) && !(player == ""))
|
||||||
|
{
|
||||||
|
Teleport(FindPlayer(player), Main.player[ply].position.X, Main.player[ply].position.Y);
|
||||||
|
SendMessage(FindPlayer(player), "You were teleported to " + FindPlayer(ply) + ".");
|
||||||
|
SendMessage(ply, "You brought " + player + " here.");
|
||||||
|
handler.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (msg == "/help")
|
if (msg == "/help")
|
||||||
{
|
{
|
||||||
|
|
@ -345,6 +385,21 @@ namespace TShockAPI
|
||||||
* Useful stuff:
|
* Useful stuff:
|
||||||
* */
|
* */
|
||||||
|
|
||||||
|
public static void Teleport(int ply, int x, int y)
|
||||||
|
{
|
||||||
|
Main.player[ply].position.X = x;
|
||||||
|
Main.player[ply].position.Y = y - 0x2a;
|
||||||
|
NetMessage.SendData(0x0d, 0, -1, "", ply);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void Teleport(int ply, float x, float y)
|
||||||
|
{
|
||||||
|
Main.player[ply].position.X = x;
|
||||||
|
Main.player[ply].position.Y = y - 0x2a;
|
||||||
|
NetMessage.SendData(0x0d, 0, -1, "", ply);
|
||||||
|
}
|
||||||
|
|
||||||
public static void StartInvasion()
|
public static void StartInvasion()
|
||||||
{
|
{
|
||||||
Main.invasionType = 1;
|
Main.invasionType = 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue