allPlayers can be delayed on a dedicated server, causing issues for mods and missions that rely on it and expected it to be reliable.
Description
Details
- Severity
- Major
- Resolution
- Open
- Reproducibility
- Random
- Operating System
- Windows 10 x64
- Category
- Scripting
- Start mission on a dedicated server.
- Observe allPlayers vs call BIS_fnc_listPlayers after briefing ends.
- Possibly repeat steps a few times.
Wiki only states that
In a player-hosted game, the complete array of allPlayers may get delayed on mission start. Use BIS_fnc_listPlayers if you need it earlier.
Which, would imply that it should be reliable on a dedicated server, however I recently ran into an issue on a dedicated server where allPlayers wasn't returning all of the players for a bit after mission start.
Mission used to confirm issue, both with and without mods:
Test mission usage:
- Confirm "postInit: [] != [p0]" is shown in briefing.
- Wait for "postInit: [p0] == [p0] after X seconds" after mission start.
- If seconds is < 1, restart mission and try again.
Screenshot of result on a modded dedicated server.
Screenshot of result on a locally hosted non-modded dedicated server.
Event Timeline
Thanks for updating the wiki to reflect these findings, however I reported it to the issue tracker in hope that it could be fixed.
I was not able to replicate this issue with getUserInfo, it consistently returns the player object in a spawn on postInit.
could you provide 2 scripts side by side one using allplayers and one using getuserinfo doing the same thing but allplayers failing?