There are common methods that I include in most of my plugins, for example :
etc.Code:bool IsAdmin(BasePlayer player) { return player.net?.connection?.authLevel >= 1; }void Message(BasePlayer player, string theMessage) { PrintToChat(player, theMessage); Puts("Player [" + player.displayName + "] received message : " + theMessage); }
Where is the best place / best practices in Oxide to put stuff like this, so these methods can be called by all my other plugins?
Thanks in advance! :]
Solved Where to put common utility methods?
Discussion in 'Rust Development' started by NOP, Jan 10, 2017.
-
Wulf Community Admin
Rust already has an IsAdmin() helper, so there isn't really a need for the >= 1 check unless you want to have moderators showing as admin.
Otherwise, you could make an Ext.FileName.cs under the oxide/plugins/includes folder and then reference that with your plugin.
The most common practice for public plugins is to use them in each plugin though, but for private plugins using the above method would be better most likely to avoid duplication. -
Perfecto! Thanks.
I use the FauxAdmin plugin, and give everyone on my server FauxAdmin, so they can use real NoClip, and God Mode. That's why I replace all player.IsAdmin() calls with IsAdmin(player)