2015-12-13 49 views
1

我是CSHARP的全新品牌,但我非常流利地使用JavaScript。C#意外符号}

我正在为一款多人游戏写一个Rust插件,这个插件将通过一个名为Oxide的modloader来处理。 Oxide API

的错误,我得到:

[Oxide] 6:30 AM [Error] Sulfur plugin failed to compile! 
[Oxide] 6:30 AM [Error] Sulfur.cs(19,0): error CS1525: Unexpected symbol `}' 

我已经literately直接复制我的代码氧化物的API页面,并编译它。但是,我感到我已经尝试添加和东西拿出一个非常奇怪的错误,该错误会出现在这条线

namespace Oxide.Plugins 
{ 
    [Info("Sulfur", "Christopher Allen", 0.1)] 
    public class Sulfur : RustPlugin 
    { 
     void OnServerInitialized() 
     { 
      Puts("Sulfur has been initialized."); 
     } 

     void OnPlayerInit(BasePlayer player) 
     { 
      var message = string.Format("{0} has joined the server", player.displayName); 
      rust.BroadcastChat({ message }); 
     } 
    } 
} 

要调用如果任何人都不可能能够解释为什么这可能是发生了一些光,这将是非常感谢。

+0

呢'BroadcastChat'采取匿名类型 – Ramanlfc

+0

我是个有点新这肯定地说,但在我的问题中,我试图直接通过broadcastchat player.displayName。它似乎并不喜欢那样。 –

+1

将其更改为'rust.BroadcastChat(message);'。另外,请告诉我们它正在发生的行(说第19行对我们没有用处,因为你省略了使用语句,而你的代码只有18行)。 – Rob

回答