Skip to content
This repository has been archived by the owner on Sep 12, 2020. It is now read-only.
GrafDimenzio edited this page Jul 23, 2020 · 11 revisions

Events

We have 4 types of events

  1. MapEvents
  2. PlayerEvents
  3. ScpEvents
  4. ServerEvent

In order to use them add a Refrence using Synapse.Events at the top and hook the Events from the Events class that you need.

Basic Example:

using Synapse.Api.Plugin;
using Synapse.Events;

namespace Example
{
    [PluginDetails(
        Author = "Dimenzio",
        Description = "My Awesome First Plugin!",
        Name = "First-Plugin",
        SynapseMajor = 1,
        SynapseMinor = 0,
        SynapsePatch = 0,
        Version = "1.0.0"
        )]
    public class Example : Plugin
    {
        public override void OnEnable()
        {
            Log.Info("Hello");
            Events.PlayerJoinEvent += this.OnJoin;
        }

        private void OnJoin(PlayerJoinEvent ev)
        {
            //Here can you Execute code that will be activated when a Player join. In ev are all informations about the Event like The Player that joins = ev.Player

            Log.Info($"{ev.Player.Nickname} joined the server!");
        }
    }
}

If you understand it and maybe already test some Events you now want to add Configs to your Plugins to do it visit the Config Page

Clone this wiki locally