Skip to content

Menus and HUD

Rich text

Reply, Broadcast and menu texts accept the rich text tags Oxide authors know from Unity: <b>bold</b>, <i>italic</i>, <u>underline</u>, <s>strike</s>, <color=#ff8800>colour</color> (or a colour name: <color=orange>), <size=20>size</size> (8 to 40). Any other tag is shown as typed, so a player’s name cannot inject anything. [Name] is added in front of every line in the plugin’s colour.

Buttons, keys and menus

Players never run plugin code: a button, a key or a menu entry runs one of the plugin’s chat commands, with the same rights as typing it. So a plugin only has to write its commands, then point buttons at them.

public override void OnPlayerConnected( RustPlayer player )
{
SetButton( player, "shop", "Shop", "/shop", 4 ); // inventory screen + Server plugin key 4
}
void OnShop( ChatCommand cmd )
{
var menu = new PluginMenu { Title = "Shop", Text = "Pick a <b>kit</b>." };
menu.Buttons.Add( new PluginMenuButton { Label = "Starter", Command = "/shop starter", Item = "Stone Hatchet", Group = "Kits" } );
menu.Buttons.Add( new PluginMenuButton { Label = "Kevlar", Command = "/shop kevlar", Item = "Kevlar Vest", Group = "Kits" } );
ShowMenu( cmd.Player, menu );
}
PluginMenu
Title, Text, Image Window title; text under it (rich text); a banner image above the text
Buttons PluginMenuButton: Label, Command, Image (icon from an image address) or Item (icon of that item), Group (heading; consecutive buttons with the same group sit under it), Selected (highlighted)
Search A search box that filters the buttons (long lists)
KeepOpen The window stays open after a click (Give uses it to give several items)

Buttons, menus, HUD texts and markers are removed when the plugins restart: set them again in OnLoaded (for the players already there) and OnPlayerConnected.

Images

Menus (Image of a menu or a button), HUD texts (image) and chat tags (SetChatTag‘s icon) can show a picture from the web: an https:// address on one of these image hosts, which every player’s game accepts: i.imgur.com, cdn.discordapp.com, media.discordapp.net, raw.githubusercontent.com, avatars.githubusercontent.com, user-images.githubusercontent.com and rustlegacy.io. Any other address is ignored. The list is fixed in the game: connections go through Steam’s relay so a server never learns its players’ IP addresses, and an image on the server owner’s own website would give them away. Upload a logo to Imgur or a Discord channel and copy the image’s address.