From ef60c83b40be0a7948d3cb0381cc6e4526a9b2d6 Mon Sep 17 00:00:00 2001 From: Shank Date: Mon, 30 May 2011 02:40:41 -0600 Subject: [PATCH] Updated more stuff with motd --- TShockAPI/TShock.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 64dc01db..768d6e7c 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -71,8 +71,18 @@ namespace TShockAPI void OnGreetPlayer(int who, HandledEventArgs e) { + int plr = who; //legacy support e.Handled = true; ShowMOTD(who); + if (Main.player[plr].statLifeMax > 400 || Main.player[plr].statManaMax > 200 || Main.player[plr].statLife > 400 || Main.player[plr].statMana > 200) + { + HandleCheater(plr); + } + if (permaPvp) + { + Main.player[who].hostile = true; + NetMessage.SendData(30, -1, -1, "", who); + } } void OnChat(int ply, string msg, HandledEventArgs handler) @@ -318,6 +328,20 @@ namespace TShockAPI return pl; } + public static void HandleCheater(int ply) + { + string cheater = ShankShock.FindPlayer(ply); + string ip = ShankShock.GetRealIP(Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)); + + _writecheater(ply); + if (!kickCheater) { return; } + Netplay.serverSock[ply].kill = true; + Netplay.serverSock[ply].Reset(); + NetMessage.syncPlayers(); + ShankShock.Broadcast(cheater + " was " + (banCheater ? "banned " : "kicked ") + "for cheating."); + + } + public static string FindPlayer(int ply) { for (int i = 0; i < Main.player.Length; i++)