Ok, so I'm trying to make a status plugin, I see this example...
But how do I get the list of plugins on the server? Ideally I'd like the player to be able to do /status, and I can include server FPS, their playtime, and a list of plugins.Code:{ if(!PopupNotifications) { Puts("PopupNotifications is not loaded! http://oxidemod.org/plugins/popup-notifications.1252/"); } }
Getting server plugin list?
Discussion in 'Rust Development' started by Kappasaurus, Jul 25, 2016.
-
Checkout the plugin Updater for support.
-
Must be possible somehow. -
-
I wouldn't recommend looping through them if you don't need to access all of them. When referencing another plugin in a C# plugin there are different options to use. The easiest one would be using the attribute PluginReference which is a reference to that specific plugin which is managed by the Oxide core. So when the plugin is loaded the reference is created and when the referenced plugin is unloaded the reference would be destroyed without actually having to handle any of these things.
The PluginReference attribute is easy to use, you basically declare a Plugin variable at the global scope of your plugin which will then automatically get the value of the referenced plugin to be able to call methods in that plugin.
Another option would be using the plugins.Find("pluginname") method which basically does the same as the PluginReference only this is something you need to manage yourself (this is basically used in plugins written in js, lua and python as those do not have the PluginReference attribute).
I have an example on this in the overview of the DeadPlayersList plugin which you can find here: DeadPlayersList for Rust | Oxide
I recommend downloading the plugin and having a look, or even run the example to see how exactly it works. If you would need more information you can always reply and I'll try to help out as soon as I can.
If you do in fact need every plugin then looping the plugins list you obtain from plugins.GetAll() is the only option.