garrysmod-requests icon indicating copy to clipboard operation
garrysmod-requests copied to clipboard

Built in serverside chat.AddText

Open pparadoxx opened this issue 2 years ago • 5 comments
trafficstars

Details

Instead of having several addons (depending on the server side, potentially hundreds of addons) all doing their own net message and doing their own serverside function, client-side receiver, unpacking, and self-checking, why not just have a built-in one for us all to use universality?

Its really not difficult to implement inside the game its just difficult for server owners who have to deal with this in multiple addons. Yes you can do libraries but not all addons are going to run off the same library except for... drumroll please... the default Garry's Mod libraries!

Add it to the default Garry's Mod libraries.

pparadoxx avatar Mar 22 '23 07:03 pparadoxx

Related issue: https://github.com/Facepunch/garrysmod-requests/issues/122

robotboy655 avatar Mar 22 '23 13:03 robotboy655

Related issue: #122

Five-minute fix, and it's been more than a decade now, really speaks to the support that the community developers get. 

ryanoutcome20 avatar Mar 27 '24 12:03 ryanoutcome20

There are better, targeted solutions to networking colors and strings to clients. eg.

local messages = {}
messages[1] = function()
    chat.AddText(Color(255, 0, 0), net.ReadPlayer():Nick(), Color(255, 255, 255), " has said something")
end

net.Receive("chatprint", function()
    messages[net.ReadUInt(32)]()
end )

This is an indisputably better pattern than networking everything, plus its easier to maintain and have multilanguage support.

garryspins avatar Mar 27 '24 16:03 garryspins

There are better, targeted solutions to networking colors and strings to clients. eg.

local messages = {}
messages[1] = function()
    chat.AddText(Color(255, 0, 0), net.ReadPlayer():Nick(), Color(255, 255, 255), " has said something")
end

net.Receive("chatprint", function()
    messages[net.ReadUInt(32)]()
end )

This is an indisputably better pattern than networking everything, plus its easier to maintain and have multilanguage support.

Most certainly, it is disputable. For one, you might need something more dynamic than the same message over and over again; for two, if you do this, then you might need to pass information that the client, very simply, doesn't need (which adds to networking overhead and complexity as well). 

By the way, this also leads to unorthodox and ugly code since you need to keep multiple copies of these statements. Not everyone needs a multilingual addon.

And to add onto it, addons already make their own version of chat print using unpack and tables. This doesn't need to be done dozens of times on a single server; it can be done once by the only people that can actually make something globally for the game.

TLDR; There is a reason why people have been asking for this for more than a decade and will continue to ask this until it is added to the game, it's very stupid to think otherwise.

ryanoutcome20 avatar Mar 28 '24 06:03 ryanoutcome20

Also, the game already has dozens of functions that aren't needed. Even IF you want to say that this wouldn't be a needed addition (which it clearly is), that is also something to keep in mind.

ryanoutcome20 avatar Mar 28 '24 07:03 ryanoutcome20