Anyone find a way to loop through BasePlayer.activePlayerList using Javascript?
I attempted the following but it does not seem to be working. Any ideas?
Code:var global = importNamespace(""); for (var player in global.BasePlayer.activePlayerList) { var steamId = rust.UserIDFromPlayer(player); print(steamId); }
Looping global.BasePlayer.activePlayerList
Discussion in 'Rust Development' started by kpkody, Jul 30, 2015.
-
Did you find out a solution?
-
Nope. All other collections work fine. So, I ended up keeping my own list in memory as people join and leave. It's a bit hacky but totally works!
-
Okay. Somewhere I read that `BasePlayer.activePlayerList` is actually a C# `List` so it can't be looped like a normal JS collection. Did you try using
I implemented a loop like this but haven't been able to test thoroughly yet.Code:for (var p = 0; p < global.BasePlayer.activePlayerList.Count; p++) { ... }
