2015-12-13 53 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

回答