pcIp,hop1,hop2,hop3,hop3 <- How to?

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
davide874
Posts: 112
Joined: Sat Apr 19, 2008 10:45 am

pcIp,hop1,hop2,hop3,hop3 <- How to?

Post 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?
User avatar
Szponiasty
Advanced User
Advanced User
Posts: 557
Joined: Mon Apr 21, 2008 1:31 pm
Location: Eastern Poland

Re: pcIp,hop1,hop2,hop3,hop3 <- How to?

Post 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.
And in the next chronicle they went into space, fighting the evil empire... In a galaxy far, far away xD
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: pcIp,hop1,hop2,hop3,hop3 <- How to?

Post by JIV »

com.l2jserver.gameserver.network.L2GameClient.getTrace()
User avatar
Szponiasty
Advanced User
Advanced User
Posts: 557
Joined: Mon Apr 21, 2008 1:31 pm
Location: Eastern Poland

Re: pcIp,hop1,hop2,hop3,hop3 <- How to?

Post by Szponiasty »

JIV wrote:com.l2jserver.gameserver.network.L2GameClient.getTrace()
Yup. Sorry, I've forgot about that.
And in the next chronicle they went into space, fighting the evil empire... In a galaxy far, far away xD
davide874
Posts: 112
Joined: Sat Apr 19, 2008 10:45 am

Re: pcIp,hop1,hop2,hop3,hop3 <- How to?

Post by davide874 »

JIV wrote:com.l2jserver.gameserver.network.L2GameClient.getTrace()
a big kiss!

Testing right now i'll let you know :D
davide874
Posts: 112
Joined: Sat Apr 19, 2008 10:45 am

Re: pcIp,hop1,hop2,hop3,hop3 <- How to?

Post 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?
User avatar
Szponiasty
Advanced User
Advanced User
Posts: 557
Joined: Mon Apr 21, 2008 1:31 pm
Location: Eastern Poland

Re: pcIp,hop1,hop2,hop3,hop3 <- How to?

Post 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
Last edited by Szponiasty on Tue Dec 07, 2010 11:27 pm, edited 1 time in total.
And in the next chronicle they went into space, fighting the evil empire... In a galaxy far, far away xD
davide874
Posts: 112
Joined: Sat Apr 19, 2008 10:45 am

Re: pcIp,hop1,hop2,hop3,hop3 <- How to?

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
Szponiasty
Advanced User
Advanced User
Posts: 557
Joined: Mon Apr 21, 2008 1:31 pm
Location: Eastern Poland

Re: pcIp,hop1,hop2,hop3,hop3 <- How to?

Post 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 :P Corrected code above.
And in the next chronicle they went into space, fighting the evil empire... In a galaxy far, far away xD
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: pcIp,hop1,hop2,hop3,hop3 <- How to?

Post by JIV »

i think there is admin command //tracert or something like that.
Post Reply