Raised This Month: $ Target: $400
 0% 

Is it possible to get serverip ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 08-03-2010 , 09:38   Is it possible to get serverip ?
Reply With Quote #1

Is it possible to get Serverip with plugin, like I want to check if serverip == 77.22.33.142)
client_print - your playing on our public server

if serverip == 66.11.22.031)
client_print - your playing on our hidenseek server
reinert is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-03-2010 , 09:41   Re: Is it possible to get serverip ?
Reply With Quote #2

get_user_ip(0, IP, charsmax(IP), 1);

Moved to Scripting Help
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 08-03-2010 , 10:27   Re: Is it possible to get serverip ?
Reply With Quote #3

get_user_ip() is for the client.

He wants to use it for get the server ip.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
vL.
Senior Member
Join Date: Aug 2009
Location: Estonia
Old 08-03-2010 , 11:04   Re: Is it possible to get serverip ?
Reply With Quote #4

Quote:
Originally Posted by Devil259 View Post
get_user_ip() is for the client.

He wants to use it for get the server ip.
get_user_ip(0) returns LAN IP

also, but how to get server name?
vL. is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 08-03-2010 , 11:17   Re: Is it possible to get serverip ?
Reply With Quote #5

Quote:
Originally Posted by vL. View Post
get_user_ip(0) returns LAN IP
Ah ok, sorry

Quote:
Originally Posted by vL. View Post
also, but how to get server name?
PHP Code:
new hostname128 ]
 
get_cvar_string"hostname" hostname charsmaxhostname ) ) 
__________________
You can do anything you set your mind to, man.


Last edited by Devil259; 08-03-2010 at 11:20.
Devil259 is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 08-03-2010 , 11:12   Re: Is it possible to get serverip ?
Reply With Quote #6

Quote:
get_user_ip(0, IP, charsmax(IP), 1);
0 is the server
__________________

padilha007 is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 08-03-2010 , 11:13   Re: Is it possible to get serverip ?
Reply With Quote #7

lag, sorry.
__________________

padilha007 is offline
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 #8

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 #9

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 #10

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
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