콘텐츠로 건너뛰기
라이엇 비트

라이엇 비트

  • 집
  • 소식
  • 가이드
  • 비디오 가이드
  • 패치 노트
  • 남용 신고
  • 검색 양식 전환

돌리지 않은 – How to Create a Plugin

에 게시됨 12/14/2022 에 의해 Jdance 코멘트 없음 ~에 돌리지 않은 – How to Create a Plugin
  • 제목: 돌리지 않은
  • 출시일:
  • 개발자:
  • 발행자:
Unberned에 대한 정보는 여전히 불완전합니다. 이것을 사용하여 게임의 세부 정보를 입력할 수 있도록 도와주세요. 문의 양식.

A guide on creating your first plugin.

정보

You’ll probably need Visual Studio 2019 Community Edition. 그것과 함께, this guide doesn’t tell you how to first set up your project. Here is a video on how to do that (you can also instead watch the tutorial series made by that creator):

Creating Your First Plugin

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

답장을 남겨주세요 답장 취소

귀하의 이메일 주소는 공개되지 않습니다. 필수 입력란이 표시되어 있습니다 *

  • 제목: 돌리지 않은
  • 출시일:
  • 개발자:
  • 발행자:
Unberned에 대한 정보는 여전히 불완전합니다. 이것을 사용하여 게임의 세부 정보를 입력할 수 있도록 도와주세요. 문의 양식.

부인 성명

인용된 모든 콘텐츠는 해당 소스에서 파생됩니다.. 귀하의 콘텐츠를 허가 없이 사용했다고 생각되는 경우, 우리에게 연락하면 진지하게 받아 들일 것입니다..
  • 회사 소개
  • 문의하기
  • 개인 정보 정책
  • 서비스 약관

저작권 © 2025 라이엇 비트.

에 의해 구동 프레스북 뉴스 WordPress 테마