PDA

View Full Version : [562]Making Items Only Available To...[562]



0wned You
December 23rd, 2010, 00:50
Ok, so I just worked this up, since I thought you guys might want it.
It's not that hard, so as long as you can follow directions, you should be fine.

Files needed: CommandPacketHandler.java
CommandsPacketHandler.java

1.) First, open up the files and search for


if(cmd[0].equals("item"))
in CommandPacketHandler.java

and


if(cmd[0].equals("::item"))
in CommandsPacketHandler.java

2.) In CommandPacketHandler.java, you should see that the beginning of the code looks like this:


if(cmd[0].equals("item")) {
if (cmd.length == 2 || cmd.length == 3) {
int item = Integer.valueOf(cmd[1]);
int amount = 1;

Press enter for a new line right after


int amount = 1;

and post this


if(item == ####) { //where #### is the item id
if(!player.getUsername().equals("myusername")) {
//or change "(!player.getUsername().equals("myusername"))"
//to "(!player.getRights < #))" where # is the rights of the player
player.getActionSender().sendMessage("This item can only be obtained by myusername!");
//or change "myusername" to something like "Admins"
return;
}
}

Then open up CommandsPacketHandler.java, and the same line of code like in CommandPacketHandler.java:


int item = Integer.valueOf(cmd[1]);
and add the exact same thing as you did in CommandPacketHandler.java.

That's it, compile and run! Thanks for reading and using this!

--0wned You

Emily
December 23rd, 2010, 00:55
or just add


&& player.getDisplayName().equals("name")) {


but what ever.

0wned You
December 23rd, 2010, 01:07
or just add


&& player.getDisplayName().equals("name")) {


but what ever.

Ha, yeah. Thanks.

bickets
December 23rd, 2010, 01:09
i think that's kinda PWNAGE BY EMILY... sorry had to say that, but yeh thanks

xJames
December 23rd, 2010, 01:21
or just add


&& player.getDisplayName().equals("name")) {


but what ever.
Yes, but if you wanted to make umm let's say ags for donator only, that won't work :p

Steve
December 23rd, 2010, 02:21
Yes, but if you wanted to make umm let's say ags for donator only, that won't work :p

Lol, if (player.isDonor()) {

xJames
December 23rd, 2010, 02:32
Lol, if (player.isDonor()) {
What i was stating, is that if you want to make a single item for donator only you could use this guys code, and Emily's would not work.

Emily
December 23rd, 2010, 02:33
What i was stating, is that if you want to make a single item for donator only you could use this guys code, and Emily's would not work.

Only staff should have to spawn anyways, if you did grand exchange properly :rolleyes:

0wned You
December 23rd, 2010, 02:35
Lol, my thread would turn into an argument Xd

xJames
December 23rd, 2010, 02:37
Only staff should have to spawn anyways, if you did grand exchange properly :rolleyes:
Lol, i would never add Grand Exchange because i thought RuneScape was more fun when you were sitting in fally trying to buy something.

`Conner
December 23rd, 2010, 02:42
^ this

Good work I guess.

Chief Smart
December 25th, 2010, 11:53
Nice tutorial, but there are easier ways for doing this ;P

0wned You
December 29th, 2010, 03:18
Yeah, I figured. I'm new-ish to this, so I know it's not going to be the best way of doing it, but I try. :P

runemagic
January 22nd, 2011, 12:06
Just got confused by the messy code

xlimiitz
May 9th, 2011, 20:05
hey steve can u help me in my client? please =] x