You allow them to spawn anything but still send the message 'You can't spawn this item'?
if ((newItemID <= 20500) && (newItemID >= 0)) {
c.getItems().addItem(newItemID, newItemAmount);
c.sendMessage("You can't spawn this item");
|
ok guys im making a spawn pk server and there is a pkp shop but i dont want people spawning the items in it ok so heres my ::item code
Code:if (playerCommand.startsWith("item") && c.playerRights > 0) { try { String[] args = playerCommand.split(" "); if (args.length == 3) { int newItemID = Integer.parseInt(args[1]); int newItemAmount = Integer.parseInt(args[2]); if ((newItemID <= 20500) && (newItemID >= 0)) { c.getItems().addItem(newItemID, newItemAmount); c.sendMessage("You can't spawn this item"); } else { c.sendMessage("That item ID does not exist."); } } } catch(Exception e) { } // HERE? } // HERE? }
i dont want them to spawn some items... i was trying differnt stuff
I'll just help you according to the title, because you're truly confusing me..
Just add this in client.java
then add this in your commandCode:public int unspawnable[] = {####}; public boolean isUnspawnable(int item) { for(int i = 0; i < unspawnable.length; i++) { if(unspawnable[i] == item) return true; } return false; }
Code:if(c.isUnspawnable(newItemID)) { return; }
My errors:
Code:src\server\model\players\packets\Commands.java:44: cannot find symbol symbol : method isUnspawnable(int) location: class server.model.players.Client if(c.isUnspawnable(newIt emID)) { ^ Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error Press any key to continue . . .
bump
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |