protected override void Load() { Instance = this; ValidGroups = Configuration.Instance.Groups; foreach (DutyGroups Group in ValidGroups.ToList()) { RocketPermissionsGroup g = R.Permissions.GetGroup(Group.GroupID); if (g == null) { Logger.LogWarning("Permission group " + Group.GroupID + " does not exist! No command related to that group will execute."); ValidGroups.Remove(Group); } } Logger.LogWarning("Loading event \"Player Connected\"..."); U.Events.OnPlayerConnected += PlayerConnected; Logger.LogWarning("Loading event \"Player Disconnected\"..."); U.Events.OnPlayerDisconnected += PlayerDisconnected; Logger.LogWarning(""); Logger.LogWarning("Duty has been successfully loaded!"); }
protected override void Unload() { Instance = null; Logger.LogWarning("Unloading on player connect event..."); U.Events.OnPlayerConnected -= PlayerConnected; Logger.LogWarning("Unloading on player disconnect event..."); U.Events.OnPlayerConnected -= PlayerDisconnected; Logger.LogWarning(""); Logger.LogWarning("Duty has been unloaded!"); }
protected override void Load() { UnturnedPlayerEvents.OnPlayerChatted += Events_PlayerChatted; Logger.Log("Successfully loaded CGames v1.0"); if (Configuration.Instance.Use_Feex_Points == true) { if (IsDependencyLoaded("FeexRanks")) { Logger.Log("CGames successfully loaded with FeexRanks", ConsoleColor.Magenta); } else { Logger.LogWarning("You don't have FeexRanks enabled to use the point system!"); } } }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer unturnedPlayer = (UnturnedPlayer)caller; if (unturnedPlayer.Features.VanishMode) { unturnedPlayer.Features.VanishMode = false; Logger.Log(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("vanish_off_console")); UnturnedChat.Say(caller, AdvancedGodVanish.Instance.Translate("Vanish_off_Private"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOffPrivateColor, Color.red)); if (AdvancedGodVanish.Instance.Configuration.Instance.AnnouncerEnabled) { UnturnedChat.Say(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("Vanish_off_Public"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOffPublicColor, Color.red)); if (AdvancedGodVanish.Instance.Configuration.Instance.LoggingEnabled) { using (StreamWriter streamWriter = File.AppendText(directory + "/GodVanishLog.txt")) { streamWriter.WriteLine("[Vanish]player.CharacterName[" + unturnedPlayer.DisplayName + "]" + AdvancedGodVanish.Instance.Translate("vanish_off_console") + " Steam64ID: " + unturnedPlayer.CSteamID + streamWriter.NewLine); streamWriter.Close(); } } } return; } unturnedPlayer.Features.VanishMode = true; Logger.LogWarning(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("vanish_on_console")); if (AdvancedGodVanish.Instance.Configuration.Instance.AnnouncerEnabled) { UnturnedChat.Say(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("Vanish_on_Public"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOnPublicColor, Color.red)); UnturnedChat.Say(caller, AdvancedGodVanish.Instance.Translate("Vanish_on_Private"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOnPrivateColor, Color.red)); if (AdvancedGodVanish.Instance.Configuration.Instance.LoggingEnabled) { using (StreamWriter streamWriter2 = File.AppendText(directory + "/GodVanishLog.txt")) { streamWriter2.WriteLine("[Vanish]" + unturnedPlayer.CharacterName + "[" + unturnedPlayer.DisplayName + "]" + AdvancedGodVanish.Instance.Translate("vanish_on_console") + " Steam64ID: " + unturnedPlayer.CSteamID + streamWriter2.NewLine); streamWriter2.Close(); } } } }
public void Events_PlayerChatted(UnturnedPlayer player, ref Color color, string message, EChatMode chatMode, ref bool cancel) { int j; int reward_money = 0; int reward_points = 0; if (Int32.TryParse(message, out j)) { if (j == gameanswer && gameinp == true) { gameanswer = 0; gameinp = false; UnturnedChat.Say(Translations.Instance.Translate("Answered", player.DisplayName)); if (player.HasPermission("cgames.extra")) { if (rInt == 1) { if (Configuration.Instance.Custom_Extra_Amount_Enabled == true) { reward_money = Configuration.Instance.Extra_Amount_For_Sum; } else { reward_money = Configuration.Instance.Default_Amount_For_Sum * 2; } } else if (rInt == 2) { if (Configuration.Instance.Custom_Extra_Amount_Enabled == true) { reward_money = Configuration.Instance.Extra_Amount_For_Minus; } else { reward_money = Configuration.Instance.Default_Amount_For_Minus * 2; } } else if (rInt == 3) { if (Configuration.Instance.Custom_Extra_Amount_Enabled == true) { reward_money = Configuration.Instance.Extra_Amount_For_Multiplication; } else { reward_money = Configuration.Instance.Default_Amount_For_Multiplication * 2; } } else if (rInt == 4) { if (Configuration.Instance.Custom_Extra_Amount_Enabled == true) { reward_money = Configuration.Instance.Extra_Amount_For_Division; } else { reward_money = Configuration.Instance.Default_Amount_For_Division * 2; } } } else { if (rInt == 1) { reward_money = Configuration.Instance.Default_Amount_For_Sum; } else if (rInt == 2) { reward_money = Configuration.Instance.Default_Amount_For_Minus; } else if (rInt == 3) { reward_money = Configuration.Instance.Default_Amount_For_Multiplication; } else if (rInt == 4) { reward_money = Configuration.Instance.Default_Amount_For_Division; } } if (Configuration.Instance.Use_Feex_Points == true) { if (IsDependencyLoaded("FeexRanks")) { if (rInt == 1) { reward_points = Configuration.Instance.Feex_Points_For_Sum; } else if (rInt == 2) { reward_points = Configuration.Instance.Feex_Points_For_Minus; } else if (rInt == 3) { reward_points = Configuration.Instance.Feex_Points_For_Multiplication; } else if (rInt == 4) { reward_points = Configuration.Instance.Feex_Points_For_Division; } FeexRanks.Instance.UpdatePoints(player, reward_points); UnturnedChat.Say(player, Translations.Instance.Translate("AnsweredU2", reward_money, reward_points)); } else { Logger.LogWarning("You don't have FeexRanks enabled to use the point system!"); } } else { UnturnedChat.Say(player, Translations.Instance.Translate("AnsweredU1", reward_money)); } Uconomy.Instance.Database.IncreaseBalance(player.CSteamID.ToString(), reward_money); } } }