# Creating Additional Networked Class

{% hint style="warning" %}
All Additional Networked classes must be placed under namespace **Plugin.Additional**\
Additional Networked classes use same logic as Room Event classes, because have same logic and spawns every time, unlike room classes, which require the room to exist.\
Don't forget to add class name to **MustSpawnClasses** array in **Plugin Info**.
{% endhint %}

### Class Functions

* Init() - <mark style="color:green;">\[OPTIONAL]</mark> class initialization.
* Update() - <mark style="color:green;">\[OPTIONAL]</mark> called every frame.

### Local Properties

* netEvent - return NetworkedEvent class.&#x20;

### Local Functions

* SendToEveryone(string FunctionName, params object\[] arguments) - send command to every player to call function with arguments.
* SendToClient(string FunctionName, NetworkConnection connection, params object\[] arguments) - send command to player with connection to call function with arguments.
* SendToServer(string FunctionName, params object\[] arguments) - send command to server to call function with arguments.
* Invoke(Function, float seconds) - same logic as UnityEngine.Object.Invoke, call function after time.

### Example

```csharp
using UnityEngine;

namespace Plugin.Additional
{
    public class TestCommunication : Akequ.Base.Room
    {
        public override void Init()
        {
            if (netEvent.isClient)
            {
                SendToServer("GetFromClient", "Test");
            }
        }
        
        public void GetFromClient(string someData, Mirror.NetworkConnectionToClient conn)
        {
            Debug.Log($"Got From Client: {someData}");
            SendToClient("GetFromServer", conn, "Test", 35);
        }
        
        public void GetFromServer(string data, int secData)
        {
            Debug.Log($"Got From Server: {data}, {secData}");
        }
    }
}
```

Example Solution can be downloaded here:\
[Link to archive](https://drive.google.com/file/d/1ijE_9o59W3Cpne86GQN3479spnhbinYT/view?usp=sharing)

### Testing

Now we can compile this plugin and move library to server plugins folder according to [Folder Structure](/scp-classified-site-plugin-api/docs/folder-structure.md)\
\
Now we can connect to server and see our message:

<figure><img src="/files/CuneqJbYv0XyvjJHbIKd" alt=""><figcaption></figcaption></figure>


---

# 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://akequ.gitbook.io/scp-classified-site-plugin-api/docs/creating-additional-networked-class.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.
