Hi all I decided to try something new in which until I haven't needed.
I am trying to send a net message from a client side file to a server side. I wondered if anyone could help me as it seems to not be working.
[code]
--Clientside
LoadoutMenu3.DoClick = function()
net.Start( "testing1" )
net.SendToServer()
end
--Serverside
util.AddNetworkString( "testing1" )
net.Receive( "testing1", function(len, pl)
print("This script works.")
end)
[/code]
Thanks for any help.
-Duby
Are you sure the code is loaded correctly on the server- and clientside?
The code is fine
[editline]6th September 2014[/editline]
Also don't sign your posts please.
Your username is next to your post, no need to state it a second time
I am running the client side stuff from a derma menu. Would this be the issue?
What isn't working? Tell us what happens and what doesn't.
I don't receive any kind of outputs. eg: print("This script works.") So that leads me to think it isn't working.
And you're looking at the server's console for the output?
[lua]
if SERVER then
util.AddNetworkString( "testing1" )
net.Receive( "testing1", function(len, pl)
print("This script works.")
end)
end
if CLIENT then
LoadoutMenu3.DoClick = function()
net.Start( "testing1" )
net.SendToServer()
end
end
[/lua]
put in autorun/myfile.lua or something like that. Should work.
Are you sure that LoadMenu3 is in the scope?
Try adding a print into the DoClick function and see if that triggers
Got it working fine, it was an error on my part. It was involving another script.
Sorry, you need to Log In to post a reply to this thread.