Sup beautiful people!
In my plugin I would like to check if InfoPanel is loaded and if any dock has been anchored to the top. I believe it should have something to do with InfoPanel.PanelConfig.Dock but I can't seem to get anywhere past successfully checking if the plugin is loaded with Oxide's plugin reference and if(InfoPanel).
If any one can explain to me how I might do this I would greatly appreciate it. I think I just need to get the value of the string Dock and see if it is "BottomDock" or "TopDock", then do stuff with it.
The plugin is here: InfoPanel for Rust | Oxide
Checking if InfoPanel is loaded and anchored at top
Discussion in 'Rust Development' started by JoeSheep, May 14, 2016.
-
You can always check the source code of other plugins when documentation is lacking, the Oxide source code itself is also fairly clean (Check this! Oxide/Oxide.Core/Libraries at 97ef5efb94fa001e08481bcbfba3029051f8f8fe · OxideMod/Oxide · GitHub)
p = plugins.Find("DeadPlayersList") returns a Plugin reference, to check whether it is loaded you can check if p isn't null and if p.IsLoaded is set.
To call a hook, use p.Call("HookName", <args>). -
I have been trying to do it reading through the source code of InfoPanel but I haven't managed to work out how to do it.
[DOUBLEPOST=1463949007,1463694068][/DOUBLEPOST]Sorry Sqroot but I still need a little more help with this if you are willing. -
You can use this to see if a certains players panel is loaded:
However I do not think there is a way to see if "Everyones" panel is loaded.Code:bool PlayerPanelLoaded(BasePlayer player) { var panel = plugins.Find("InfoPanel"); if(panel == null) return false; object isLoaded = panel?.Call("IsPlayerGUILoaded", new object[]{player.UserIDString}); if(isLoaded is bool) { if((bool) isLoaded) { return true; } else { return false; } } return false; } -
I just want to see if the InfoPanel plugin is loaded then check if any of those panels are docked at the top, if so then I will move my GUI down a little or shorten it.
-
Oh. If you want to know if its loaded you would do the "var panel" and if panel is null then its not loaded. Otherwise its loaded. Im not sure how to check the config if its defaulted at top. I would ask @Wulf
-
Well simply doing a plugin reference using oxides method then doing if(InfoPanel) checks if it is loaded or not.
-
Yeah that works of course.
