Rust Oxide Plugin Development for Beginners

Published on

Learn to create custom Oxide plugins for Rust servers. Covers C# basics, hook system, configuration files, permissions, and publishing to uMod.

Written by Space-Node Team – Infrastructure Team – 15+ years combined experience in game server hosting, VPS infrastructure, and 24/7 streaming solutions. Read author bio →

Building your own Oxide plugins lets you create exactly the server experience you want. If you know basic programming concepts, Rust plugin development is approachable.

Plugin Basics

Oxide plugins for Rust are written in C#. Each plugin is a single .cs file placed in oxide/plugins/. Oxide compiles and loads it automatically.

Minimal Plugin

namespace Oxide.Plugins
{
    [Info("HelloWorld", "YourName", "1.0.0")]
    class HelloWorld : RustPlugin
    {
        void Init()
        {
            Puts("Hello World loaded!");
        }

        [ChatCommand("hello")]
        void HelloCommand(BasePlayer player, string command, string[] args)
        {
            player.ChatMessage("Hello from your custom plugin!");
        }
    }
}

Drop this in oxide/plugins/ and it loads instantly. Players type /hello and get a message.

Hook System

Oxide provides hooks - events that fire when things happen in the game:

Player Hooks

void OnPlayerConnected(BasePlayer player)
{
    PrintToChat($"{player.displayName} joined the server!");
}

void OnPlayerDisconnected(BasePlayer player, string reason)
{
    Puts($"{player.displayName} left: {reason}");
}

object OnPlayerChat(BasePlayer player, string message)
{
    // Return non-null to cancel the chat message
    if (message.Contains("badword"))
        return false;
    return null;
}

Entity Hooks

void OnEntityBuilt(Planner plan, GameObject go)
{
    BaseEntity entity = go.ToBaseEntity();
    Puts($"Entity built: {entity.ShortPrefabName}");
}

void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
{
    if (entity is BasePlayer player)
        Puts($"{player.displayName} was killed");
}

Configuration Files

Add persistent configuration:

class MyPlugin : RustPlugin
{
    private Configuration config;

    class Configuration
    {
        public string WelcomeMessage = "Welcome to the server!";
        public int MaxHomes = 3;
        public float TeleportCooldown = 60f;
    }

    protected override void LoadDefaultConfig()
    {
        config = new Configuration();
    }

    protected override void LoadConfig()
    {
        base.LoadConfig();
        config = Config.ReadObject<Configuration>();
    }

    protected override void SaveConfig()
    {
        Config.WriteObject(config);
    }
}

This creates a JSON config in oxide/config/MyPlugin.json that server admins can edit.

Permissions

Integrate with Oxide's permission system:

void Init()
{
    permission.RegisterPermission("myplugin.use", this);
    permission.RegisterPermission("myplugin.admin", this);
}

[ChatCommand("mycommand")]
void MyCommand(BasePlayer player, string command, string[] args)
{
    if (!permission.UserHasPermission(player.UserIDString, "myplugin.use"))
    {
        player.ChatMessage("You don't have permission.");
        return;
    }
    // Command logic here
}

Data Storage

Save persistent data (survives server restarts):

private Dictionary<ulong, PlayerData> playerData;

class PlayerData
{
    public int Kills;
    public int Deaths;
    public List<string> Homes = new List<string>();
}

void Init()
{
    playerData = Interface.Oxide.DataFileSystem
        .ReadObject<Dictionary<ulong, PlayerData>>("MyPluginData") 
        ?? new Dictionary<ulong, PlayerData>();
}

void SaveData()
{
    Interface.Oxide.DataFileSystem.WriteObject("MyPluginData", playerData);
}

Testing

  1. Write your plugin on your local machine
  2. Upload to a test server's oxide/plugins/
  3. Watch the server console for compilation errors
  4. Test commands and hooks in-game
  5. Check oxide/logs/ for detailed error messages

Use a dedicated test server on Space-Node - the Stone plan (€10.20/mo) is perfect for development and testing.

Publishing

Share your plugin on umod.org:

  1. Create an account
  2. Submit your plugin with documentation
  3. Include configuration examples
  4. Respond to user feedback and bug reports

The Oxide/uMod community is active and appreciative of well-documented, well-tested plugins.

Space-Node Team

About the Author

Space-Node Team – Infrastructure Team – Experts in game server hosting, VPS infrastructure, and 24/7 streaming solutions with 15+ years combined experience.

Since 2023
500+ servers hosted
4.8/5 avg rating

Our team specializes in Minecraft, FiveM, Rust, and 24/7 streaming infrastructure, operating enterprise-grade AMD Ryzen 9 hardware in Netherlands datacenters. We maintain GDPR compliance and ISO 27001-aligned security standards.

View Space-Node's full team bio and credentials →

Launch Your VPS Today

Get started with professional VPS hosting powered by enterprise hardware. Instant deployment and 24/7 support included.

Rust Oxide Plugin Development for Beginners