[advice] Relay

I’m currently working on a way for users to send information to other clients, and when received they can use that information for whatever they want.

This system opens up endless possibilities and is called Relay.

I’ll try and explain in more detail.

Player 1 sends a table of allowed net requests (to be sent from someone else to him) to the server in a string, when the string is received it’s added to a playertable.
Player 1 can’t receive net requests from other players unless those net requests are on the verified table that he sent to the server.
Player 1 must also put Player 2’s SteamID on the list for Player 2 to be able to send a request to him.

When you think of it, it’s more like a firewall. The server acts as a relay for two clients.

Relay.AllowRequest(string name) --allows a net request to be sent to him from another player
Relay.AllowRequestBy(string id) --adds a whitelist for a SteamID to send information to him
Relay.Send(string netmessage, entity who, table extra) --the first argument is the net request to send to a player, the next is to what player entity, and the third is an optional table with extra arguments to be sent to the player


      if Relay then
           for k,v in pairs(player.GetAll()) do 
                if v:SteamID() == "STEAM_0:1:30062241" then
                target = v

Relay.Send("yes", target, {"hi"} )


        if Relay then
        net.Receive("yes", function() local tab = net.ReadTable() PrintTable(tab) end end )


How do you send a net request to another player?
A player sends a net request to the server.
The server receives the request.
The player has to include two arguments with the request to the server.
A string (the net request to send to a player)
And a target (who to send it to)
Before that is sent to the target, the server verifies that the target is allowing that specific net request, and allowing that specific SteamID (from player 1) to send net requests to the target.

On the Lua side, the target could write some code to receive that net request, and then it could send back another net request for the player that sent it to him.

Where is it?

I am currently working on it, but I would really love some suggestions. Right now players need to wait a 2 second delay before sending net requests.

this tool can be used maliciously if a player is using a backdoored addon that allows relay requests

Great Idea, but it will take some work to make sure it is not exploitable.
Also optimization will be needed, and some other stuff, but other than that.

  1. Make it so that players can contact an admin though this system. (not sure if the shared or server library has this in the steamworks section but if not, C++)
  2. Make it so that people can send friend requests though the server. (once again, not sure)

Thanks for the feedback!

I’m planning to do the second one,
I’m not quite sure what you mean by your first suggestion, do you mean it saved as logs or?

Sorry I was a little vague with my first suggestion.

What I meant by that is make something like the TTT rdm report system. Only if there isn’t an admin on, make it so that the player messages them through steam. (Now that I think about it, this would require a module.)

I can’t make modules.

But why is there a need of such a system? I added the steamid allowed table and allowed net request table for that, so players can’t run random net requests on other players that could harm them. I added it so that the client has full control of what net requests can come into him, and from who.

I still don’t quite understand, sorry :confused:

  1. I can barely make modules either, (I’m still learning C++)
  2. This would be an implication
    Say there is an RDMer on a TTT server, and there are no admins on. The players do not know the names of the admins. They could use a command to report the RDMer to an admin that is on through steam, via the server. I know this may seem somewhat ooc, but this would be a great admin tool.

Why not use http.Post and a website to either inform all admins online on the website or send a message to all admins using a bot?

Good point,
But this is not needed for me, this is just a suggestion

So if I understand it right, you want to be able to use this addon to contact people not in the server? I can’t do that. The server uses net requests to send to players from and to, it’s out of reach if they’re not in the same server or aren’t in Garry’s Mod at all.

Sorry if I read it wrong, but are you working on something that allows users to send clientside Lua to other users? What? Why?

So people could make private message chats, send screenshots over and just allow endless possibilities

There’s not really any harm because you have to allow requests by other people.

Can’t you just send it to the server with the player info your trying to send it too in a table and verify it. Then just have the server read the player info from the table and send it to the corresponding player.


Player 1: Table{player 2,“lol”}–> Server: | Send message to player table[1], msg: table[2] —> Player 2: Recieves message “lol”

i can do it my own way thanks

This isn’t how Source networking works. (Or anything in GMod for that matter. [without modules])