예제 #1
0
        public void ExecuteSmsCommand(IRocketPlayer caller, string[] command) // /sms (player: 0) [text: 1]
        {
            UnturnedPlayer player   = (UnturnedPlayer)caller;
            UnturnedPlayer toPlayer = UnturnedPlayer.FromName(command.GetStringParameter(0));
            string         text     = command.GetParameterString(1);

            if (command.Length <= 1)
            {
                UnturnedChat.Say(player, Instance.Translate("command_sms_syntax"), Color.yellow);
                return;
            }

            if (toPlayer == null)
            {
                UnturnedChat.Say(player, Instance.Translate("command_sms_player_notfound"), Color.red);
                return;
            }

            if (player.Equals(toPlayer))
            {
                UnturnedChat.Say(player, Instance.Translate("command_sms_to_myself"), Color.red);
                return;
            }


            if (Configuration.Instance.SMSChatItemId != 0 && player.Player.inventory.search(Configuration.Instance.SMSChatItemId, true, true).Count <= 0)
            {
                UnturnedChat.Say(player, Instance.Translate("command_sms_dont_have_item", Configuration.Instance.SMSChatItemId), Color.red);
                return;
            }

            if (player.Experience < Configuration.Instance.SMSChatCost)
            {
                UnturnedChat.Say(player, Instance.Translate("command_sms_not_enough_currency", player.Experience, Configuration.Instance.SMSChatCost,
                                                            Configuration.Instance.SMSChatCost - player.Experience), Color.red);
                return;
            }

            player.Experience -= Configuration.Instance.SMSChatCost;


            UnturnedChat.Say(player, Instance.Translate("command_sms_send_messege", toPlayer.CharacterName, text), UnturnedChat.GetColorFromName(Configuration.Instance.SMSChatColor, Color.green));
            UnturnedChat.Say(player, Instance.Translate("command_sms_sended"), UnturnedChat.GetColorFromName(Configuration.Instance.SMSChatColor, Color.green));

            ChatManager.serverSendMessage(
                text:       Instance.Translate("command_sms_message", player.CharacterName, text),
                color:      UnturnedChat.GetColorFromName(Configuration.Instance.SMSChatColor, Color.green),
                fromPlayer: player.SteamPlayer(),
                toPlayer:   toPlayer.SteamPlayer(),
                mode:       EChatMode.SAY,
                iconURL:    string.IsNullOrEmpty(Configuration.Instance.SMSChatIcon) ? null : Configuration.Instance.SMSChatIcon);
        }
예제 #2
0
 public void makeLeader(UnturnedPlayer caller, UnturnedPlayer player)
 {
     if (caller.Equals(player))
     {
         DGPlugin.messagePlayer(caller, "You are already the party leader.");
         return;
     }
     if (isMember(player))
     {
         if (isLeader(caller))
         {
             leader = player;
             tellParty(player.CharacterName + " has been made party leader!");
         }
         else
         {
             DGPlugin.messagePlayer(caller,
                 "Only the party leader(" + leader.CharacterName + ") switch leaders.");
         }
     }
     else
         DGPlugin.messagePlayer(caller, "Could not find " + player.CharacterName + " in your party.");
 }