Sending data from a client to the server

Hey there, I’ve been trying to make a script that would send the player’s color length to the server using concommands, but it doesn’t seem to work.

Here’s the code:

Client
[lua]
function ccStealth( )
if not ValidEntity(LocalPlayer()) then
return
end
RunConsoleCommand(“report_visibility”)
end

concommand.Add(“report_visibility”, function()
render.GetLightColor(LocalPlayer():GetPos()):Length()
end)

timer.Create(“Check My Illumination”, 0.5, 0, ccStealth)
[/lua]

Server
[lua]
concommand.Add(“report_visibility”, function(ply, cmd, args)
ply.Illumination = tonumber(args[1])
end)
[/lua]

There are no errors, nothing. It doesn’t seem to report it to the server. Are there any other ways or am I doing it wrong?

Oh, and the clientside file is sent to the clients aswell. Do I need to include it?

RunConsoleCommand(“report_visibility”, render.GetLightColor(LocalPLayer():GetPos()):Length())

Leave out the concommand.Add clientside, and yes, you do need to include it in your cl_init.lua file.


Unknown Command: 'report_visibility'
Unknown Command: 'report_visibility'


Dammit, Garry, why can’t you make render serverside aswell?

SetNWInt perhaps?

Setting NWVars from the client will only affect the value on the client, not the one on the server.