当前位置: 首页>>代码示例>>C#>>正文


C# BasePlayer.SendConsoleCommand方法代码示例

本文整理汇总了C#中BasePlayer.SendConsoleCommand方法的典型用法代码示例。如果您正苦于以下问题:C# BasePlayer.SendConsoleCommand方法的具体用法?C# BasePlayer.SendConsoleCommand怎么用?C# BasePlayer.SendConsoleCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BasePlayer的用法示例。


在下文中一共展示了BasePlayer.SendConsoleCommand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnEntityEnter

 void OnEntityEnter(TriggerBase triggerbase, BaseEntity entity)
 {
     if (!hasStarted) return;
     cachedBlock = triggerbase.GetComponentInParent<BuildingBlock>();
     if (cachedBlock == null) return;
     if (cachedBlock.blockDefinition.fullName != "build/block.halfheight") return;
     cachedPlayer = entity.GetComponent<BasePlayer>();
     if (cachedPlayer == null) return;
     cachedBlock.Kill(BaseNetworkable.DestroyMode.Gib);
     cachedPlayer.SendConsoleCommand("chat.add", new object[] { "0", string.Format("<color=orange>{0}:</color> {1}", "Warning", "You are not allowed to build blocks over you"), 1.0 });
 }
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:11,代码来源:BlockBlockElevators.cs

示例2: cmdSpawnAdd

 void cmdSpawnAdd(BasePlayer player, string command, string[] args)
 {
     if (!hasAccess(player)) return;
     if (!(SpawnsData.ContainsKey(player)))
     {
         SendReply(player, "You must create/open a new Spawn file first /spawns_help for more informations");
         return;
     }
     ((List<Vector3>)SpawnsData[player]).Add(player.transform.position);
     player.SendConsoleCommand("ddraw.text", 20f, Color.red, player.transform.position, ((List<Vector3>)SpawnsData[player]).Count);
     SendReply(player, string.Format("Added Spawn n°{0}", ((List<Vector3>)SpawnsData[player]).Count));
 }
开发者ID:stuffedmotion,项目名称:plugins,代码行数:12,代码来源:Spawns2.cs

示例3: SendChatMessage

 public void SendChatMessage(BasePlayer player, string name, string message = null, string userid = "0")
 {
     if (message != null)
     {
         player.SendConsoleCommand("chat.add", userid, $"<color=orange>{name}</color>: {message}", 1.0);
     }
     else
     {
         message = name;
         player.SendConsoleCommand("chat.add", userid, message, 1.0);
     }
 }
开发者ID:CypressCube,项目名称:Oxide,代码行数:12,代码来源:Rust.cs

示例4: ShowZone

 void ShowZone(BasePlayer player, string ZoneID)
 {
     Zone targetZone = GetZoneByID(ZoneID);
     if (targetZone == null) return;
     player.SendConsoleCommand("ddraw.sphere", 5f, UnityEngine.Color.blue, targetZone.info.Location.GetPosition(), targetZone.info.Location.GetRadius());
 }
开发者ID:bloodyblaze,项目名称:rep-Mods,代码行数:6,代码来源:ZoneManager.cs

示例5: SendMessage

 static void SendMessage(BasePlayer player, string message)
 {
     player.SendConsoleCommand("chat.add", new object[] { "0", string.Format("<color=#FA58AC>{0}:</color> {1}", "ZoneManager", message), 1.0 });
 }
开发者ID:bloodyblaze,项目名称:rep-Mods,代码行数:4,代码来源:ZoneManager.cs

示例6: VersionRecieved

        void VersionRecieved(int code, string response, BasePlayer player)
        {
            if (response == null || code != 200)
            {
                Puts("Web Request failed.");
            }

            string version = "0.0.0";
            Match match = new Regex(@"<h\d>Version (\d+(?:\.\d+){1,3})<\/h\d>").Match(response);
            if(match.Success) version = match.Groups[1].ToString();

            player.SendConsoleCommand("chat.add", account, "<size=25><color=#4B75FF>Death Notes</color></size><color=grey> by LaserHydra\nInstalled Version:</color> " + this.Version + "\n<color=grey>Latest Version:</color> " + version, 1.0);
        }
开发者ID:SteveKnowless,项目名称:Rust,代码行数:13,代码来源:DeathNotes.cs

