# How the Legacy Space Engineers Vanilla Integration Works

> ⚠️ **This guide is for legacy use only.**\
> For the latest and easiest setup, we recommend the [current Tebex Vanilla plugin](https://creator.tebex.io/game-servers) and our TorchAPI version.

***

### Overview

The legacy Tebex plugin for **Space Engineers Vanilla** allows you to reward players without relying on console commands — giving you flexibility when building custom server experiences.

You can integrate Tebex in two ways:

1. **Using the Companion Plugin**: Trigger prebuilt reward commands like `!giveitem` and `!givemoney`.
2. **Creating a Custom Plugin**: Listen for purchase events and write your own logic.

***

### Tebex Event Communication

The main plugin (`TebexSE.dll`) notifies your server of incoming purchases via:

* An **event**:\
  `TebexSE.TebexSE.tebexPurchaseEvent.TebexPurchaseReceived`\
  (Recommended for plugin developers)
* A **chat message** in the `GlobalScripted` channel\
  (Use this for modding or scripts that respond to chat)

***

### Option 1: Use the Companion Plugin

We provide a prebuilt plugin that supports several basic reward commands:

#### Available Commands

> Replace anything in `[square brackets]` with actual values. Keep `{id}` as-is — it auto-inserts the Steam64 ID of the purchaser.

```plaintext
!giveitem {id} [ItemID] [Amount]         // e.g. !giveitem {id} Ingot/Iron 10
!givemoney {id} [Amount]                 // e.g. !givemoney {id} 1000
!reserveslot {id}
!unreserveslot {id}
!rank {id} [RankName]                    // e.g. !rank {id} Scripter
!say [Message]                           // e.g. !say Thanks for your purchase
```

#### Download

Get the companion plugin from GitHub:\
[**Tebex-SE-Consumer on GitHub**](https://github.com/tebexio/Tebex-SE-Consumer)

> 💡 This is the fastest way to get started. You can also extend this plugin with your own commands (see below).

***

### Option 2: Create a Custom Plugin

To build your own reward system, subscribe to the Tebex purchase event and handle the received command.

#### Example Code Snippet

```csharp
csharpCopyEdit// Called by Space Engineers when the server is ready
public void Init(object gameInstance) {
    TebexSE.TebexSE.tebexPurchaseEvent.TebexPurchaseReceived += TebexPurchaseEvent_TebexPurchaseReceivedHandler;
}

private void TebexPurchaseEvent_TebexPurchaseReceivedHandler(string details) {
    if (details.StartsWith("!myplugin")) {
        // Handle your custom command
    }
}
```

#### Integration Notes

* Add `TebexSE.dll` as a reference in your plugin project.
* Commands from Tebex are passed **as strings**, so it’s up to you to **parse and process them** appropriately.

***

### Extending the Companion Plugin

Prefer modifying instead of starting from scratch? Extend the [Tebex-SE-Consumer](https://github.com/tebexio/Tebex-SE-Consumer):

* Update the plugin references:
  * DLLs from your **Space Engineers server**
  * `TebexSE.dll` from your **Tebex control panel**

This lets you add new commands or logic without rewriting the whole system.

***

### Academy Video

{% embed url="<https://www.youtube.com/watch?v=MuY6sSo9Ubw>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tebex.io/creators/tebex-control-panel/game-servers/space-engineers/how-the-space-engineers-vanilla-integration-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
