SCP: Classified Site Plugin API
  • Quick Start
  • DOCS
    • Folder Structure
    • Creating Plugin Project
    • Creating New Player Class
    • Creating New Item Class
    • Creating New Room Event
    • Creating Additional Networked Class
    • Creating New Admin Panel Menu
    • Abilities
    • Replacing Game Logic
    • Plugin Classes/Game Classes Limitations
  • ID's
    • Inventory Image ID
    • Material ID
    • Team ID
    • Hook ID
  • Game C# Classes
    • ACES
    • AdminPanel
    • Button
    • Config
    • CustomLogger
    • DamageHandler
    • DeadBox
    • DoorManager
    • HitBox
    • HookManager
    • IInteractable
    • InputController
    • ItemPickup
    • Lever
    • NetRoom
    • NetworkedButton
    • NetworkedEvent
    • Player
    • PlayerUtilities
    • ResourcesManager
    • ScriptHelper
    • Trigger
    • UIManager
    • Door
    • SupportManager
    • RoundManager
    • Elevator
  • Another C# Classes
    • Rooms
    • Player Classes
    • Items
    • Admin Panel
Powered by GitBook
On this page
  • Class Functions
  • Local Properties
  • Local Functions
  • Example
  • Testing
  1. DOCS

Creating Additional Networked Class

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.

Class Functions

  • Init() - [OPTIONAL] class initialization.

  • Update() - [OPTIONAL] called every frame.

Local Properties

  • netEvent - return NetworkedEvent class.

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

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}");
        }
    }
}

Testing

Now we can compile this plugin and move library to server plugins folder according to Folder Structure Now we can connect to server and see our message:

PreviousCreating New Room EventNextCreating New Admin Panel Menu

Last updated 2 months ago

Example Solution can be downloaded here:

Link to archive