Jump to content
Sign in to follow this  
logicscape

[562]Opening urls with command

Recommended Posts

difficultly = 1
knowledge = copy/paste
what you're makein [URL="http://www.youtube.com/embed/Xp14g2E_62E"]CLICK HERE[/URL]

[SIZE="6"]CLIENT SIDE:[/SIZE]
open up [COLOR="Cyan"]packetparser.java[/COLOR]
\client\src\[COLOR="CYAN"]packetparser.java[/COLOR]

At the top of the page you should see imports kinda like this:
[CODE]import java.awt.Color;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;[/CODE]

Add this to the imports
[CODE]import java.awt.Desktop;
import java.net.URL;
import java.net.*;
import java.io.*;[/CODE]

ok now search for
[CODE]if ((i_311_ ^ 0xffffffff) != -100) {[/CODE]

You should see something like this
[CODE] if ((i_311_ ^ 0xffffffff) != -100) {
if (!string_314_.equals("")
&& Class214.method2787(string_314_, -122)) {
Class131_Sub35.anInt4583 = -1;
return true;
[COLOR="Red"]}[/COLOR][/CODE]

after the [COLOR="red"]}[/COLOR] add this
[CODE] if (string_315_.contains(":url:")) {
String url = string_315_;
string_315_ = "Opening browser to: "+url.substring(6);
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI(url.substring(6)));
} catch (Exception e) { }
} else {
openURL(url.substring(6));
}
}[/CODE]
finally add (IF YOU DON'T KNOW WHERE TO PUT DO THE SPOILER)
[CODE] public static void openURL(String url) {
String osName = System.getProperty("os.name");
try {
if (osName.startsWith("Windows"))
Runtime.getRuntime().exec(
"rundll32 url.dll,FileProtocolHandler " + url);
else {
String[] browsers = { "firefox", "opera", "konqueror",
"epiphany", "mozilla", "netscape" };
String browser = null;
for (int count = 0; count < browsers.length && browser == null; count++)
if (Runtime.getRuntime().exec(
new String[] { "which", browsers[count] })
.waitFor() == 0)
browser = browsers[count];
Runtime.getRuntime().exec(new String[] { browser, url });
}
} catch (Exception e) {
System.out.println( "Error in opening browser"
+ ":\n" + e.getLocalizedMessage());
}
}[/CODE]

[SPOILER="Click here if you dont know where to put"]finally search for
[CODE]public static void method1577(int arg0) {[/CODE]
above this add
[CODE] public static void openURL(String url) {
String osName = System.getProperty("os.name");
try {
if (osName.startsWith("Windows"))
Runtime.getRuntime().exec(
"rundll32 url.dll,FileProtocolHandler " + url);
else {
String[] browsers = { "firefox", "opera", "konqueror",
"epiphany", "mozilla", "netscape" };
String browser = null;
for (int count = 0; count < browsers.length && browser == null; count++)
if (Runtime.getRuntime().exec(
new String[] { "which", browsers[count] })
.waitFor() == 0)
browser = browsers[count];
Runtime.getRuntime().exec(new String[] { browser, url });
}
} catch (Exception e) {
System.out.println( "Error in opening browser"
+ ":\n" + e.getLocalizedMessage());
}
}[/CODE][/SPOILER]

Thats it for client side

[SIZE="6"]SERVER SIDE:[/SIZE]

open up[COLOR="CYAN"] CommandPacketHandler.java[/COLOR]
\SERVERNAME\src\com\rs2hd\packethandler\[COLOR="CYAN"]CommandPacketHandler.java[/COLOR]
Add this command:
[CODE]if (cmd[0].equals("[COLOR="red"]google[/COLOR]")) {
player.getActionSender().sendMessage("[COLOR="Lime"]:url: http://www.google.com[/COLOR]");
}[/CODE]
now open up [COLOR="CYAN"] CommandsPacketHandler.java[/COLOR]
\SERVERNAME\src\com\rs2hd\packethandler\[COLOR="CYAN"]CommandsPacketHandler.java[/COLOR]

and add same command but with "::"
[CODE] if (cmd[0].equals("[COLOR="red"]::google[/COLOR]")) {
player.getActionSender().sendMessage("[COLOR="Lime"]:url: http://www.google.com[/COLOR]");
}[/CODE]


[COLOR="red"]google[/COLOR] can be change for the name of the command

[COLOR="Lime"]:url: [url=http://www.google.com]Google[/url][/COLOR] can be change for the url but you need to keep :url: (website)

should be rest let me know if i'm missing something :)
if you used this please click [url]http://adf.ly/2uuNt[/url]
thanks :)

if you want to donate:

[URL="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=3FYEJGY3CW9CC&lc=US¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"][IMG]http://4.bp.blogspot.com/_KLy8J18UpsI/TUDqlcPqxyI/AAAAAAAAAFI/iE8RCsXEE6Y/s1600/paypal.png[/IMG][/URL]


*** i did not copy steve his tut is way diff from mine?:rofl:
i obviously took my time in it? so didn't copy him at all.
(not saying "steve" didnt take time)

Share this post


Link to post
Share on other sites
Nice but isnt there like 10 threads of this?

Share this post


Link to post
Share on other sites
[quote name='Joshy426']Nice but isnt there like 10 threads of this?[/QUOTE]
Four-ish.

Share this post


Link to post
Share on other sites
Thanks might use in future if I start my 562 again.

Share this post


Link to post
Share on other sites
[quote name='Mark!']Thanks might use in future if I start my 562 again.[/QUOTE]
yw :)

Share this post


Link to post
Share on other sites
I don't have the part after the imports. Where would I add it if I don't have it

Share this post


Link to post
Share on other sites
Will convert this to 602, thanks anyway:rolleyes:. Edited by apache ah64

Share this post


Link to post
Share on other sites
Well, here's what I'm going to do.
Seeing as you're telling people to donate to you or click a link because you made this, I'm going to compare it to Steve's.
And not just the thread itself, the actual code.

If it's the same. I will laugh at you.

EDIT - I get to laugh at you.
Exact same except for the one comment in the method.
Down to the string that says "Opening browser to"...

Hate people like you.
copying other people's tutorials to try and get people to think you're a good coder.... Edited by hellman2741

Share this post


Link to post
Share on other sites
[quote name='hellman2741']Well, here's what I'm going to do.
Seeing as you're telling people to donate to you or click a link because you made this, I'm going to compare it to Steve's.
And not just the thread itself, the actual code.

If it's the same. I will laugh at you.

EDIT - I get to laugh at you.
Exact same except for the one comment in the method.
Down to the string that says "Opening browser to"...

Hate people like you.
copying other people's tutorials to try and get people to think you're a good coder....[/QUOTE]

I hate people like this as well =/

He could have at least given Steve credits for it...

Share this post


Link to post
Share on other sites
[quote name='Haloofpower`']I hate people like this as well =/

He could have at least given Steve credits for it...[/QUOTE]

Yea, and not only does he not give Steve credits... He even says it's NOT steve's.
It's not that hard to say it was.
I'm making a new one of these to fix the current one because Alex renamed his client a bit.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×