A question about net library.

I’m using the net library for quite a while now, but I was always wondering how does it affect the server performance.
For example, how much time ( lets say per second ) can I use net messages between server and client or vise versa without actually making the server laggy because of constant communication?


More about what data you send in them really.

Mostly short strings and floats; Should I be concerned about using them to often?

Obviously sending net messages in a think hook is going to cause lag. Tell us what you intend to send and we can probably come up with the most optimized solution to it.

Basically I’m working on a guild system, one of the perks is that 15% of the money you get goes to the guild bank, the thing is that I need to update the guild bank value on clientside of all the guild members( to display it when they open the guild gui for example ). I tried to using shared tables but once they’re edited on serverside the clientside can’t see them.

So I ended up using net message to do that, but it sounds rather laggy that when someone in a guild gets money then it needs to send a net message for every single member of the guild.

You’re seriously overestimating the performance cost of this.

At most you’ll need to send 4 bytes per guild member with a worst case scenario of once per second, assuming players are getting cash every second. Hell you could even make it only update at set intervals if you had to.

Quick question on the topic of Net Library, so I don’t need to make a new thread:
I have a weapon that sends information to the client, both in a shared file (I used this to allow me to use the stencils). The code is simple and works flawlessly in single player, but in multiplayer it gives me the error:

[ERROR] addons/weaponpack/lua/weapons/weapon_telekinesis/shared.lua:284: attempt to call field 'Send' (a nil value)
  1. unknown - addons/weaponpack/lua/weapons/weapon_telekinesis/shared.lua:284


net.Send(self.Owner) --this is line 284

Why does it not like this in multiplayer?

That code is being called on the client where net.Send doesn’t exist. Just do an state check at the top.