Triggering Events in C#

Hello,

If I was to create a DLL and add it as a client script is it possible to send events to/from it so that data can be passed freely between the DLL and the server-side script?

If so, what’s the easiest way around this?

Scott

To listen for events

EventHandlers["playerSpawned"] += new Action<dynamic>(methodName)

To trigger events

TriggerServerEvent("test");
TriggerEvent("test");
1 Like

Mr.Scammer, is there a way to accept parameters in an event you are listening for? I need to send a player id (database side) from the lua server script to the client dll script?

EventHandlers["event"] += new Action<string, int, int>(MyAction);

private void MyAction(string p1, int p2, int p3) {
    ...
}
1 Like

Thank you so much! Means a lot

EventHandlers can’t be found, closest is systems EventHandler but that still isn’t working.

1 Like

Wow. Way to dig up an old post.

EventHandlers[“event”] += new Action<string, int, int>(MyAction) needs to be in your constructor.

No he is someone who searched the forums for a solution to his problem and found this forum topic, next time why don’t you just offer your help instead of snide comments and if you can’t offer any help just don’t say anything. There is enough of that already on this forum…

3 Likes

Except I did offer help after my comment. You should have read my post.

1 Like