• Any ways to make a "doorway" to another server?
    8 replies, posted
I've been looking around and I realized I need this for my roleplay community. Basically, you'd walk into either a doorway or just a position, and this would connect you to a set IP. No idea if this exists or is public or whatnot, so this is why I ask here.
Clientside, you would run [lua]RunConsoleCommand( 'connect', <serverip> )[/lua] Serverside I believe 'connect' is blocked with Player:ConCommand No idea why
Trigger that activates a point_clientcommand that connects you to a certain ip e.g. "connect 255.255.255.255". Or just use ConCommand.
[QUOTE=Ice Tea;41188473]Clientside, you would run [lua]RunConsoleCommand( 'connect', <serverip> )[/lua] Serverside I believe 'connect' is blocked with Player:ConCommand No idea why[/QUOTE] Well I'd want it automated and shit, which I have no idea if it exists. Hence me asking :v:
[QUOTE=Confuzzed Otto;41188481]Well I'd want it automated and shit, which I have no idea if it exists. Hence me asking :v:[/QUOTE] How do you want it to work? On a console command? Lua function?
If you're making the map yourself, add a trigger that connects you.
[QUOTE=Confuzzed Otto;41188481]Well I'd want it automated and shit, which I have no idea if it exists. Hence me asking :v:[/QUOTE] You would make the player do that..So lets say you have want the player to connect to the new server by pressing F1. What makes this a little more complex is that the client needs to run the command, but the GM:ShowHelp() function is serverside. [code] // Put this in a file you probably already have beginning cl_. basically, any clientside file. function DoConnect() RunConsoleCommand( 'connect', 127.0.0.1 ) // As you'll know unless you suffer from severe autism, change the IP here to reflect which server you wish the player to connect to. end usermessage.Hook( "Connection", DoConnect ) // This needs to be in a serverside file. Put this in init.lua which you probably have. function GM:ShowHelp( ply ) // This is what runs when you press F1 umsg.Start( "Connection", ply ) // This tells the client we need to use the connection function we hooked in the example above. umsg.End end [/code] Edit: Tagssss
[QUOTE=DeathByKittens;41188955]You would make the player do that..So lets say you have want the player to connect to the new server by pressing F1. What makes this a little more complex is that the client needs to run the command, but the GM:ShowHelp() function is serverside. [code] // Put this in a file you probably already have beginning cl_. basically, any clientside file. function DoConnect() RunConsoleCommand( 'connect', 127.0.0.1 ) // As you'll know unless you suffer from severe autism, change the IP here to reflect which server you wish the player to connect to. end usermessage.Hook( "Connection", DoConnect ) // This needs to be in a serverside file. Put this in init.lua which you probably have. function GM:ShowHelp( ply ) // This is what runs when you press F1 umsg.Start( "Connection", ply ) // This tells the client we need to use the connection function we hooked in the example above. umsg.End end [/code] Edit: Tagssss[/QUOTE] So basically, are there any ways of replicating this code into an entity? :v:
[QUOTE=Confuzzed Otto;41193454]So basically, are there any ways of replicating this code into an entity? :v:[/QUOTE] [lua] function ENT:StartTouch(ent) if ent:IsValid() and ent:IsPlayer() then ent:SendLua([[LocalPlayer():ConCommand('connect 255.255.255.255:27015')]]) end end [/lua] ? This is serverside. init.lua of Entity script. (Or shared.lua however your entity is made) See [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index50e2.html[/url] for more info.
Sorry, you need to Log In to post a reply to this thread.