Raised This Month: $ Target: $400
 0% 

Is it possible to get serverip ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 08-03-2010 , 11:56   Re: Is it possible to get serverip ?
Reply With Quote #1

I've posted this on wrong thread

That can be readed from cvars

PHP Code:
new host[128], ip[16], port[8]
get_cvar_string("hostname"hostcharsmax(host))
get_cvar_string("ip"ipcharsmax(ip))
get_cvar_string("port"portcharsmax(port)) 
For hostname, at plugin_init it returns Half-Life. Check what happens in-game.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 08-03-2010 , 12:11   Re: Is it possible to get serverip ?
Reply With Quote #2

Quote:
Originally Posted by joropito View Post
I've posted this on wrong thread
I saw this.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-03-2010 , 18:59   Re: Is it possible to get serverip ?
Reply With Quote #3

Quote:
Originally Posted by joropito View Post
I've posted this on wrong thread

That can be readed from cvars

PHP Code:
new host[128], ip[16], port[8]
get_cvar_string("hostname"hostcharsmax(host))
get_cvar_string("ip"ipcharsmax(ip))
get_cvar_string("port"portcharsmax(port)) 
And if the ip cvar was never set? I'm assuming you would get an empty string? Guess I should test it out.
__________________
fysiks is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 08-03-2010 , 19:01   Re: Is it possible to get serverip ?
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
And if the ip cvar was never set? I'm assuming you would get an empty string? Guess I should test it out.
port + ip are setup at hlds start time. Hostname should be set if you want to change default name (Half-Life)

I always run hlds with +ip +port arguments
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-03-2010 , 19:02   Re: Is it possible to get serverip ?
Reply With Quote #5

Quote:
Originally Posted by joropito View Post
port + ip are setup at hlds start time. Hostname should be set if you want to change default name (Half-Life)

I always run hlds with +ip +port arguments
I don't use either one of those. I've never needed to.
__________________
fysiks is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 08-03-2010 , 19:29   Re: Is it possible to get serverip ?
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
I don't use either one of those. I've never needed to.
Tested.

If +port is not used, port cvar will be default port (27015)

If +ip is not used, it's value will be localhost...
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:07.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode