redirect script jumping from 1 server to another

so I have few servers for my community but I dont know how to make a simple script which will allow users to join from TTT to like darkrp server
just by typing in game command such as !joindarkrp etc
how to create simple script like this? and where would I have to place it within the files?

Make your command (I don’t know how you will/what you will do it with) and try adding this

LocalPlayer():ConCommand("connect [ip here]")

PlayerSay hook on the server to detect it, send a net message to client, on the receive add LocalPlayer:ConCommand( “connect <IP>” )

Try this:

hook.Add( "PlayerSay", 0, function( ply, text, team )
    if ( string.sub( text, 1, 11 ) == "!joindarkrp" ) then
        return LocalPlayer():ConCommand("connect [ip]")
end )

hmmm:L either Im putting this in wrong file or the script doesnt work:L I bet its probably the first one

Do you get any errors when using it?

[editline]7th June 2014[/editline]

Oh, try removing the “return” before the LocalPlayer()

nah, no errors just typing down the command results into nothing
tried removing return same thing

Replace LocalPlayer() with ply

PlayerSay is a serverside hook, and LocalPlayer is for clientside. Modify it so it sends a net message to the client, so it would be like so:

if SERVER then

util.AddNetworkString( "joinotherserverone" )

hook.Add( "PlayerSay", 0, function( ply, text, team )
	if ( string.sub( text, 1, 11 ) == "!joindarkrp" ) then
		net.Start( "joinotherserverone" )
		net.Send( ply )
		return false
end )


if CLIENT then

net.Receive( "joinotherserverone", function( len )
	LocalPlayer():ConCommand("connect [ip]")
end )

Its a shared file, so make sure its called on both server & client (if its not in the autorun folder)

IIRC you can’t make use connect with concommand on the server because its blocked (I think)

you could always just use OnPlayerChat clientside, something like this (not tested)

local servers = {
[“darkrp”] = “”,
[“ttt”] = “fsfkjsjbfk”
hook.Add( “OnPlayerChat”, “ServerHop”, function( ply, text )
local ip = servers[text:sub( 7 )]
if text:find( “^[!/]join%s” ) and ip then
if ply == LocalPlayer() then ply:ConCommand( (“connect %s”):format( ip ) ) end
return true
end )

then !join darkrp