AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How can I know the server IP which the client connected (https://forums.alliedmods.net/showthread.php?t=25760)

sunpiny 03-19-2006 18:59

How can I know the server IP which the client connected
 
There are multiple IP in my server ,such as IP1,IP2 and IP3. When a client connect, They maybe use command 'connect IP3:port',or maybe ''connect IP1:port'. I can know the client IP by 'get_user_ip()' in function 'client_connect()'. But I want to know which server IP they choose. IP1 or IP2, so how can I get it?

Hawk552 03-19-2006 20:30

Umm, not exactly sure.

You can try this if I get it correctly:

Code:
new szServerIP[19] get_cvar_string(szServerIP,18,"net_address")

v3x 03-19-2006 20:37

Quote:

Originally Posted by Hawk552
Umm, not exactly sure.

You can try this if I get it correctly:

Code:
new szServerIP[19] get_cvar_string(szServerIP,18,"net_address")

Code:
new szServerIP[19]; get_cvar_string("net_address" , szServerIP , 18);
*

Hawk552 03-19-2006 20:39

My mistake. Wrote that off the top of my head after not doing any coding for 2 weeks.

Xanimos 03-19-2006 21:38

Two Weeks?!?!? That is a really long time to forget such a basic function doncha think?

Now if it had been 2 years there might be some room for that.

Brad 03-19-2006 22:00

He always has excuses. :lol:

sunpiny 03-19-2006 22:42

It doesn't work
 
Thx!

But it doesn't work.

When Server Start, it display "Server IP Address IP1:27015". I don't bind the IP, it select one IP such as IP1.

You can 'connect IP2:27015' Or 'connect IP3:27015' ,I can enter the Server with all IP1,IP2,IP3. But get_cvar_string("net_address" , szServerIP , 18) always return the IP: IP1, which the "DISPLAY IP" when the server start . it's IP1.

I want to get IP such as:
Client CMD 'connect IP2:27015' , it should return IP2
Client CMD 'connect IP3:27015' , it should return IP3
Client CMD 'connect IP1:27015' , it should return IP1

it seems no way can reach it

jtp10181 03-19-2006 22:45

there is no way to get the information you want, The only way I know of having more than one IP for server is the have fake servers redirect to one server. If thats the case you can check the logs of the fake servers to see who connected to it.


All times are GMT -4. The time now is 16:36.

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