Server Teleporter?

I thought this may include LUA coding.

Is there anyway that I can make a teleport in Hammer that can take you to another server.

Its for our group because we have so many servers (9) we are creating a lobby.

Why don’t you use Lua to do it? The only mapping technique I can think of would be the lua_run entity.

I wouldn’t really understand either way, but a way I though, Is there any way for if you hit use (E) on an entity it would trigger the console command connect [IP]?

Yes, with point_clientcommand.

Blocked.

Well is there another way?

Yup. It won’t work. Just use lua.

Okay, well do you know a command?
That if you hit E on an entity it will connect you to another server using the “connect” console command? I need to brush up on my coding.

Use LUA. ply:ConCommand( “connect <ip>” )

Thanks, but that wouldn’t make it so when I use the entity it connects any ideas for that?

Maybe you should learn a bit more Lua first.

Check out the Lua wiki.

Yeah I should :0
But I really need this code…

Then I suggest you start learning as soon as possible.

Yeah I know, but can anyone tell me because I need the code ASAP.

Okay I have this :
function PrintUseInformation( activator, entity )
Msg( "Player " … activator:Nick() … " used " … entity:GetClass() …
" at " … tostring( entity:GetPos() ) … "
" );
end

hook.Add( “PlayerUse”, “PrintUseInformation”, PrintUseInformation )

So where would I put the Entity and the command to connect to a server?

… of course you have that thats what the link I showed you says



function ChangeServers( activator, entity )
if(entity:GetClass()=="Same Class as your teleporter")then
activator:ConCommand( "connect <ip>" ) 
end
end

hook.Add( "PlayerUse", "ChangeServers", ChangeServers )


-snip-

Didn’t read thread. My bad. Fizzadar already said it.

Use the ‘lua_run’ entity provided with the gmod fgd. Set its ‘Code’ keyvalue to…

[lua]if( !IsValid( TRIGGER_PLAYER ) ) then return; end
TRIGGER_PLAYER:ConCommand( “connect <ip>” );[/lua]

And use a func_button or whatever to fire the ‘RunCode’ input. Your mapper will probably know what to do.

Yeah thanks I will try all the suggestions above.
And to Nevec I am the mapper I am just terrible at LUA XD