1. 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);
    }
     
    Last edited by a moderator: Jul 30, 2015
  2. Did you find out a solution?
     
  3. 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!
     
  4. 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

    Code:
    for (var p = 0; p < global.BasePlayer.activePlayerList.Count; p++) {
        ...
    }
    I implemented a loop like this but haven't been able to test thoroughly yet.