Datastream to server or client -> server How do you do it? Example please it confuses me

Datastream to server or client -> server How do you do it? Example please!!

Clientside:
[lua]
datastream.SendToServer( player.GetAll(), {“Hello world”, 123} );
[/lua]

Serverside:
[lua]
datastream.Hook(“uniqueId”, function(client, handler, id, encoded, decoded)
local value = decoded[1];
local other = decoded[2];

 print(value.." "..other);

end);
[/lua]

It would output on the server’s console:

Hello world 123

If you can, avoid using datastream completely. Even the author Deco said so himself! However if you must use it, make sure you’re using Datastream 2.

But first I really insist you try out alternatives such as usermessages or the new net library. (if you have beta access)

Datastream 2 is just recreating the datastream module using the net library for people who don’t know Lua.

On incoming I can just restrict what gets sent through on the server, but I need it to send stuff to the server!

Uhhh… Read the posts above. Either use an alternative or follow a tutorial.

To send stuff to server, use consolecommands, or use new net library that comes with gmod13.

Concommands could be exploited, look at PERP as an example.

How exactly could they be exploited? What way are you thinking of, atleast.

They can only be exploited if you don’t do your checks right.
When can the client send the command?
Is the client dead?
Is the client running the command every frame?
Is the client inputting wrong values in the command?
Is the client on the right team?
And so on.

Oh. well that’s common sense i thought he meant something different

Yet people still make these stupid mistakes.

Stupid people make stupid mistakes.

Things will only get exploited if you leave exploits in them.

Ret, so much for being an amazing scripter. You tell me to script when you attempt to learn Datastream which is so simple to use.

And one more thing. Using datastream is not an exploit fix, using a SE bypass can easily allow you to send datastreams and modifying them when still on the client.

Science you’re really smart(dumb) I was derping this whole thread, Go back to autism school kid you need it.


(User was banned for this post ("Shitposter." - Seiteki))

You’re a great poster ya know

http://dl.dropbox.com/u/44439392/sarcasm.png

It gets even better when they try to cover themselves up! :wink:

Yea we realised you were derping.
Now I’m off to Autism school, I’m sure the kids there have a better chance of learning Lua than you.

Both of you are idiots, stop arguing in someones help thread

We are not arguing in someone elses help thread.
Im arguing with the OP, i simply gave him help in my last comment and rather than say thank you, he gets all butthurt and rages.