I am trying to get the steamid of every player that joined to my server.
I know it is saved on a sort of db but I have know idea where to loop and if it is accesible from plugins.
Something like this.
Code:foreach (var data in userdatabase) { Puts(data.UserIDString); }
Solved Get steamid from every player
Discussion in 'Rust Development' started by Reynostrum, Aug 4, 2016.
-
Are you saying userdatabase is like: storage.db in your server files? I don't think that itself is readable by a plugin. I'd say your best bet is to create a dictionary when a player joins or a SQL data base. There might be a way to read the .db though.
-
Wulf Community Admin
Oxide stores player data when players connect in the oxide.covalence.data though, which you can access using Oxide's API. There are also plugins that handle this. -
-
Code:
foreach (var entry in covalence.Players.GetAllPlayers()) { Puts(entry.ToString()); }
-
Will check out your code as i'm assuming you mean has ever joined the server, which is a good question. Here's code that gives sleeping and active player list
Code:var Sleeping = BasePlayer.sleepingPlayerList as List<BasePlayer>; foreach( BasePlayer player in Sleeping) { //do something with player.userID }
Code:var Active = BasePlayer.activePlayerList as List<BasePlayer>; foreach( BasePlayer player in Active) { //do something with player.userID }
-
Wulf Community Admin
[DOUBLEPOST=1470333147,1470333128][/DOUBLEPOST] -
Solved
Code:foreach (var entry in covalence.Players.GetAllPlayers()) { string permisos = string.Join(", ", permission.GetUserPermissions(entry.Id.ToString())); if (String.IsNullOrEmpty(permisos)) continue; string usuario = entry.Name.Replace("'", ""); Usado(usuario, entry.Id, permisos); }