1. Hey. I need to send a message to all players on the server, there is a difference how to do it?
    Code:
    foreach (var Player in BasePlayer.activePlayerList){
        PrintToChat(Player, Message);
    }
    Code:
    PrintToChat(Message);
     
  2. Wulf

    Wulf Community Admin

    Those would do the same thing.
     
  3. Code:
    BasePlayer.activePlayerList.ForEach(x => PrintToChat(x, lang.GetMessage("Key", this, x.UserIDString)));
    The advantage of the above is it takes advantage of localization per player. If you decide to use the Lang API rather than hard-coded strings it's generally better to loop through the player list.