bureaupasob.blogg.se

List sourcemod plugins
List sourcemod plugins







  1. List sourcemod plugins how to#
  2. List sourcemod plugins code#

List sourcemod plugins how to#

So how to write a correct callback for it? Firstly, our callback must have the same name, so it's OnPluginStart, secondly, our callback should have the same number of arguments, none in this case, and lastly, SourceMod needs to be able to call our callback so it needs to be public. * SourceMod guarantees that plugin shutdown automatically and correctly releasesĮmpty parentheses tells us that no arguments are passed inside this forward, inside documentation tells us that we don't have to return anything, pretty simple forward. * It is not necessary to close any handles or remove hooks in this function. * If any run-time error is thrown during this callback, the plugin will be marked This is only called once in the lifetime of the plugin, and is * Called when the plugin is fully initialized and all known external references It is declared inside sourcemod.inc, a file we are already familiar with, let's find it: To do that, we'll have to look up the declaration of OnPluginStart. As you may have guessed, it is called when our plugin starts. So let's implement OnPluginStart forward.

List sourcemod plugins code#

As you can see, forwards are the only way to get our code executed, keep that in mind. SourceMod declares a plenty of interesting forwards that we can implement. When a first party starts a forward call, all parties that have matching callbacks receive the call. Forwards are function prototypes declared by one party that can be implemented by another party as a callback. So how do we make SourceMod call our code? For this exact reason we have forwards. After reading that, you may probably want to just define some function, name it main probably, compile and load a plugin and see that your code never gets called. SourcePawn, unlike other scripting languages like Lua, does not allow a code to be outside of functions. You might be tempted to just start writing a code after myinfo declaration just to see that it will not compile. However, there is one problem - it does nothing. We now have a perfectly well formed plugin which can be compiled and loaded by SourceMod. We already include SourceMod features and filled up or plugin info. When SourceMod loads your plugin, it inspects these bits of code and substitutes it's own internal functions instead. Compiler understands that and generate a special code that says that this function call is going outside. So how does your SourcePawn code and SM core link together if compiler doesn't know about existence of the latter? SourceMod include files are written specially, so they say that the implementation of functions is somewhere else. You will notice however, that there's not much code in there, certainly not enough to implement all the great features of SourceMod, so where are they? They are implemented inside a SourceMod core which is written in C++ and is compiled into binary files which end up in bin directory. The files are plain-text and you are encouraged to read them. Those are SourceMod include files that describe various functions, tags and other features available for SourceMod plugins. You can open it right now and see a lot of inc files there. Angle brackets tell the compiler to look in the default include directory. How does this work? First of all, note that we enclosed file name into angle brackets.









List sourcemod plugins