コード例 #1
0
 public void duty(UnturnedPlayer caller)
 {
     if (caller.IsAdmin)
     {
         caller.Admin(false);
         caller.Features.GodMode    = false;
         caller.Features.VanishMode = false;
         if (Configuration.Instance.EnableServerAnnouncer)
         {
             UnturnedChat.Say(Instance.Translate("off_duty_message", caller.CharacterName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
         }
     }
     else
     {
         caller.Admin(true);
         if (Configuration.Instance.EnableServerAnnouncer)
         {
             UnturnedChat.Say(Instance.Translate("on_duty_message", caller.CharacterName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
         }
     }
 }
コード例 #2
0
ファイル: Duty.cs プロジェクト: mateoradic16/Duty
        public void cduty(UnturnedPlayer cplayer, IRocketPlayer caller)
        {
            if (cplayer != null)
            {
                bool od = false;

                foreach (var pod in OnDuty_Players)
                {
                    if (pod.Player.CSteamID == cplayer.CSteamID)
                    {
                        od = true;
                    }
                }

                if (od)
                {
                    if (Configuration.Instance.AllowDutyCheck)
                    {
                        if (caller is ConsolePlayer)
                        {
                            UnturnedChat.Say(Instance.Translate("check_on_duty_message", "Console", cplayer.DisplayName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
                        }
                        else if (caller is UnturnedPlayer)
                        {
                            UnturnedChat.Say(Instance.Translate("check_on_duty_message", caller.DisplayName, cplayer.DisplayName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
                        }
                    }
                    else if (Configuration.Instance.AllowDutyCheck == false)
                    {
                        if (caller is UnturnedPlayer)
                        {
                            UnturnedChat.Say(caller, "Unable To Check Duty. Configuration Is Set To Be Disabled.");
                        }
                    }
                }
                else
                {
                    if (Configuration.Instance.AllowDutyCheck)
                    {
                        if (caller is ConsolePlayer)
                        {
                            UnturnedChat.Say(Instance.Translate("check_off_duty_message", "Console", cplayer.DisplayName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
                        }
                        else if (caller is UnturnedPlayer)
                        {
                            UnturnedChat.Say(Instance.Translate("check_off_duty_message", caller.DisplayName, cplayer.DisplayName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
                        }
                    }
                    else if (Configuration.Instance.AllowDutyCheck == false)
                    {
                        if (caller is UnturnedPlayer)
                        {
                            UnturnedChat.Say(caller, "Unable To Check Duty. Configuration Is Set To Be Disabled.");
                        }
                    }
                }
            }
            else if (cplayer == null)
            {
                Rocket.Core.Logging.Logger.LogWarning("Duty Debug: Player is not online or his name is invalid.");
                if (caller is UnturnedPlayer)
                {
                    UnturnedChat.Say(caller, "Player is not online or his name is invalid.");
                }
            }
        }