AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Is it possible to get serverip ? (https://forums.alliedmods.net/showthread.php?t=134326)

reinert 08-03-2010 09:38

Is it possible to get serverip ?
 
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

YamiKaitou 08-03-2010 09:41

Re: Is it possible to get serverip ?
 
get_user_ip(0, IP, charsmax(IP), 1);

Moved to Scripting Help

Devil259 08-03-2010 10:27

Re: Is it possible to get serverip ?
 
get_user_ip() is for the client.

He wants to use it for get the server ip.

vL. 08-03-2010 11:04

Re: Is it possible to get serverip ?
 
Quote:

Originally Posted by Devil259 (Post 1260394)
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?

padilha007 08-03-2010 11:12

Re: Is it possible to get serverip ?
 
Quote:

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

padilha007 08-03-2010 11:13

Re: Is it possible to get serverip ?
 
lag, sorry.

Devil259 08-03-2010 11:17

Re: Is it possible to get serverip ?
 
Quote:

Originally Posted by vL. (Post 1260433)
get_user_ip(0) returns LAN IP

Ah ok, sorry :mrgreen:

Quote:

Originally Posted by vL. (Post 1260433)
also, but how to get server name?

PHP Code:

new hostname128 ]
 
get_cvar_string"hostname" hostname charsmaxhostname ) ) 


joropito 08-03-2010 11:56

Re: Is it possible to get serverip ?
 
I've posted this on wrong thread :P

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.

Devil259 08-03-2010 12:11

Re: Is it possible to get serverip ?
 
Quote:

Originally Posted by joropito (Post 1260474)
I've posted this on wrong thread :P

I saw this. :mrgreen:

SpeeDeeR 08-03-2010 13:05

Re: Is it possible to get serverip ?
 
isn't get_user_name(0...) returning the hostname


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

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