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


C# BasePlayer.ChatMessage方法代码示例

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


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

示例1: cmdSalvage

 void cmdSalvage(BasePlayer player, string command, string[] args) {
     //if player is a salvager
     if(salvagers.ContainsKey(player)) {
         //remove them
         salvagers.Remove(player);
         player.ChatMessage("Salvaging is now OFF.");
     } else {
         //add them
         salvagers[player] = true;
         player.ChatMessage("Salvaging is now ON. Visit a repair bench to salvage items.");
     }
 }
开发者ID:Randactyl,项目名称:Salvage,代码行数:12,代码来源:Salvage.cs

示例2: SendHelpText

 private void SendHelpText(BasePlayer player)
 {
     var sb = new StringBuilder();
     sb.Append("<color=yellow>NoDecay 1.0.3</color> · Controls decay\n");
     sb.Append("  · ").AppendLine($"twig={c_twigMultiplier} - campfire={c_campfireMultiplier}");
     sb.Append("  · ").Append($"wood ={ c_woodMultiplier} - stone ={ c_stoneMultiplier} - sheet ={ c_sheetMultiplier} - armored ={ c_armoredMultiplier}");
     player.ChatMessage(sb.ToString());
 }
开发者ID:SteveKnowless,项目名称:Rust,代码行数:8,代码来源:NoDecay.cs

示例3: SendHelpText

 private void SendHelpText(BasePlayer player)
 {
     var sb = new StringBuilder()
        .Append("<size=18>Clans</size> by <color=#ce422b>http://playrust.io</color>\n")
        .Append("  ").Append(_("<color=\"#ffd479\">/clan</color> - Displays your current clan status")).Append("\n")
        .Append("  ").Append(_("<color=\"#ffd479\">/clan help</color> - Learn how to create or join a clan"));
     player.ChatMessage(sb.ToString());
 }
开发者ID:SteveKnowless,项目名称:Rust,代码行数:8,代码来源:Clans.cs

示例4: ChatMessage

 private void ChatMessage(BasePlayer player, string message)
 {
     player.ChatMessage(string.Format("<color={0}>{1}</color>: {2}", MessagesTable.ChatPrefixColor, MessagesTable.ChatPrefix, message));
 }
开发者ID:Zloplay,项目名称:hunt,代码行数:4,代码来源:HuntRPG.cs

示例5: SendHelpToPlayer

 // Define a method with optional arguments, instead of having to use multiple overloaded methods
 void SendHelpToPlayer(BasePlayer player, bool already_welcomed = false)
 {
     player.ChatMessage(already_welcomed ? helpText : $"Welcome {player.displayName}!");
 }
开发者ID:906507516,项目名称:Oxide,代码行数:5,代码来源:SamplePlugin.cs

示例6: hasPermission

 private bool hasPermission(BasePlayer player, string _permission)
 {
     if (permission.UserHasPermission(player.userID.ToString(), _permission)) { return true; }
       player.ChatMessage("You do not have access to this command.");
       return false;
 }
开发者ID:GAntoine,项目名称:rust-plugins,代码行数:6,代码来源:PlayTimeTracker.cs

示例7: cmdPlayTime

        void cmdPlayTime(BasePlayer player, string cmd, string[] args)
        {
            string target = player.userID.ToString();
              if (args.Length!=0) {
            if (!hasPermission(player, "PlayTimeTracker.CanCheckPlayTime")) { return; }
            var queriedPlayer = args[0];
            string playerSteamID = FindPlayer(queriedPlayer);
            if (String.IsNullOrEmpty(playerSteamID)) {
              SendReply(player, prefix + "The player '" + queriedPlayer + "' does not exist in the system.");
              return;
            }
            target = playerSteamID.ToString();
              } else {
            if (!hasPermission(player, "PlayTimeTracker.CanCheckSelfPlayTime")) { return; }
              }

              if (playerStateData.Players.ContainsKey(target)) {
            long currentTimestamp = GrabCurrentTimestamp();
            long initTimeStamp = playerStateData.Players[target].InitTimeStamp;
            long totalPlayed = currentTimestamp - initTimeStamp;
            if (playTimeData.Players.ContainsKey(target)){totalPlayed += playTimeData.Players[target].PlayTime;}
            TimeSpan humanPlayTime = TimeSpan.FromSeconds(totalPlayed);
            player.ChatMessage(playerStateData.Players[target].LiveName + "'s total playtime: " + string.Format("{0:c}", humanPlayTime));
              }else{
             player.ChatMessage("The player has never been seen on the server.");
              }
        }
开发者ID:GAntoine,项目名称:rust-plugins,代码行数:27,代码来源:PlayTimeTracker.cs

