public static void Check_Afk(CommandArgs args) { if (args.Parameters.Count == 1) { if (STools.GetPlayer(args.Player.Index) != null) { SPlayer player = STools.GetPlayer(args.Player.Index); if (player.AFK) { args.Player.SendInfoMessage("You have been AFK for {0} seconds.", player.AFKcount); } else { args.Player.SendInfoMessage("You are not AFK."); } } else if (TSServerPlayer.Server.Name == args.Player.Name) { args.Player.SendErrorMessage("The console has no stats to check."); } else { args.Player.SendErrorMessage("Something broke. Please try again later."); } } if (args.Parameters.Count > 1) { args.Parameters.RemoveAt(0); string name = string.Join(" ", args.Parameters); var players = TSPlayer.FindByNameOrID(name); // fix command fail when afk checking an offline player if (players.Count == 0) { args.Player.SendErrorMessage("Invalid player!"); return; } if (STools.GetPlayer(name).Count == 1) { SPlayer player = STools.GetPlayer(name)[0]; if (player.AFK) { args.Player.SendInfoMessage("{0} has been AFK for {1} second{2}.", player.TSPlayer.Account.Name, player.AFKcount, STools.Suffix(player.AFKcount)); } else { args.Player.SendInfoMessage("{0} is not AFK.", player.TSPlayer.Account.Name); } } else if (STools.GetPlayer(name).Count > 1) { args.Player.SendMultipleMatchError(STools.GetPlayer(name).Select(p => p.Name)); } else { args.Player.SendErrorMessage("Player {0} is not in the database.", args.Parameters[1]); } } }
public static void Check_Kills(CommandArgs args) { if (args.Parameters.Count == 1) { if (STools.GetPlayer(args.Player.Index) != null) { SPlayer player = STools.GetPlayer(args.Player.Index); if (player.TSPlayer.IsLoggedIn) { args.Player.SendInfoMessage("You have killed {0} player{4}, {1} mob{5}, {2} boss{6} and died {3} time{7}.", player.kills, player.mobkills, player.bosskills, player.deaths, STools.Suffix(player.kills), STools.Suffix(player.mobkills), STools.Suffix2(player.bosskills), STools.Suffix(player.deaths)); } else { args.Player.SendErrorMessage("You must be logged in to use this on yourself."); } } else if (TSServerPlayer.Server.Name == args.Player.Name) { args.Player.SendErrorMessage("The console has no stats to check."); } else { args.Player.SendErrorMessage("Something broke. Please try again later."); } } if (args.Parameters.Count > 1) { args.Parameters.RemoveAt(0); // fixes command fail when checking another player's kills string name = string.Join(" ", args.Parameters); if (STools.GetPlayer(name).Count == 1) { SPlayer player = STools.GetPlayer(name)[0]; if (player.TSPlayer.IsLoggedIn) { args.Player.SendInfoMessage("{0} has killed {1} player{5}, {2} mob{6}, {3} boss{7} and died {4} time{8}.", player.TSPlayer.Account.Name, player.kills, player.mobkills, player.bosskills, player.deaths, STools.Suffix(player.kills), STools.Suffix(player.mobkills), STools.Suffix2(player.bosskills), STools.Suffix(player.deaths)); } else { args.Player.SendErrorMessage("{0} is not logged in.", player.Name); } } else if (STools.GetPlayer(name).Count > 1) { args.Player.SendMultipleMatchError(STools.GetPlayer(name).Select(p => p.Name)); } else { if (STools.GetStoredPlayer(name).Count == 1) { StoredPlayer StoredPlayer = STools.GetStoredPlayer(name)[0]; args.Player.SendInfoMessage("{0} has killed {1} player{5}, {2} mob{6}, {3} boss{7} and died {4} time{8}.", StoredPlayer.name, StoredPlayer.kills, StoredPlayer.mobkills, StoredPlayer.bosskills, StoredPlayer.deaths, STools.Suffix(StoredPlayer.kills), STools.Suffix(StoredPlayer.mobkills), STools.Suffix2(StoredPlayer.bosskills), STools.Suffix(StoredPlayer.deaths)); } else if (STools.GetStoredPlayer(name).Count > 1) { args.Player.SendMultipleMatchError(STools.GetStoredPlayer(name).Select(p => p.name)); } else { args.Player.SendErrorMessage("Player {0} is not in the database.", name); } } } }