garrysmod-requests
garrysmod-requests copied to clipboard
Built in serverside chat.AddText
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.
Related issue: https://github.com/Facepunch/garrysmod-requests/issues/122
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.
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.
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.
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.