PDA

View Full Version : IP address



nyaa
25th February 2013, 15:22
Hi!
I would like to get the server's IP address in the scripts.
Is it possible?
Nyaa.

Earliboy
25th February 2013, 15:36
level.local["ip"] = getCvar("net_ip");
level.local["port"] = getCvar("net_port");


Should work i think.

nyaa
25th February 2013, 16:03
Thank you very much.

kung foo man
25th February 2013, 16:04
net_ip is default "localhost", so it only works when the ip is set at server start: +set net_ip 1.2.3.4

The problem is: then it can also be written directly in the script.

guiismiti
28th December 2013, 19:47
Is there any way to get a player's IP address? I want to create a list of banned IPs and disconnect if player's IP matches it.
I can't have PB on and can't use server admin programs 24/7 (sry to revive this old thread, I don't wanna start a whole new one).

kung foo man
28th December 2013, 19:56
Reviving threads is perfectly fine :)

libcod and



playet std\player::getIP();
playet std\player::getPing();

guiismiti
28th December 2013, 20:24
Yea, I thought there would be no way without libcod.

kung foo man
28th December 2013, 20:55
Hm, I know you have some stock hosting, but why don't you just switch to a Vserver? You have full root on such a machine and it's not that expensive (maybe even less).

guiismiti
28th December 2013, 21:56
I'm brazilian, there are currently 2 active hosts here. If I hire north-american / european hosts my ping will be over 200.
I said I couldn't install libcod but the host company is little, server runs on Linux and the guy from xfire support asks me how the server is every day. The problem is I don't think I know enough to install it, and, probably, neither do them. But will still talk to them this weekend about it.

@topic - if I manage to install libcod, will try to ban an IP range. Just read that it's possible to use substring(string, startpos, length) in QuakeC.

IzNoGoD
28th December 2013, 22:23
Ive made a getcountry() function, which might also interest you :)

That way you can only allow brazillian connections or w/e

guiismiti
28th December 2013, 23:07
Would be interesting, but anybody is welcome to play there though.