This article explais how to create an addon for GExtension.
See Code Structure for information about how GExtension is coded. IMPORTANT!
The folder structure is similar to the one of Garry's Mod. First, you should create a folder: "addons/[your-addon]"
That's your main addon folder, where all files of your addon should be in. Additionally, you can create the following subfolders:
The meaning and function of those folders are explained in extra articles, click on a subfolder to get there. Please try to imitate the folder structure of the GExtension core files.
Extending Existing Pages
It's possible to extend existing files. If there are two files with the same name, for example "pages/search.php" and "addons/[your-addon]/pages/search.php", the original file will be included and the addon file afterwards. This can be used to extend for example pages or language files.
Additionaly to the subfolders named above, the main addon folder can contain some more files:
- addon.txt: Optional. Contains a json object with information about the addon, important at the moment are, "author" and "version".
- install.php: Optional. If existent, gives the user the ability to run a one-time setup to complete the addon installation. Possible by navigating to Admin -> Settings -> Addons. Must contain a function Install() that returns true/false. The process will create an file called named installed.txt in the main addon folder, containing the date of the installation and the steamid64 of the user who ran it.
- uninstall.php: Optional. If existent, this script will be run when the addon gets uninstalled (by navigating to Admin -> Settings -> Addons). Should be used to remove any leftovers. Must contain a function Uninstall() that returns true/false.