If there a new method to finding all online players? For some reason my some of my plugins that look in the online list doesn't find everyone anymore. And I was using FindPlayer();
I had to do this for now
Code:using System; using System.Collections.Generic; using Oxide.Core.Libraries.Covalence; using System.Linq; using Oxide.Core.Plugins;namespace Oxide.Plugins { class TestPlugin : CovalencePlugin { HashSet<IPlayer> ActivePlayers ; void Init() { ActivePlayers = new HashSet<IPlayer>(players.Connected); } } }
Solved Getting all connected IPlayers?
Discussion in 'Rust Development' started by Austinv900, Oct 22, 2016.
-
Wulf Community Admin
Use players.Connected, it contains them all. You can also use the IPlayer.IsConnected() check. Both of these haven't changed. Not sure why you're trying to add them to a HashSet though...
-
So does that mean FindConnectedPlayer is gone
lol
Nothing to replace it besides making a lookup ourselves? Challenge Accepted and complete! -
Wulf Community Admin
FindPlayer + IsConnected is much more reliable than FindConnectedPlayer was. -
I could see that. I had one issue doing a lookup in chat. Some of the players are coming back null doing the FindPlayer way.
[DOUBLEPOST=1477110299][/DOUBLEPOST]IPlayer target = players.FindPlayer(arg[0]);
Only seemed to work if the exact steamid was entered.
[DOUBLEPOST=1477110380][/DOUBLEPOST]and doesn't work by name lookup
[DOUBLEPOST=1477110457][/DOUBLEPOST]Multiple matches return null. Ok I see it now.
