PDA

View Full Version : Custom plugin events


Kailo
04-08-2015, 13:54
How in SM create own events for plugin? Source Engine plugins can do it, but i don't find it in SM.

P.S. Yes, i search for it, but don't find answer. Now try understand how to write extension.

Miu
04-08-2015, 15:16
why not just use forwards?

Kailo
04-08-2015, 15:44
Need not only say what action was happen. Need to have the possibility to block event in another plugin. If you say how do it with forwards be nice. But i think that events be more easy because need only add native based on existing function.

KissLick
04-08-2015, 15:54
https://wiki.alliedmods.net/Function_Calling_API_%28SourceMod_Scripting%2 9

Miu
04-08-2015, 15:56
I'm not sure what you want, but callbacks will be able to stop the forward by returning Plugin_Stop if you create the forward with ET_Hook if that's what you mean, more info here (https://wiki.alliedmods.net/Function_Calling_API_%28SourceMod_Scripting%2 9#Forwards)

Kailo
04-08-2015, 16:11
Ok, try to explain you what i want do.
I have some function in plugin: example: give specific grenade set.
I did function that fire my event. I name it Laucher.
I did Event hook in Postmode for it event that fire my function.
I can in another plugin hook this event in pre mode and block it or change data thet passed via event.
Then i want use my function i call the Launcher.

Miu
04-08-2015, 17:28
I think you should be able to do that if you create it with ET_Hook and pass arguments by reference