Synapse
Search…
Events
If you want to execute your code when something happen you can hook a method to an Event.
In order to do this you need the use the EventHandler object which you can get with SynapseController.Server.Events or Synapse.Api.Events.EventHandler.Get
In this object are different types of Events:
  • Server => All Events which has something to do with the Server
  • Player => All Events which has something to do with a Player
  • Round => All Events which has something to do with the Round
  • Map => All Events which has something to do with the Map
  • Scp => All Events which has something to do with the Scp's.
Example:
1
using Synapse.Api;
2
using Synapse.Api.Plugin;
3
4
namespace FirstPlugin
5
{
6
[PluginInformation(
7
Name = "FirstPlugin",
8
Author = "Dimenzio",
9
Description = "My First Awesome Plugin",
10
LoadPriority = 0,
11
SynapseMajor = 2,
12
SynapseMinor = 7,
13
SynapsePatch = 0,
14
Version = "v.1.0.0"
15
)]
16
public class PluginClass : AbstractPlugin
17
{
18
public override void Load()
19
{
20
Logger.Get.Info("Hello World");
21
SynapseController.Server.Events.Player.PlayerLeaveEvent += OnLeave;
22
}
23
24
public void OnLeave(Synapse.Api.Events.SynapseEventArguments.PlayerLeaveEventArgs ev)
25
{
26
Map.Get.SendBroadcast(5,"A Player left the Server");
27
}
28
}
29
}
Copied!
Next step is to look into:
Copy link