示例7: PrintToChat

 /// <summary>
 /// Print a message to a players chat log
 /// </summary>
 /// <param name="player"></param>
 /// <param name="format"></param>
 /// <param name="args"></param>
 protected void PrintToChat(BasePlayer player, string format, params object[] args)
 {
     if (player?.net != null) player.SendConsoleCommand("chat.add", 0, args.Length > 0 ? string.Format(format, args) : format, 1f);
 }
开发者ID:yas-online,项目名称:Oxide,代码行数:10,代码来源:RustPlugin.cs

示例8: PrintToConsole

 /// <summary>
 /// Print a message to a players console log
 /// </summary>
 /// <param name="player"></param>
 /// <param name="format"></param>
 /// <param name="args"></param>
 protected void PrintToConsole(BasePlayer player, string format, params object[] args)
 {
     if (player?.net != null) player.SendConsoleCommand("echo " + (args.Length > 0 ? string.Format(format, args) : format));
 }
开发者ID:yas-online,项目名称:Oxide,代码行数:10,代码来源:RustPlugin.cs

示例9: RunClientCommand

 public void RunClientCommand(BasePlayer player, string command, params object[] args) => player.SendConsoleCommand(command, args);
开发者ID:yas-online,项目名称:Oxide,代码行数:1,代码来源:Rust.cs

示例10: PlayerStartCrafting

        // ItemCrafter.CraftItem()
        public static bool PlayerStartCrafting(ItemCrafter self, ItemBlueprint bp, BasePlayer owner, ProtoBuf.Item.InstanceData instanceData = null, int amount = 1)
        {
            /*ItemBlueprint bpcopy = new ItemBlueprint();
            bpcopy.amountToCreate = bp.amountToCreate;
            bpcopy.defaultBlueprint = bp.defaultBlueprint;
            bpcopy.ingredients = bp.ingredients;
            bpcopy.rarity = bp.rarity;
            bpcopy.targetItem = bp.targetItem;
            bpcopy.time = bp.time / Server.GetInstance().CraftingTimeScale;
            bpcopy.userCraftable = bp.userCraftable;*/
            CraftEvent ce = new CraftEvent(self, bp, owner, instanceData, amount);
            OnPlayerStartCrafting.OnNext(ce);
            if (!self.CanCraft(bp, 1)) {
                return false;
            }
            if (ce.Cancel) {
                if (ce.cancelReason != "")
                    owner.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), ce.cancelReason));
                return false;
            }

            self.taskUID++;
            ItemCraftTask itemCraftTask = new ItemCraftTask();
            itemCraftTask.blueprint = bp;
            if (!ce.FreeCraft) {
                List<Item> list = new List<Item>();
                foreach (ItemAmount current in bp.ingredients) {
                    int amount2 = (int)current.amount * amount;
                    foreach (ItemContainer current2 in self.containers) {
                        amount2 -= current2.Take(list, current.itemid, amount2);
                    }
                }
                foreach (Item current2 in list) {
                    current2.Remove(0f);
                }
            }
            itemCraftTask.endTime = 0;
            itemCraftTask.taskUID = self.taskUID;
            itemCraftTask.owner = owner;
            itemCraftTask.instanceData = instanceData;
            itemCraftTask.amount = amount;
            self.queue.Enqueue(itemCraftTask);
            if (itemCraftTask.owner != null) {
                itemCraftTask.owner.Command("note.craft_add", new object[] {
                    itemCraftTask.taskUID,
                    itemCraftTask.blueprint.targetItem.itemid,
                    amount
                });
            }
            return true;
        }
开发者ID:Viproz,项目名称:Pluton,代码行数:52,代码来源:Hooks.cs

