Chat commands

Tryna make so people can connect from one server to an other through chat commands

[table=“width: 500”]

function ServerList ( ply, text, public )

if( string.sub( text, 1, 9) == “!deathrun” ) then
ply:ConCommand(“connect”)(“91.121.105.110:27015”)
end
end
hook.Add ( “PlayerSay”, “ServerList”, ServerList )

[/table]

what could be causing the problem ?
I know its something wrong in the ply:ConCommand line

You cant use “connect” in code like that. Its blocked.

and it should be ply:ConCommand(“connect 91.121.105.110:27015”) anyways

doesn’t work says the the connect has to be seperate

Post the error?

hmm it must of been a different code as i went through 5 different examples

I’m making a different say just what would i type for the connect ?
ply:ConCommand(“connect 91.121.105.110:27015”) ???

Yes

hmm im not sure if this is gonna make the client exec a console command
are you sure its ply:ConCommand () ?

ply:SendLua(“LocalPlayer():ConCommand(‘connect <ip>’)”)

Marvel at the future replies saying how awful that is even though it gets the job done.

That isn’t really necessary Map in a box, as you can just use RunConsoleCommand when you are executing scripts for your own side.
It should be
ply:ConCommand(“connect”,"<ip>")
As connect is the first argument, the ip is the 2nd argument.

you have no clue what you’re talking about

I actually do have a clue what i’m talking about?
RunConsoleCommand is the same thing as LocalPlayer():ConCommand …

for one, you told him to use ply:ConCommand() which is not the same has RunConsoleCommand or LocalPlayer():ConCommand

on top of that, ply:ConCommand() only accepts one argument, it doesn’t input the same way as RunConsoleCommand does

so no, you don’t

So when did I say for him to use ply:ConCommand()?..
Anyway, lets stop going off-topic and give the guy the proper answers?

It’s actually not the same.
Using ConCommand is supposed to be for serverside use not clientside use.

RunConsoleCommand() takes arguments like this:


RunConsoleCommand("connect", "ip")

Player:ConCommand() takes one string:


Player:ConCommand("connect ip")

oh, and it’s not off-topic if it’s actually helpful information

also RunConsoleCommand() doesn’t accept the connect argument anyways

unless it’s changed since gmod 12

Well in documentation, it’s actually shared, but there’s actually really no point for it to be shared since you can just use RunConsoleCommand in cilent anyway.
I don’t really use any of these that often, so i’m probably rusty on the inputs and etc.
Thanks at least, for treating me intellectually instead of treating me like a dumb dog who lost it’s bone or some crap like that.

also, for the record
http://puu.sh/1VE4G

same thing is accomplished by running LocalPlayer():ConCommand() clientside

RunConsoleCommand is server side as well is it not ?
This is just speaking from what I tryed.

I’ll try LocalPlayer():ConCommand() a go today during lunch or something.

okay its not the actual line of the ConCommand there must be something wrong with it completely as i tryed even disconnect as the line instead of connect but nothing happens