示例8: cmdLastSeen

        void cmdLastSeen(BasePlayer player, string command, string[] args)
        {
            string target = player.userID.ToString();
              if (args.Length!=0) {
            if (!hasPermission(player, "PlayTimeTracker.CanCheckLastSeen")) { return; }
            var queriedPlayer = args[0];
            string playerSteamID = FindPlayer(queriedPlayer);
            if (String.IsNullOrEmpty(playerSteamID)) {
              SendReply(player, prefix + "The player '" + queriedPlayer + "' does not exist in the system.");
              return;
            }
            target = playerSteamID.ToString();
              } else {
            if (!hasPermission(player, "PlayTimeTracker.CanCheckSelfLastSeen")) { return; }
              }

              if (playTimeData.Players.ContainsKey(target)) {
            player.ChatMessage(playTimeData.Players[target].Name + " was last seen " + playTimeData.Players[target].LastSeen);
              }else{
             player.ChatMessage("The player has never been seen on the server.");
              }
        }
开发者ID:GAntoine,项目名称:rust-plugins,代码行数:22,代码来源:PlayTimeTracker.cs

示例9: cmdAfkTime

        void cmdAfkTime(BasePlayer player, string cmd, string[] args)
        {
            string target = player.userID.ToString();
              if (args.Length!=0) {
            if (!hasPermission(player, "PlayTimeTracker.CanCheckAfkTime")) { return; }
            var queriedPlayer = args[0];
            string playerSteamID = FindPlayer(queriedPlayer);
            if (String.IsNullOrEmpty(playerSteamID)) {
              SendReply(player, prefix + "The player '" + queriedPlayer + "' does not exist in the system.");
              return;
            }
            target = playerSteamID.ToString();
              } else {
            if (!hasPermission(player, "PlayTimeTracker.CanCheckSelfAfkTime")) { return; }
              }

              if (playerStateData.Players.ContainsKey(target)) {
            long afkTime = playerStateData.Players[target].AfkTime;
            if (playTimeData.Players.ContainsKey(target)){afkTime += playTimeData.Players[target].AfkTime;}
            TimeSpan humanAfkTime = TimeSpan.FromSeconds(afkTime);
            player.ChatMessage(playerStateData.Players[target].LiveName + "'s time spent AFK: " + string.Format("{0:c}", humanAfkTime));
              }else{
             player.ChatMessage("The player has never been seen on the server.");
              }
        }
开发者ID:GAntoine,项目名称:rust-plugins,代码行数:25,代码来源:PlayTimeTracker.cs

示例10: SalvageItem

        void SalvageItem(BasePlayer player, Item item) {
            //check player can craft item
        	bool canCraft = player.blueprints.CanCraft(item.info.itemid, 0);

            //if can't craft or broken, else salvage
        	if(!canCraft || (item.hasCondition && item.condition == 0)) {
        		player.ChatMessage("This item is not salvageable.");
        	} else {
                //remove the item from the container
        	    item.RemoveFromContainer();
                
                //get bp
        		ItemBlueprint itemBp = blueprints[item.info.shortname];
                
                //set ratios
        		double refundRatio = 0.5;
                //if item.hasCondition then conditionRatio == item.conditionNormalized else conditionRatio = 1
                double conditionRatio = item.hasCondition ? item.conditionNormalized : 1;
                
                /*
                    itemBp.amountToCreate is the number of items made by the act of crafting (3x 5.56)
                    ingredient.amount is the number of that material required (100 wood for campfire)
                    ingredient.itemDef.stackable is the max stack size of that ingredient
                */
                foreach(ItemAmount ingredient in itemBp.ingredients) {
                    //calculate refund amount
                    double refundAmount = ingredient.amount / itemBp.amountToCreate;
                    refundAmount = refundAmount * refundRatio * conditionRatio * item.amount;
                    refundAmount = Math.Ceiling(refundAmount);
                    if(refundAmount < 1)
                        refundAmount = 1;
                        
                    //calculate how many stacks to split the refund into (no super stacks)
                    double refundStacks = refundAmount / ingredient.itemDef.stackable;
                    if(refundStacks < 1)
                        refundStacks = 1;
                    
                    //refund ingredient
                    for(int i = 0; i < refundStacks; i++) {
                        int amt;
                        
                        //calculate how much to give in this stack
                        if (refundAmount <= ingredient.itemDef.stackable)
                            amt = (int)refundAmount;
                        else
                            amt = ingredient.itemDef.stackable;
                        
                        //reduce the pending refund amount by how much we're about to give out
                        refundAmount = refundAmount - amt;
                        
                        //create and give this stack
                        Item newItem = ItemManager.Create(ingredient.itemDef, amt);
                        player.GiveItem(newItem);
                    }
                }
        	}
        }
开发者ID:Randactyl,项目名称:Salvage,代码行数:57,代码来源:Salvage.cs


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