ORif (playerCommand.startsWith("item") && (c.playerRights >= 2)) {
It's one of the two.&& c.playerRights == 3) {
Thanks would be appreciated
|
How do i make the :ickup and ::item to be only for someone who has rights:3?
here my coding on commands atm... someone help please
}
if (playerCommand.startsWith("item")) {
try {
String[] args = playerCommand.split(" ");
if (args.length == 3) {
int newItemID = Integer.parseInt(args[1]);
int newItemAmount = Integer.parseInt(args[2]);
if ((newItemID <= 25000) && (newItemID >= 0)) {
c.getItems().addItem(newItemID, newItemAmount);
System.out.println("Spawned: " + newItemID + " by: "
+ c.playerName);
} else {
c.sendMessage("No such item.");
}
} else {
c.sendMessage("Use as ::item 995 200");
}
} catch (Exception e) {
}
}
-------------------------------------------------------------------
}
if (playerCommand.startsWith("pickup")) {
try {
String[] args = playerCommand.split(" ");
if (args.length == 3) {
int newItemID = Integer.parseInt(args[1]);
int newItemAmount = Integer.parseInt(args[2]);
if ((newItemID <= 25000) && (newItemID >= 0)) {
c.getItems().addItem(newItemID, newItemAmount);
System.out.println("Spawned: " + newItemID + " by: "
+ c.playerName);
} else {
c.sendMessage("No such item.");
}
} else {
c.sendMessage("Use as ::item 995 200");
}
} catch (Exception e) {
}
}
ORif (playerCommand.startsWith("item") && (c.playerRights >= 2)) {
It's one of the two.&& c.playerRights == 3) {
Thanks would be appreciated
lets get abit more in detail, as r0fl dr0pped said, you use,
so the number in the end defines the right Number, normaly 0 is a normal player, 1 is moderator or short mod, 2 administrator or short admin, and 3 is owner, after that it depends on the certain source you are using, feel free to play around.Code:c.playerRights == 3
So this code:
makes it owner only, the double = is important, you can change it with these chars: !, < or > these can change the range of rights like :Code:c.playerRights == 3
would be that if the playerrights are bigger then or 3 the player would be able to use the command.Code:c.playerRights >= 3
would be that if the playerrights are smaler then or 3 the player would be able to use the command.Code:c.playerRights <= 3
would be that if the playerrights are NOT 3 the player would be able to use the command.Code:c.playerRights != 3
hope it helped you a bit
Got skype? add me and i'll help you with this and anything you need in the future.
Skype: vespula_hf
its ok fixed it
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |