[C#] New PlayerList syntax?

Hello,

Today I have decided to rewrite my old code and I’m stuck at the PlayerList class, the code is from 2018 so it no longer seems to be “var player = new PlayerList();”
Sample code: asdf.cs · GitHub

Does anyone have any idea what syntax should I use in order to get the players?

Regards!

https://cookbook.fivem.net/2019/06/29/get_active_players-the-replacement-for-player-loops/
This might help you.

1 Like

It never was in the formal reference assemblies, you’re supposed to access the Players property on BaseScript:

foreach (var player in Players)
{
    // ...
}
3 Likes

Appreciated, thank you! <3