[HELP] IP compare
Posted: Fri Oct 02, 2009 12:49 pm
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:3587M
L2JDP Revision Number:6680
I want to check if player and his target IP addresses are the same:
This statement returns false, allthough both IP's are the same.
If I add line:
In game client I get output: Checking IP:127.0.0.1:127.0.0.1
This means that i get IP of player and his target correctly(both clients are on same PC on localhost), but then how come the if sentence states false? Maybe I need to convert the value getHostAddress() before comparing?
» Find Revision
L2J Revision Number:3587M
L2JDP Revision Number:6680
I want to check if player and his target IP addresses are the same:
Code: Select all
if (getClient().getConnection().getInetAddress().getHostAddress() == targetPlayer.getClient().getConnection().getInetAddress().getHostAddress()) { sendMessage("Killed player with same IP. No reward."); return; }
If I add line:
Code: Select all
sendMessage("Checking IP:" + getClient().getConnection().getInetAddress().getHostAddress() + ":" + targetPlayer.getClient().getConnection().getInetAddress().getHostAddress());
This means that i get IP of player and his target correctly(both clients are on same PC on localhost), but then how come the if sentence states false? Maybe I need to convert the value getHostAddress() before comparing?