LoadDefaultMessages
LoadDefaultMessages is an Oxide plugin lifecycle method called when the plugin's language message dictionary should be populated with defaults. It runs during plugin initialization and is where you register fallback English strings via lang.RegisterMessages.
void LoadDefaultMessages()Return value
The method is declared void and the underlying Plugin.LoadDefaultMessages returns nothing, so any value your method returns is discarded. Do all work through side effects such as lang.RegisterMessages.
How it works
This is not a patched Rust game method; Oxide's own Plugin.LoadDefaultMessages calls the hook, and it returns void, so any value you return is ignored. It fires once per plugin load as part of Oxide's initialization sequence, before Init and before OnServerInitialized, so default messages exist before any player-facing code runs.
There are no parameters. Use the method to fill the plugin's language file with default entries through lang.RegisterMessages. Oxide writes those defaults to oxide/lang/en/<PluginName>.json (or the configured default language), so the strings become editable without recompiling. Server owners can overwrite entries per language file, and your runtime code should read them back with lang.GetMessage(key, this, userId).
Because it only runs at load time, register every key the plugin uses here. Missing keys return the key name itself at runtime rather than throwing, which makes debugging harder, so keep the dictionary complete. It is a private, parameterless method and cannot be narrowed or overloaded by type.
Example plugin: Register default chat messages for a welcome plugin
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
namespace Oxide.Plugins
{
[Info("Welcome Messages", "RustPluginGenerator", "1.0.0")]
[Description("Sends a configurable welcome message to players who hold the allow permission")]
public class WelcomeMessages : RustPlugin
{
private const string PermUse = "welcomemessages.use";
private PluginConfig config;
private class PluginConfig
{
[JsonProperty("Greeting text")]
public string Greeting = "glad to have you on the server";
[JsonProperty("Only show to permission holders")]
public bool RequirePermission = true;
}
protected override void LoadDefaultConfig() => config = new PluginConfig();
protected override void LoadConfig()
{
base.LoadConfig();
try
{
config = Config.ReadObject<PluginConfig>();
if (config == null) throw new Exception();
}
catch
{
PrintWarning("Configuration file is invalid, using defaults");
LoadDefaultConfig();
}
SaveConfig();
}
protected override void SaveConfig() => Config.WriteObject(config);
protected override void LoadDefaultMessages()
{
lang.RegisterMessages(new Dictionary<string, string>
{
["Welcome"] = "Welcome {0}, {1}.",
["WelcomeBack"] = "Welcome back {0}."
}, this);
}
private void Init()
{
permission.RegisterPermission(PermUse, this);
}
private string Msg(string key, string userId = null, params object[] args) =>
string.Format(lang.GetMessage(key, this, userId), args);
private void OnPlayerConnected(BasePlayer player)
{
if (player == null) return;
if (config.RequirePermission && !permission.UserHasPermission(player.UserIDString, PermUse))
return;
string text = Msg("Welcome", player.UserIDString, player.displayName, config.Greeting);
player.ChatMessage(text);
}
}
}The plugin registers one permission and a default message dictionary in LoadDefaultMessages. It uses {0} for the player name and {1} for a configurable greeting that the owner can edit in oxide/config. Init registers the permission, and OnPlayerConnected sends the welcome string only to players holding the permission. Msg centralizes the string.Format call and pulls the correct language file for each user. Because defaults are registered once at load, the message file is created automatically on first run and can be translated into other languages by adding files under oxide/lang.
Common use cases
Create editable language files
Register every user-facing string so Oxide writes
oxide/langfiles that owners can translate and tweak without editing the plugin.Localize permission-gated replies
Provide defaults for commands, warnings and permission denials so each player sees text in their configured language.
Version fallback strings
Ship updated default wording on load so new keys appear after an update even if the owner's existing language file lacks them.
Pitfalls
Do not read messages before this runs
Calling
lang.GetMessageearlier in the load sequence, or from config, sees no defaults; keep chat output to hooks that fire after initialization.Missing keys fail silently
lang.GetMessagereturns the raw key when the entry is absent, so an incomplete dictionary shows keys in chat instead of a clear error.Format placeholders must match
{0},{1}must line up with the arguments passed tostring.Format; a mismatch throws at runtime and drops the message.
Build a plugin with LoadDefaultMessages
Describe what should happen and get a compiled plugin that uses this hook.
Edit the prompt on the next screen. 2 free plugins a month, no card.
Last updated Oct 26, 2026. Found a mistake? Email support@rustplugingenerator.com.
Build a plugin with LoadDefaultMessages
Generate