示例11: ShowZone

        private void ShowZone(BasePlayer player, string zoneId)
        {
            var targetZone = GetZoneByID(zoneId);
            if (targetZone == null) return;
            if (targetZone.Info.Size != Vector3.zero)
            {
                //player.SendConsoleCommand("ddraw.box", 10f, Color.blue, targetZone.Info.Location, targetZone.Info.Size.magnitude);
                var center = targetZone.Info.Location;
                var rotation = Quaternion.Euler(targetZone.Info.Rotation);
                var size = targetZone.Info.Size / 2;
                var point1 = RotatePointAroundPivot(new Vector3(center.x + size.x, center.y + size.y, center.z + size.z), center, rotation);
                var point2 = RotatePointAroundPivot(new Vector3(center.x + size.x, center.y - size.y, center.z + size.z), center, rotation);
                var point3 = RotatePointAroundPivot(new Vector3(center.x + size.x, center.y + size.y, center.z - size.z), center, rotation);
                var point4 = RotatePointAroundPivot(new Vector3(center.x + size.x, center.y - size.y, center.z - size.z), center, rotation);
                var point5 = RotatePointAroundPivot(new Vector3(center.x - size.x, center.y + size.y, center.z + size.z), center, rotation);
                var point6 = RotatePointAroundPivot(new Vector3(center.x - size.x, center.y - size.y, center.z + size.z), center, rotation);
                var point7 = RotatePointAroundPivot(new Vector3(center.x - size.x, center.y + size.y, center.z - size.z), center, rotation);
                var point8 = RotatePointAroundPivot(new Vector3(center.x - size.x, center.y - size.y, center.z - size.z), center, rotation);

                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point1, point2);
                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point1, point3);
                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point1, point5);
                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point4, point2);
                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point4, point3);
                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point4, point8);

                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point5, point6);
                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point5, point7);
                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point6, point2);
                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point8, point6);
                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point8, point7);
                player.SendConsoleCommand("ddraw.line", 30f, Color.blue, point7, point3);
            }
            else
                player.SendConsoleCommand("ddraw.sphere", 10f, Color.blue, targetZone.Info.Location, targetZone.Info.radius);
        }
开发者ID:mpendel,项目名称:RUSTBOYS,代码行数:36,代码来源:ZoneManager.cs

示例12: cmdSpawnShow

        void cmdSpawnShow(BasePlayer player, string command, string[] args)
        {
            if (!hasAccess(player)) return;
            if (!(SpawnsData.ContainsKey(player)))
            {
                SendReply(player, "You must create/open a new Spawn file first /spawns_help for more informations");
                return;
            }
            int count = 1;
            foreach (Vector3 spawnpoint in (List<Vector3>)SpawnsData[player])
            {
                player.SendConsoleCommand("ddraw.box", 40f, Color.red, spawnpoint, 1f);
                player.SendConsoleCommand("ddraw.text", 40f, Color.red, spawnpoint, count.ToString());
                count++;
            }

            SendReply(player, "Showing Spawnpoints for 40 seconds");
        }
开发者ID:stuffedmotion,项目名称:plugins,代码行数:18,代码来源:Spawns2.cs

示例13: statsCmd

        void statsCmd(BasePlayer player, string cmd, string[] args)
        {
            BasePlayer target = null;

            if (args.Length == 0)
                target = player;
            else if (args.Length > 0)
            {
                target = GetPlayer(args[0], player);
                if (target == null) SendReply(player, "That player could not be found!");
            }

            if (target != null)
            {
                if (!storedData.kills.ContainsKey(target.userID))
                {
                    storedData.kills.Add(target.userID, 0);
                    Interface.GetMod().DataFileSystem.WriteObject("KillStats", storedData);
                }

                if (!storedData.deaths.ContainsKey(target.userID))
                {
                    storedData.deaths.Add(target.userID, 0);
                    Interface.GetMod().DataFileSystem.WriteObject("KillStats", storedData);
                }

                string playerNamePrefix;

                if (player != target)
                    messages.Add(String.Format("{0} has", target.displayName));

                messages.Add(String.Format("{0} kills. {1} deaths.", storedData.kills[target.userID].ToString(), storedData.deaths[target.userID].ToString()));

                foreach (string item in messages)
                    player.SendConsoleCommand("chat.add", 76561198206240711, item);

                messages.Clear();
            }
        }
开发者ID:PsychoTea,项目名称:RustArena,代码行数:39,代码来源:RustArena.cs

示例14: PrintToConsole

 /// <summary>
 /// Print a message to a players console log
 /// </summary>
 /// <param name="player"></param>
 /// <param name="format"></param>
 /// <param name="args"></param>
 protected void PrintToConsole(BasePlayer player, string format, params object[] args)
 {
     player.SendConsoleCommand("echo " + string.Format(format, args));
 }
开发者ID:CypressCube,项目名称:Oxide,代码行数:10,代码来源:RustPlugin.cs

示例15: PrintToChat

 /// <summary>
 /// Print a message to a players chat log
 /// </summary>
 /// <param name="player"></param>
 /// <param name="format"></param>
 /// <param name="args"></param>
 protected void PrintToChat(BasePlayer player, string format, params object[] args)
 {
     player.SendConsoleCommand("chat.add", 0, string.Format(format, args), 1f);
 }
开发者ID:CypressCube,项目名称:Oxide,代码行数:10,代码来源:RustPlugin.cs


注:本文中的BasePlayer.SendConsoleCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。