コンテンツにスキップ
ライオットビット

ライオットビット

  • 家
  • ニュース
  • ガイド
  • ビデオガイド
  • パッチノート
  • 不正行為を報告する
  • 検索フォームを切り替え

アンターンド – プラグインを作成する方法

ポストする 12/14/2022 に jdance コメントはありません の上 アンターンド – プラグインを作成する方法
  • タイトル: アンターンド
  • 発売日:
  • 開発者:
  • 出版社:
アンターンドに関する情報はまだ不完全です. これを使用してゲームの詳細を記入するのにご協力ください。 お問い合わせフォーム.

最初のプラグインの作成に関するガイド.

情報

You’ll probably need Visual Studio 2019 コミュニティ版. それに加えて, このガイドは、最初にプロジェクトをセットアップする方法を説明していません. これがそれを行う方法に関するビデオです (代わりに、その作成者が作成したチュートリアルシリーズを見ることもできます):

最初のプラグインを作成します

Creating plugins for Unturned requires a general knowledge of C#. If you currently do not have any knowledge behind C#, please check out Microsoft’s introduction to the language.

All plugins normally begin with class that inherits the `RocketPlugin` class. Below is an example of how to properly implement this:

using Rocket.API;
using Rocket.Core.Plugins;

namespace ExamplePlugin
{
public class ExamplePlugin : RocketPlugin
{

}
}

Notice how the `ExamplePlugin` class is public? This is so we can make it accessible to RocketMod.

先に進む, you can now override the `Load` and `Unload` methods contained within the `RocketPlugin` class to log the loading and unloading of your plugin:

using Rocket.API;
using Rocket.Core.Plugins;
using Rocket.Unturned;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using Rocket.Core.Logging;

namespace ExamplePlugin
{
public class ExamplePlugin : RocketPlugin
{
protected override void Load()
{
Logger.Log("Example plugin loaded!");
}

protected override void Unload()
{
Logger.Log("Example plugin unloaded!");
}
}
}

The plugin will now log in the server console that the plugin has been loaded and unloaded.

You can also subscribe and unsubscribe to events when the plugin loads and unloads:

using Rocket.API;
using Rocket.Core.Plugins;
using Rocket.Unturned;
using Rocket.Core.Logging;

namespace ExamplePlugin
{
public class ExamplePlugin : RocketPlugin
{
protected override void Load()
{
Logger.Log("Example plugin loaded!");

U.Events.OnPlayerConnected += OnPlayerConnected;
}

protected override void Unload()
{
Logger.Log("Example plugin unloaded!");

U.Events.OnPlayerConnected -= OnPlayerConnected;
}

public void OnPlayerConnected(UnturnedPlayer player)
{
}
}
}

The plugin now subscribes and unsubscribes to the `U.Events.OnPlayerConnected`event on load and unload.

You can also now greet the player when they connect to the server:

using Rocket.API;
using Rocket.Core.Plugins;
using Rocket.Unturned;
using Rocket.Core.Logging;

namespace ExamplePlugin
{
public class ExamplePlugin : RocketPlugin
{
protected override void Load()
{
Logger.Log("Example plugin loaded!");

U.Events.OnPlayerConnected += OnPlayerConnected;
}

protected override void Unload()
{
Logger.Log("Example plugin unloaded!");

U.Events.OnPlayerConnected -= OnPlayerConnected;
}

public void OnPlayerConnected(UnturnedPlayer player)
{
// Do something when a player connects
UnturnedChat.Say(プレーヤー, "Welcome to the server!");
}
}
}

To conclude, This plugin will log a message when it is loaded and unloaded, and greet players when they connect to the server. もちろん, you can customize the plugin to do whatever you want it to do.

これが今日私たちがこの目的で共有するすべてです アンターンド ガイド. このガイドは元々、次の者によって作成および執筆されました。 jdance. このガイドを更新できなかった場合, これに従って最新のアップデートを見つけることができます リンク.

このサイトのコンテンツがあなたの権利を侵害していると思われる場合, あなたの知的財産権を含む, お問い合わせフォームを使用してすぐにご連絡ください.
ガイド, ビデオガイド タグ:アンターンド

ポストナビゲーション

前の投稿: プロジェクトのプレイタイム – カットシーンと映画を変更する方法
次の投稿: Disney Dreamlight Valley Cookbook Guide

返信を残す 返信をキャンセル

あなたのメールアドレスは公開されません. 必須フィールドにマークが付いています *

  • タイトル: アンターンド
  • 発売日:
  • 開発者:
  • 出版社:
アンターンドに関する情報はまだ不完全です. これを使用してゲームの詳細を記入するのにご協力ください。 お問い合わせフォーム.

免責事項

引用されたすべてのコンテンツはそれぞれの情報源から得られています. 当社があなたのコンテンツを許可なく使用したと思われる場合, 必ずご連絡ください。真剣に対応させていただきます.
  • 私たちに関しては
  • お問い合わせ
  • プライバシーポリシー
  • 利用規約

著作権 © 2025 ライオットビット.

搭載 プレスブックニュース ワードプレスのテーマ