Getting the IP address/port of the server?

Is it possible to get the IP address and port of the server the player is connecting to in a clientside script?

I’ve searched, but all I can find is how to get the IP address and port a client is connected to.

I guess looking at your console isn’t good enough?

This is the lua section stop with your dumb ass answers that are not helpfull trying to boost your post count or something

Anyway back on topic I have looked into a few methods and I cant see a way to do this so that leads me to believe its going to be a hacky method I will get back to you if I find anything but there many be a easy way to do it and if there is please prove me wrong im happy to learn

[lua]
local HostIP = GetConVar(“ip”):GetString()
local HostPort = GetConVar(“port”):GetInt()
[/lua]
That’ll work on most dedicated servers.

No it won’t.


local HostPort = GetConVar("hostport")

I’m yet to find one for IP.

I dont really get why you would need this anyway what could you use it for

He was most likely asking to make sure that he knows about the command you can type into console to get the IP and Port, because that might have been what he was looking for, there’s nothing wrong with asking.

LuaSocket needs the server’s IP and port to work.

How is that comment stupid? All you have to do is type status in the console.

Because this is the lua section that dont look like lua to me

To be more correct it’s the newbie section. :v: It’s the same as if he asked for a script to fly in sandbox mode, there’s no hurting pointing out the already avaible options.

Correction. Its the lua section, newbie subforum.

That’s like someone posting a thread asking how to make custom car models spawnable as vehicles and you saying “go into sandbox, spawn the model and weld it to a jeep”.

LOL, this is true. Sorry about the mistake, forgot what forum I was in.

More like “Someone already made that model into a vehicle, maybe you could use it.”. And as long as people try to help isn’t that all that’s important? :slight_smile:

No its not the help you gave was not helpfull at all

No on both counts.
He said “How can I make this into a car”. You said “Why don’t you just use the jeep?”
An equivalent would be me going into the modelling subforum and posting in the help threads there. Sure, I’d be trying to help, but it’d really stupid because I don’t know anything about modelling.