forked from DannyDan77/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 2
/
GhostPlugin.cs
57 lines (49 loc) · 1.94 KB
/
GhostPlugin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.IO;
using System.Reflection;
using Terraria;
using Terraria.Localization;
using TerrariaApi.Server;
using TShockAPI;
using Microsoft.Xna.Framework;
namespace Ghost
{
[ApiVersion(2, 1)]
public class Ghost : TerrariaPlugin
{
public override string Name => "Ghost";
public override string Author => "SirApples";
public override string Description => "A plugin that allows admins to become completely invisible to players.";
public override Version Version => Assembly.GetExecutingAssembly().GetName().Version;
public override void Initialize()
{
Commands.ChatCommands.Add(new Command("spooky.ghost", OnGhost, "ghost", "vanish"));
}
void OnGhost(CommandArgs args)
{
int i = Projectile.NewProjectile(Projectile.GetNoneSource(),args.Player.LastNetPosition.X, args.Player.LastNetPosition.Y, Vector2.Zero.X, Vector2.Zero.Y, 0, 0, 0, 16, 0, 0);
Main.projectile[i].timeLeft = 0;
NetMessage.SendData((int)PacketTypes.ProjectileNew, -1, -1, null, i);
args.TPlayer.active = !args.TPlayer.active;
NetMessage.SendData((int)PacketTypes.PlayerActive, -1, args.Player.Index, null, args.Player.Index, args.TPlayer.active.GetHashCode());
if (args.TPlayer.active)
{
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, args.Player.Index, null, args.Player.Index);
NetMessage.SendData((int)PacketTypes.PlayerUpdate, -1, args.Player.Index, null, args.Player.Index);
}
args.Player.SendSuccessMessage("{0}abled Ghost.", args.TPlayer.active ? "Dis" : "En");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
}
base.Dispose(disposing);
}
public Ghost(Main game)
: base(game)
{
Order = 10;
}
}
}