Host scripting

Make your server feel like yours.

CaretakerMP hosts can add Lua resources without rebuilding the server. Start small: welcome messages, custom slash commands, crew markers, checkpoints, team chat, simple activities, world metadata, and light server-side rules.

LanguageLua
Folderresources
Server fileserver.lua
Client fileclient.lua

Ideas

What hosts can create.

Chat

Welcome and crew messages

Send a welcome message on join, add private group chat, or broadcast server notices during a session.

World

Markers and checkpoints

Place a harbor marker, create a checkpoint, or let players use a simple interaction point from the overlay or hook.

Rules

Light session rules

Use permissions, cooldowns, teams, activities, and world metadata to shape how your crew plays.

Events

Mission-style activities

Create activities with objectives, participant lists, activity chat, and progress updates for small co-op goals.

State

Player and entity labels

Set display names, tags, synced metadata, stream-synced metadata, inventory state, or entity names for UI and overlay use.

Bridge

Client-side helpers

Add optional client.lua helpers that run beside the Bridge for local UI glue, local commands, and server events.

Resource layout

Create one folder per script pack.

Folder

resources/
  my-crew-rules/
    resource.json
    config.json
    shared.lua
    server.lua
    client.lua

server.lua runs on the server. client.lua is optional and runs beside the Bridge when the server publishes client-safe resources.

resource.json

{
  "name": "my-crew-rules",
  "version": "1.0.0",
  "type": "server",
  "main": "server.lua",
  "sharedScripts": ["shared.lua"],
  "dependencies": []
}

The name should be lowercase and stable. Dependencies start before this resource.

Starter scripts

Small examples you can edit.

Welcome message and command

cmp.on("playerReady", function(player)
  player:sendChat("Welcome to the crew, " .. player.name .. ".")
  player:sendChat("Use /crewhelp for this server's custom notes.")
end)

cmp.registerCommand("crewhelp", {
  description = "Show this server's custom notes."
}, function(player)
  player:sendChat("Load the hosted save, stay near the harbor, and call out storms.")
end)

Good first script: no world changes, just a clear welcome and one custom command.

Marker and checkpoint

local harbor = { x = 0, y = 0, z = 0 }

cmp.on("resourceStart", function()
  cmp.createMarker({
    name = "harbor",
    kind = "waypoint",
    pos = harbor,
    data = { label = "Crew Harbor" },
    streamingRange = 250
  })

  cmp.createCheckpoint({
    name = "crew-terminal",
    pos = harbor,
    radius = 5,
    data = { label = "Crew Terminal" },
    cooldownMs = 1500
  })
end)

Markers and checkpoints are visible to Bridge client resources and the hook inbox when streamed.

Simple world metadata

cmp.registerCommand("stormmode", {
  description = "Set the crew world mood.",
  permission = "caretaker.world.manage"
}, function(player)
  cmp.setWeather("storm")
  cmp.setGameMode("crew-night")
  cmp.setServerData("motd", "Storm mode is active.")
  player:sendChat("Storm mode enabled.")
end)

World metadata is lightweight server state for labels, overlay UI, and future game-specific use.

Bridge client helper

cmp.log("my-crew-rules client helper loaded")

cmp.registerCommand("clientcrew", function(args)
  local world = cmp.world()
  cmp.log("Current weather: " .. tostring(world.weather))
  return true
end)

cmp.on("serverDataChange", function(key, value)
  cmp.log("Server data changed: " .. tostring(key))
end)

Client helpers are optional. They are useful for local UI glue and small convenience commands.

Install

Add scripts to your server.

01

Copy folder

Place your resource folder inside dist/windows-x64/resources or the custom resources folder selected in Server GUI.

02

Check scripts

Use Resource Check in Server GUI. Fix missing files, bad JSON, duplicate names, or missing dependencies before guests join.

03

Start or reload

Restart the server, or use the host resource controls to start, stop, restart, or reload Lua resources during a private session.

Windows folder

dist/windows-x64/resources/my-crew-rules/

If you use Server GUI, make sure the resources path points to the folder that contains your resource folders.

Linux folder

/opt/caretaker-mp/resources/my-crew-rules/

After copying resources to a Linux host, restart the service or use your host workflow to reload resources.

Tips

Keep private server scripts calm.

Small

Start with one behavior

One command or one marker is easier to understand than a huge rules pack.

Safe

Validate player input

Treat names, chat text, and command arguments as untrusted. Keep payloads short and readable.

Stable

Use Resource Check

Check every resource before guests join. It catches common folder, manifest, and dependency mistakes.

Clean

Keep secrets out

Do not place passwords, personal save files, game files, extracted assets, or private keys inside resource folders.

Clear

Name commands plainly

Use clear command names like /crewhelp, /harbor, or /stormmode.

Share

Package after checking

When the server works, use Friend Pack so players receive the clean release folder and current resources.