Skip to content

Quick start

Plugin API 1.0 uses Lua 5.4.8. You only need a UTF-8 text editor, a ZIP tool that creates portable / entry names, and SA-MP Android for testing.

Create the files

Create an empty directory with these two files:

text
hello-plugin/
├─ manifest.json
└─ main.lua

manifest.json:

json
{
  "schemaVersion": 1,
  "id": "com.example.hello",
  "name": "Hello Plugin",
  "version": "1.0.0",
  "apiVersion": "^1.0",
  "entry": "main.lua",
  "description": "A minimal SA-MP Android plugin.",
  "activationMode": "immediate",
  "permissions": [],
  "contexts": ["multiplayer"],
  "author": {
    "name": "Your Name"
  }
}

main.lua:

lua
samp.log.info("loaded " .. samp.plugin.id)

samp.events.on("player.spawned", function(event)
    samp.log.info(
        "spawned in session " ..
        samp.format.number(event.sessionId, 0)
    )
end)

Package the plugin

Archive the contents of hello-plugin, not the directory itself. Rename the resulting ZIP archive to hello-plugin.splug. Opening the archive must show manifest.json directly at its root.

TIP

You can also use the official Plugin Tools CLI. Run samp-plugin pack hello-plugin to validate and package your plugin automatically. The repository also contains example plugins for reference.

Install and test

  1. Open Resources → Plugins → Import.
  2. Select hello-plugin.splug.
  3. Review the plugin details and enable it.
  4. Start or join a multiplayer session.
  5. Check the plugin status or game log for the loaded message.

Every change to an already installed package must use a new plugin version. The same ID and version cannot be replaced with different contents.

Next steps