Networked Variable Efficiency?

I’m not super concerned with writing efficient code, but I feel like this could be something that massively affects server performance.

How many NWVars could I use before it starts having noticeable effects on the performance of the server? Additionally, would using NWStrings be more efficient than using NWVars?

Having more than a few per entity being set at once can cause the overflow reliable channel errors, so I would recommend using something else unless you’re only doing a few things.

I’m using them to set a Flag string to a player, so it would be one per player, and a max of 24 players at once.

you could use player classes and SetupDataTables with NetworkVar

For SetupDataTables, should it just work like this? Just want to make sure that I have this correct.

[lua]hook.Add(“SetupDataTables”, “Blahblahblah”, function( ply )
ply:NetworkVar( “String”, 0, “PlayerFlags”)
end)

function GetFlag (ply)
local Flags = ply:GetPlayerFlags()
end[/lua]

you need to do something like this
[lua]
DEFINE_BASECLASS( “player_default” )

local PLAYER = {}

function PLAYER:SetupDataTables()
ply:NetworkVar( “String”, 0, “PlayerFlags”)
end

player_manager.RegisterClass( “player_withflag”, PLAYER, “player_default” )

function GM:PlayerSpawn( ply )
player_manager.SetPlayerClass( ply, “player_withflag” )
print( ply:GetPlayerFlags( ) )
if ply:IsAdmin( ) then
ply:SetPlayerFlags( “a” )
end
print( ply:GetPlayerFlags( ) )
end
[/lua]