AddCommand( "name", cmd => ..., "help", adminOnly, "args" ) |
Chat command /name. cmd.Player typed it, cmd.Args holds the words after it, cmd.Arg( 0 ) the first one in lower case (“” if missing). It shows in /help and in the chat’s suggestions while typing, with args (for example "join | leave") |
After( seconds, () => ... ), Every( seconds, () => ... ) |
Run code later, once or repeatedly |
Reply( player, text ), Broadcast( text ) |
Chat line for one player, or everyone, starting with [Name]. Rich text: see below |
Puts( text ) |
Line in the server console |
Players, FindPlayer( nameOrSteamId ) |
Connected players |
Give( player, "M4", 1 ), GiveKit( player, "kevlar" ) |
Items by their name in the admin menu; kits of the admin menu (starter, kevlar, builder, raider, mining, research, medical, resources) |
SaveInventory( player ), RestoreInventory( player, saved ) |
Copy an inventory and put it back. The copy can go in your data file |
Respawn( player ) |
Respawn a dead player now, without a sleeping bag |
IsAdmin( player ) |
The host of a lobby, or an admin of the dedicated server (admin claim in users.json, or made admin from Admin > Players). Commands with adminOnly use it. The server owner can also reserve a whole plugin for admins (rl_plugins_admin_only, section 1) |
SetButton( player, "id", "label", "/command", key ), RemoveButton( player, "id" ) |
A button in the player’s inventory screen that runs a chat command. key 1 to 4 also binds it to Server plugin key N (0: no key). Same id again: the button is updated (its label can show a state, “Fly: ON”) |
ShowMenu( player, menu ), CloseMenu( player ) |
A window with buttons, see below |
SetFly( player, on ) |
Fly like an admin (it stops at death). player.IsFlying tells the state |
SetFrozen( player, on ) |
Freeze a player: they cannot walk or jump, they can still look, shoot and talk (jail, AFK check, an admin’s freeze). player.IsFrozen tells the state. Released when the plugins restart |
SetChatTag( player, "[VIP]", "#ffcc00", "star", "Supporter" ) |
A tag before the player’s name in the public chat, for everyone (a group, a clan), with an optional icon before it: the name of a Material icon ("star", "verified", "gavel"), in the tag’s color, or an image address (see Images). Admins already have a shield; an icon replaces it. The last value is the icon’s tooltip, the tag by default; give one to a tag that is just an icon: SetChatTag( player, "", "#ffcc00", "star", "VIP" ). "" for both removes it. Removed when the plugins restart: set it again in OnLoaded and OnPlayerConnected |
SetHudText( player, "id", text, corner, image ), RemoveHudText( player, "id" ) |
Rich text on the player’s HUD, in a corner: topleft, top, topright (default) or right, with an optional image above it (see Images). Same id again: replaced. Update it from a timer (Every) to show a score or a distance |
SetMarker( player, "id", position, label ), RemoveMarker( player, "id" ) |
A marker on a point of the world: its label and ground distance float over the point (at the screen’s edge when it is out of view), with a flag on the map (G). Same id again: moved |
Meters( a, b ), Compass( from, to ), MapCell( position ) |
Ground distance in meters; direction on the game’s map (“north-east”); map square (“F7”) |
RegisterPermission( "kits.vip" ) |
Declare a permission of your plugin (listed by rl_perm list) |
HasPermission( steamId, "kits.vip" ) |
May this player use it? Admins may use everything |
InGroup( steamId, "vip" ), GroupsOf( steamId ), AllGroups |
Groups of a player, all groups |
CreateGroup( "vip", parent ), AddToGroup( steamId, "vip" ), RemoveFromGroup( ... ) |
Manage groups (saved at once) |
GrantPermission( groupOrSteamId, perm ), RevokePermission( ... ) |
Manage permissions |
PlayerCount, MaxPlayers |
Players connected and slots of the server |
LoadConfig<T>() |
Settings from plugins/config/<Name>.json, written with T’s defaults the first time |
SaveConfig( config ) |
Write the settings back (an admin changed them in game) |
LoadData<T>(), SaveData( data ) |
Your data in plugins/data/<Name>.json, kept across restarts: scores, positions, each player’s settings (Airdrop keeps what every player chose to see). T is a class of your file with properties { get; set; }; lists and dictionaries work |
Scene, Name |
The server’s scene, and the plugin’s name |