Page 1 of 1
pcIp,hop1,hop2,hop3,hop3 <- How to?
Posted: Mon Dec 06, 2010 4:21 pm
by davide874
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision
Number:
L2JDP Revision
Number:
hi everyone,
i was wondering how i could get pcIp,hop1,hop2,hop3,hop4 using a L2PcInstance into a script.
I don't wanna access the DB to get this information and i would like to do it using a L2PcInstance...
I saw this methods are used inside PlayerTracert.java but i'm not sure how to get this information from a L2PcInstance...
Any clue?
Re: pcIp,hop1,hop2,hop3,hop3 <- How to?
Posted: Mon Dec 06, 2010 8:15 pm
by Szponiasty
If nothing changed in freya, you will have to implement that yourself. As I recall you can get that in EnterWorld.java. So just add fields to L2PcInstance and in EnterWorld add assigning values for that fields. Add public getter for them in L2PcInstance and you can use it in scripts.
Re: pcIp,hop1,hop2,hop3,hop3 <- How to?
Posted: Mon Dec 06, 2010 9:44 pm
by JIV
com.l2jserver.gameserver.network.L2GameClient.getTrace()
Re: pcIp,hop1,hop2,hop3,hop3 <- How to?
Posted: Mon Dec 06, 2010 9:53 pm
by Szponiasty
JIV wrote:com.l2jserver.gameserver.network.L2GameClient.getTrace()
Yup. Sorry, I've forgot about that.
Re: pcIp,hop1,hop2,hop3,hop3 <- How to?
Posted: Tue Dec 07, 2010 8:37 pm
by davide874
JIV wrote:com.l2jserver.gameserver.network.L2GameClient.getTrace()
a big kiss!
Testing right now i'll let you know

Re: pcIp,hop1,hop2,hop3,hop3 <- How to?
Posted: Tue Dec 07, 2010 9:11 pm
by davide874
well... i can't find a way to use it...
Code: Select all
com.l2jserver.loginserver.gameserverpackets.PlayerTracert
in this class are stored the methods i need.
Code: Select all
public String getPcIp() { return _pcIp; } /** * @return Returns 1st Traceroute Hop. */ public String getFirstHop() { return _hop1; } /** * @return Returns 2nd Traceroute Hop. */ public String getSecondHop() { return _hop2; } /** * @return Returns 3rd Traceroute Hop. */ public String getThirdHop() { return _hop3; } /** * @return Returns 4th Traceroute Hop. */ public String getFourthHop() { return _hop4; }
the issue is that this methods must be called on a PlayerTracert object type...i have no idea on how to recall them from a L2PcInstance since i can't find any method like "getPlayerTracert" or anything like that...
I tried to create a PlayerTracert
Code: Select all
PlayerTracert plt = new PlayerTracert(data);
But the data should be a byte[] as specified in the class constructor
Code: Select all
public PlayerTracert(byte[] decrypt) { super(decrypt); _account = readS(); _pcIp = readS(); _hop1 = readS(); _hop2 = readS(); _hop3 = readS(); _hop4 = readS(); }
The getTrace() method in the class you suggested me returns a int[][] and i'm not sure if they can be used...
Can you enlight me a little bit more?
Re: pcIp,hop1,hop2,hop3,hop3 <- How to?
Posted: Tue Dec 07, 2010 10:04 pm
by Szponiasty
Code: Select all
int[][] tracert = activeChar.getClient().getTrace(); for (int i=0; i < 5; i++) activeChar.sendMessage("route step "+(i+1)+" - "+tracert[i][0]+"."+tracert[i][1]+"."+tracert[i][2]+"."+tracert[i][3]);/** also check eg:* - activeChar.getClient().getConnection().....*/
activeChar = L2PcInstance
Re: pcIp,hop1,hop2,hop3,hop3 <- How to?
Posted: Tue Dec 07, 2010 10:26 pm
by davide874
I attached the screenshot of the message i receive.
I'm pretty sure i need to use that encrypted data and use it in the PlayerTracert argument
Code: Select all
1. public PlayerTracert(byte[] the_data_printed_in_the_chat) 2. { 3. super(decrypt); 4. _account = readS(); 5. _pcIp = readS(); 6. _hop1 = readS(); 7. _hop2 = readS(); 8. _hop3 = readS(); 9. _hop4 = readS(); 10. }
How should i do that? Creating an array of bytes and appending the printed results into it?
Thanks for the amazing suggestion
EDIT
seems like loginserveer packages cannot be imported...
Code: Select all
import com.l2jserver.loginserver.gameserverpackets.PlayerTracert;
gives me this error
Code: Select all
1. ERROR in /AntiDualBox.java (at line 16) import com.l2jserver.loginserver.gameserverpackets.PlayerTracert; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^The import com.l2jserver.loginserver.gameserverpackets.PlayerTracert cannot be resolved----------2. ERROR in /AntiDualBox.java (at line 36) player.sendMessage(ptc.getFirstHop()); ^^^^^^^^^^^The method getFirstHop() is undefined for the type PlayerTracert
Re: pcIp,hop1,hop2,hop3,hop3 <- How to?
Posted: Tue Dec 07, 2010 11:25 pm
by Szponiasty
Read my post above. You have complete and working code for that.
And don't use com.l2jserver.loginserver.gameserverpackets.PlayerTracert;...
//EDIT: Sry - my mistake

Corrected code above.
Re: pcIp,hop1,hop2,hop3,hop3 <- How to?
Posted: Wed Dec 08, 2010 1:36 am
by JIV
i think there is admin command //tracert or something like that.