Derranged
June 22nd, 2010, 04:40
This command is for normal players so they can purchase food..
In your CommandsPacketHandler.java add this:
if (cmd[0].equals("::buyfood")) {
if (Location.wildernessLevel(player.getLocation()) > 1) {
player.sm("You cannot use this command while inside of the wilderness.");
return;
}
if (!player.getInventory().contains(995, 20000)) {
player.sm("Sorry you need to have atleast 20k to use this.");
return;
}
player.getActionSender().sendChatboxInterface(228) ;
player.getActionSender().sendString("Do you wish to buy some food?", 228, 1);
player.getActionSender().sendString("Yes", 228, 2);
player.getActionSender().sendString("no", 228, 3);
}
Now in your DialogueOptions.java add this:
case 228: //buy food interface
if (buttonId == 2) {
player.getActionSender().sendCloseChatboxInterface ();
player.getInventory().deleteItem(995, 20000);
player.getInventory().additem(391, 10);
player.getActionSender().animateInterface(9827, 228, 2);
player.getActionSender().sendPlayerOnInterface(241 , 2);
player.sm("You buy food for 20k");
} else if (buttonId == 3) {
player.getActionSender().sendCloseChatboxInterface ();
}
break;
100% credit to me.
Nothing really to it.
In your CommandsPacketHandler.java add this:
if (cmd[0].equals("::buyfood")) {
if (Location.wildernessLevel(player.getLocation()) > 1) {
player.sm("You cannot use this command while inside of the wilderness.");
return;
}
if (!player.getInventory().contains(995, 20000)) {
player.sm("Sorry you need to have atleast 20k to use this.");
return;
}
player.getActionSender().sendChatboxInterface(228) ;
player.getActionSender().sendString("Do you wish to buy some food?", 228, 1);
player.getActionSender().sendString("Yes", 228, 2);
player.getActionSender().sendString("no", 228, 3);
}
Now in your DialogueOptions.java add this:
case 228: //buy food interface
if (buttonId == 2) {
player.getActionSender().sendCloseChatboxInterface ();
player.getInventory().deleteItem(995, 20000);
player.getInventory().additem(391, 10);
player.getActionSender().animateInterface(9827, 228, 2);
player.getActionSender().sendPlayerOnInterface(241 , 2);
player.sm("You buy food for 20k");
} else if (buttonId == 3) {
player.getActionSender().sendCloseChatboxInterface ();
}
break;
100% credit to me.
Nothing really to it.