public class Example : Synapse.Plugin
public override void OnEnable()
//As Soon as the Player join and his Components can be added start the method LoadComponents
Events.LoadComponentsEvent += LoadComponents;
private void LoadComponents(Synapse.Events.Classes.LoadComponentsEvent ev)
//Check if the Component somehow already exist
if (ev.Player.GetComponent<ComponentExample>() == null)
//If not add the Component to the player
ev.Player.AddComponent<ComponentExample>();
//Change The value for this One specific Player
ev.Player.GetComponent<ComponentExample>().my_Variable_i_want_to_store = "Yea i can change it!";
//Start this method for this One specific Player
ev.Player.GetComponent<ComponentExample>().SayMyVariable();
public override string GetName => "YourPluginName";
public class ComponentExample : MonoBehaviour
//A Variable every Player gets when he joins
public string my_Variable_i_want_to_store;
// A Method which is called when the Components gets added
my_Variable_i_want_to_store = "Hello World";
Log.Info(quot;My Awesome Component from Player : {this.gameObject.GetPlayer().NickName} was added :D");
//Hook a Event in this Player
Events.ConsoleCommandEvent += OnCommand;
private void OnCommand(ref ConsoleCommandEvent ev)
//Checks if the Command Author is the Player of this Component
if (ev.Player == this.gameObject.GetPlayer())
//Return the Value of this Component
if (ev.Command.ToLower() == "myvalue")
ev.ReturnMessage = my_Variable_i_want_to_store;
//A Method which will activate when the Components get Removed (player leave in this case most likely)
Log.Info(quot;My Awesome Component from Player : {this.gameObject.GetPlayer().NickName} was removed D:");
//Remove the Event so that no Errors will occure because this object does no longer exist
Events.ConsoleCommandEvent -= OnCommand;
//A Method which gets the gameobject from this Component to find out the name and say something in the Console
public void SayMyVariable()
Log.Info(quot;{this.gameObject.GetPlayer().NickName} want to say: {my_Variable_i_want_to_store}");