9/9/2023 0 Comments Eventscripts sourceMain article: Natives (SourceMod Development) You should now be able to compile a blank extension! Make sure you do not add any trailing spaces at the end of the name, or the build won't come out right. Most of the time, an extension exists to add "native functions" to the plugin system. Native functions are simply the functions that plugins can use in SourceMod. They are coded in C++ and have a short prototype declaration in an include file. ![]() The first step to creating a native is to spec it, or prototype it. Here is a prototype for it, which we will place in sample.inc: This is a simple but often time consuming process, but if you get in the habit of it, your documentation will be much better. The native keyword tells the compiler that this function exists in an outside source. The comment style is similar to doxygen or Javadoc, and is preferred by the SourceMod Development Team. The prototype for this function looks like:Ĭell_t Function (IPluginContext *pContext, const cell_t *params ) Now that our function is documented, it's time to create it! Each native function is bound to a C++ function. cell_t - This is a 32bit signed integer, the generic data type for Pawn.IPluginContext - This interface provides Virtual Machine functions for retrieving or modifying memory in the plugin.params - This is the "stack" of parameters that the plugin passed.This means params contains the number of arguments passed to the native. For example, if one parameter was passed, and the parameter is 25. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |