Write to client's console, server-side-only mod ?

RedSwordRedSword Join Date: 2006-12-07 Member: 58947Members, Reinforced - Shadow, WC 2013 - Supporter
edited September 2015 in Modding
Hi,

I'm a bit surprised, there doesn't seem to be anyway to server-sidedly write to a client's console. Taking a look at NetworkMessages.lua seems to prove it (no network message seems to be related to a console).

1) Am I right ?

2) Why ? Isn't that a nice, basic feature to have to send non-important information ? i.e. when something doesn't fit on screen (chat); this would be a nice, non-client sided (hence no download) way to give information. I'm mainly thinking about admins wanting to retrieve a certain information without spamming chat (which can easily be done, and it is a bit annoying as NS2 chat (default feed) takes a non-negligible space, and seems to be used for a lmost everything). That would also be easy to code I believe (reading at the code).

Thank you,

Red

Comments

  • SamusDroidSamusDroid Colorado Join Date: 2013-05-13 Member: 185219Members, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    It can be done but I don't remember how. You have to do it through network messages.
  • RedSwordRedSword Join Date: 2006-12-07 Member: 58947Members, Reinforced - Shadow, WC 2013 - Supporter
    edited September 2015
    Just to clarify, when I said server-sidedly, I meant server-side only, without modifying the client.

    Also I know that Shine seems to allow it; but I'm looking for a standalone server-only way to do it.
  • GhoulofGSG9GhoulofGSG9 Join Date: 2013-03-31 Member: 184566Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Reinforced - Supporter, WC 2013 - Supporter, Pistachionauts
    edited September 2015
    RedSword wrote: »
    Hi,

    I'm a bit surprised, there doesn't seem to be anyway to server-sidedly write to a client's console. Taking a look at NetworkMessages.lua seems to prove it (no network message seems to be related to a console).

    1) Am I right ?

    2) Why ? Isn't that a nice, basic feature to have to send non-important information ? i.e. when something doesn't fit on screen (chat); this would be a nice, non-client sided (hence no download) way to give information. I'm mainly thinking about admins wanting to retrieve a certain information without spamming chat (which can easily be done, and it is a bit annoying as NS2 chat (default feed) takes a non-negligible space, and seems to be used for a lmost everything). That would also be easy to code I believe (reading at the code).

    Thank you,

    Red
    1 & 2:
    --We don't use ServerAdminPrint here as that would spam the server log
    local function NotifyPlayer(player, message)
        Server.SendNetworkMessage(player, "ServerAdminPrint", { message = message }, true)
    end
    
    Gist

    For longer messages you might have to split them up like ServerAdminPrint does it.

    BTW shine also overrides ServerAdminPrint to remove that annoying Shared.Message: https://github.com/Person8880/Shine/blob/master/lua/shine/core/server/logging.lua#L291. So you can use it directly at servers with shine or just add the shine version to your own mod.
  • RedSwordRedSword Join Date: 2006-12-07 Member: 58947Members, Reinforced - Shadow, WC 2013 - Supporter
    edited September 2015
    Thanks; that answer my question. My problem came from the fact that I was looking at ns2/lua instead of core/lua (sorry :$). It is a tad odd to use a single SendNetworkMessage in core/lua but not in ns2/lua; though I understand why.
Sign In or Register to comment.