How can server read client variables ?

Because client can’t use SetNWInt I need to know how can server read client variables

Sorry,my English is not so good

please help me


Use the Net Library to tell the server to SetNWInt, eg:
[lua]if SERVER then

util.AddNetworkString( "SetNWInt" )

net.Receive( "SetNWInt", function( len, ply ) -- ply == person who sent message

	ply:SetNWInt( "MyNWInt", net.ReadInt() )

end )


if CLIENT then

net.Start( "SetNWInt" )
	net.WriteInt( 10, 16 ) -- 16 bytes


why not just share variables with the server to the client and likewise, and verifying them on the server?

I don’t understand what you mean, do you suggest the client SetNWInt themselves? Because in that case the server will not synchronize it.

no like, on player join, server sends a table to player

player updates table when he gets more or less of something (e.g money), then he sends the table back to the server and the server syncronizes it

The player wouldn’t update money upon getting it, the server would update the client using net.Send().

Presumably if you want the player to “collect” the money, it would be an entity like in DarkRP, and when collected the server will add the money to a serverside variable (and then sync that with the client).

exactly, what I meant – thanks.