Good day gentleman,
could somebody give me a hint on how to read the content of the ../server/../cfg/bans.cfg file?
As far as i know the "DataFileSystem.ReadObject<>()" only works for files located in /server/../oxide/data/.
And classic line by line reading of the file is not possible as i am not allowed to reference libaries needed for that in a plugin.
Thanks for reading.
kind regards
*edit*
Please dont tell me its something like hooking the console output/print and running "global.banlistex".
[DOUBLEPOST=1453728263,1453482296][/DOUBLEPOST]*push*
Nobody has any idea on how to do that, or done it before?![]()
Solved Reading bans.cfg within a plugin?
Discussion in 'Rust Development' started by vitamin.z, Jan 25, 2016.
-
You can not read files as the System.IO namespace is blacklisted for plugins. It can only be accessed using Extensions. You might find a list of bans in the code. You should search for that.
-
Wulf Community Admin
The only way you'd be able to read it is using the functions that the game provides for reading it. I don't know them off hand, but you can use a .NET decompiler and the Assembly-CSharp.dll to find where it reads them.
-
Thanks Wulf! That was the hint i needed!
And Hydra you might have given a tip in the same direction but i was too dumb to get the hint. Sorry.
Code for anyone interested:
Code:List<ServerUsers.User> bansCFG = ServerUsers.GetAll(ServerUsers.UserGroup.Banned); foreach (ServerUsers.User tmpUser in bansCFG) { Puts(tmpUser.steamid.ToString() + " | " + (string)tmpUser.username + " | " + (string)tmpUser.notes); }
-
The important thing is that you got it now.
I am sick and my brain is not completely working
Also Wulf can explain stuff better anyways