Thread: ::item command with unspawnables and cash remove.

Results 1 to 5 of 5
  1. #1 ::item command with unspawnables and cash remove. 
    Registered Member

    Join Date
    Sep 2011
    Posts
    5,121
    Thanks given
    1,333
    Thanks received
    1,795
    Rep Power
    1731
    I need the ::item command which actually restricts you from spawning certain items. I'd also like it so that it actually spawns items with cash in your inventory. E.g if you were to spawn a whip it would spawn the item and withdraw a certain amount of coins from your inventory. I've already searched for this and got the command with cash removal but no unspawnables.. I also have the command with unspawnables with no cash removal.

    This is what I have.

    Unspawnables with no cash removal.

    Code:
    if (playerCommand.startsWith("item")) {
    				try {
    					String[] args = playerCommand.split(" ");
    					if (args.length == 3) {
    						int [] unspawnAbles = {995,996};
    						int newItemID = Integer.parseInt(args[1]);
    						int newItemAmount = Integer.parseInt(args[2]);
    						int req = c.getShops().getItemShopValue(newItemID) * newItemAmount;
    						for (int j = 0; j < unspawnAbles.length; j++) {
    						if (newItemID == unspawnAbles[j]){	
    						c.sendMessage(""+server.model.items.Item.getItemName(newItemID)+" is a restricted item.");
    						return;
    						}
    					}
    						if (req < 0) {
    						c.sendMessage("<col=399>The amount you trying to spawn is too high, please try spawning less.");
    						return;
    						}
    						if (!c.getItems().playerHasItem(995,req)) {
    						c.sendMessage("<col=255>You need atleast "+req+" coins to spawn "+newItemAmount+"x "+server.model.items.Item.getItemName(newItemID)+".");
    						return;
    						}
    						if ((newItemID <= 24000) && (newItemID >= 0)) {
    							c.getItems().addItem(newItemID, newItemAmount);	
    							c.sendMessage("<col=1800>You have succesfully purchased "+newItemAmount+"x "+server.model.items.Item.getItemName(newItemID)+" for "+req+".");	
    						} else {
    							c.sendMessage("No such item.");
    						}
    					} else {
    						c.sendMessage("Use as ::item 995 200 for example 200 gp");
    					}
    				} catch(Exception e) {
    					
    				}
    			}

    Code with cash removal but does NOT have unspawnables.

    Code:
    Command.startsWith("item")) {
    				try {
    					String[] args = playerCommand.split(" ");
    					if (args.length == 3) {
    						int newItemID = Integer.parseInt(args[1]);
    						int newItemAmount = Integer.parseInt(args[2]);
    						int req = c.getShops().getItemShopValue(newItemID) * newItemAmount;
    						if (req < 0) {
    						c.sendMessage("<col=399>The amount you trying to spawn is too high, please try spawning less.");
    						return;
    						}
    						if (!c.getItems().playerHasItem(995,req)) {
    						c.sendMessage("<col=255>You need atleast "+req+" coins to spawn "+newItemAmount+"x "+server.model.items.Item.getItemName(newItemID)+".");
    						return;
    						}
    						if ((newItemID <= 24000) && (newItemID >= 0)) {
    							c.getItems().addItem(newItemID, newItemAmount);	
                                                            c.getItems().deleteItem(995, c.getItems().getItemSlot(995), req);
    							c.sendMessage("<col=1800>You have succesfully purchased "+newItemAmount+"x "+server.model.items.Item.getItemName(newItemID)+" for "+req+".");	
    						} else {
    							c.sendMessage("No such item.");
    						}
    					} else {
    						c.sendMessage("Use as ::item 995 200 for example 200 gp");
    					}
    				} catch(Exception e) {
    					
    				}
    			}



    Adding a limit to the quantity you can spawn would also be great, but this is would I need the most. I'd highly appreciate if someone got this to work and I'd be more then willing to rep++.

    Thanks in advance.
    Reply With Quote  
     

  2. #2  
    Aymen
    Guest
    well what i have done for you here is i added all the rare items and made it UN spawn able not all rare items tho u gotta add rest


    Code:
    		if (playerCommand.startsWith("item") || playerCommand.startsWith("pickup")) {
    				if (c.inWild() || c.isInArd() || c.isInPbox() || c.isInFala() || c.inFunPk())
    					return;
    				try {
    				String[] args = playerCommand.split(" ");
    				int[] unspawnable = {995,13510,13512,13514,13516,13518,13520,13522,13524,13526,13528,13530,13532,13534,13536,13538,9470,9005,8901,11021,11018,11016,1672,11020,6726,6727,10566,9946,9944,9945,10939,10940,10945,9944,2631,10692,13810,11789,11790,8908,9948,9949,10646,9470,1,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,
    				11718,11719,11720,11721,11722,11723,998,11724,11725,11726,11727,11695,11696,11697,11698,11699,11700,11701,11702,11703,11704,11705,11706,11707,11708,11709,11710,11711,11712,11713,11714,11715,10330,
    				10331,10332,10333,10334,10335,10336,10337,10338,10339,10340,10341,10342,10343,10344,10345,10346,10347,10348,10349,10350,10351,10352,10353,
    				8839,8840,8841,8842,8843,11663,11664,11665,999,13889,13902,15000,15001,15018,15019,15020,15220,13736,13738,13740,13742,13744,9789,989,990,
    				9790,9813,9814,10662,2422,13500,13502,13504,13506,10654,11676,10611,10734,11675,11674,11278,15037,15038,15039,15040,2661,10637,10556,
    				13899,13902,9096,9084,9091,9092,9093,9097,9098,9099,9100,9101,9102,9103,9104,9105,9106,10609,11367,11368,11369,11370,11371,11372,11373,11374,
    				11375,11376,11377,11378,11379,11380,11381,11382,11383,11384,11385,11386,11387,11388,11389,11390,11391,11392,11393,11394,11395,11396,11397,
    				11398,11399,11400,11401,11402,11403,11404,11405,11406,11407,11408,11409,11410,11411,11412,11413,11414,11415,11416,11417,11418,11419,11420,
    				10556,10637,10778,2662,10043,10041,10042,10044,10045,10046,10047,10048,10049,10050,10051,10052,10053,10054,10055,10056,10057,10058,10059,10060,
    				10061,10062,10063,10064,10065,10066,10067,10068,9921,9922,9923,9924,9925,13540,13542,13544,13546,13548,13550,13552,13554,13556,13558,13560,13562,
    				14484,14485,14486,13738,13740,13742,13744,18786,19780,19784,15486,15487,13746,
    				13747,13748,1349,13750,13751,13752,13753,18333,18334,18335,18349,18350,18351,
    				18352,18353,18354,18355,18356,18357,18358,18359,18360,1635,12158,12159,12160,12161,12163,12168,
    				13884,13885,13886,1890,13891,13892,13896,13897,13898,13902,13903,13904,
    				13908,13909,13910,13914,13915,13916,13920,13921,13922,13926,13927,13928,
    				13887,13888,13889,13893,13894,13895,13899,13900,13901,13905,13906,13907,
    				13911,13912,13913,13917,13918,13919,13923,13924,13925,13929,13930,13931,
    				13858,13859,13860,13861,13862,13863,13864,13865,13866,13867,13868,15272,15271,15273,15275,15270,15276,15277,
    				13869,13932,13933,13934,13935,13936,13937,13938,13939,13940,13941,13942,13943,
    				13870,13871,13872,13873,13874,13875,13876,13877,13878,13879,13880,13881,13882,13883,
    				13944,13945,13946,13947,13948,13949,13950,13951,13952,13953,13954,13955,13956,13957,
    				11283,11284,11285,6570,
    				13362,13360,13358,13355,13354,13352,13350,13348,13346,13344,13342,13340,13370,13336,
    				13450,13451,13452,13453,13461,20072,15018,15019,15020,15220,8839,8840,8841,8842,11663,11664,11665,
    				4724,4725,4726,4727,4728,4729,4730,4731,4904,4905,4906,4907,4910,4911,4912,4913,
    				4916,4917,4918,4919,4922,4923,4924,4925,4716,4717,4718,4719,4720,4721,4722,4723,4880,4881,4882,4883,
    				4886,4887,4888,4889,4892,4893,4894,4895,4898,4899,4900,4901,
    				4732,4733,4734,4735,4736,4737,4738,4739,4928,4929,4930,4931,
    				4934,4935,4936,4937,4940,4941,4942,4943,4946,4947,4948,4949,4708,4709,4710,4711,4712,4713,4714,4715,4856,4857,4858,
    				4859,4862,4863,4864,4865,4868,4869,4870,4871,4874,4875,4876,4877,4753,4754,4755,4756,4757,4758,4759,4760,
    				4976,4977,4978,4979,4982,4983,4984,4985,4988,4989,4990,4991,4994,4995,4996,4997,
    				4745,4746,4747,4748,4749,4750,4751,4752,4952,4953,4954,4955,4958,4959,4960,4961,4964,4965,4966,4967,
    				4970,4971,4972,4973,
    				19590,19591,11814,11815,11816,11817,11818,11819,11820,11821,19594,19595,19598,19599,19578,19579,19576,19577,
    				19574,19575,19572,19573,15332,15333,15334,15335,
    				4860,4861,4866,4867,4872,4873,4878,4879,4932,4933,4938,4939,4944,4945,4950,4951,
    				4908,4909,4914,4915,4920,4921,4926,4927,4956,4957,4962,4963,4968,4969,4974,4975,
    				4980,4981,4986,4987,4992,4993,4998,4999,4884,4885,4890,4891,4896,4897,4902,4903};
    				if (args.length == 3) {
    					int newItemID = Integer.parseInt(args[1]);
    					int newItemAmount = Integer.parseInt(args[2]);
    					int itemID = Integer.parseInt(args[1]);
    					for(int i : unspawnable) {
    						if(c.playerRights <= 2) {
    							if(itemID == i) {
    								c.sendMessage("You cannot spawn this item.");
    								return;
    							}
    						}
    					}
    					if ((newItemID <= 30000) && (newItemID >= 0)) {
    						c.getItems().addItem(newItemID, newItemAmount);
    						//System.out.println("Spawned: " + newItemID + " by: " + c.playerName);
    						c.sendMessage("Spawned: " + newItemID + "");
    					} else {
    						c.sendMessage("That item ID does not exist.");
    					}
    				} else {
    					c.sendMessage("Wrong command or doesn't exist");
    				}
    				} catch (Exception e) {
    				
    				}
    			}
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Sep 2011
    Posts
    5,121
    Thanks given
    1,333
    Thanks received
    1,795
    Rep Power
    1731
    Quote Originally Posted by puretarget View Post
    well what i have done for you here is i added all the rare items and made it UN spawn able not all rare items tho u gotta add rest


    Code:
    		if (playerCommand.startsWith("item") || playerCommand.startsWith("pickup")) {
    				if (c.inWild() || c.isInArd() || c.isInPbox() || c.isInFala() || c.inFunPk())
    					return;
    				try {
    				String[] args = playerCommand.split(" ");
    				int[] unspawnable = {995,13510,13512,13514,13516,13518,13520,13522,13524,13526,13528,13530,13532,13534,13536,13538,9470,9005,8901,11021,11018,11016,1672,11020,6726,6727,10566,9946,9944,9945,10939,10940,10945,9944,2631,10692,13810,11789,11790,8908,9948,9949,10646,9470,1,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,
    				11718,11719,11720,11721,11722,11723,998,11724,11725,11726,11727,11695,11696,11697,11698,11699,11700,11701,11702,11703,11704,11705,11706,11707,11708,11709,11710,11711,11712,11713,11714,11715,10330,
    				10331,10332,10333,10334,10335,10336,10337,10338,10339,10340,10341,10342,10343,10344,10345,10346,10347,10348,10349,10350,10351,10352,10353,
    				8839,8840,8841,8842,8843,11663,11664,11665,999,13889,13902,15000,15001,15018,15019,15020,15220,13736,13738,13740,13742,13744,9789,989,990,
    				9790,9813,9814,10662,2422,13500,13502,13504,13506,10654,11676,10611,10734,11675,11674,11278,15037,15038,15039,15040,2661,10637,10556,
    				13899,13902,9096,9084,9091,9092,9093,9097,9098,9099,9100,9101,9102,9103,9104,9105,9106,10609,11367,11368,11369,11370,11371,11372,11373,11374,
    				11375,11376,11377,11378,11379,11380,11381,11382,11383,11384,11385,11386,11387,11388,11389,11390,11391,11392,11393,11394,11395,11396,11397,
    				11398,11399,11400,11401,11402,11403,11404,11405,11406,11407,11408,11409,11410,11411,11412,11413,11414,11415,11416,11417,11418,11419,11420,
    				10556,10637,10778,2662,10043,10041,10042,10044,10045,10046,10047,10048,10049,10050,10051,10052,10053,10054,10055,10056,10057,10058,10059,10060,
    				10061,10062,10063,10064,10065,10066,10067,10068,9921,9922,9923,9924,9925,13540,13542,13544,13546,13548,13550,13552,13554,13556,13558,13560,13562,
    				14484,14485,14486,13738,13740,13742,13744,18786,19780,19784,15486,15487,13746,
    				13747,13748,1349,13750,13751,13752,13753,18333,18334,18335,18349,18350,18351,
    				18352,18353,18354,18355,18356,18357,18358,18359,18360,1635,12158,12159,12160,12161,12163,12168,
    				13884,13885,13886,1890,13891,13892,13896,13897,13898,13902,13903,13904,
    				13908,13909,13910,13914,13915,13916,13920,13921,13922,13926,13927,13928,
    				13887,13888,13889,13893,13894,13895,13899,13900,13901,13905,13906,13907,
    				13911,13912,13913,13917,13918,13919,13923,13924,13925,13929,13930,13931,
    				13858,13859,13860,13861,13862,13863,13864,13865,13866,13867,13868,15272,15271,15273,15275,15270,15276,15277,
    				13869,13932,13933,13934,13935,13936,13937,13938,13939,13940,13941,13942,13943,
    				13870,13871,13872,13873,13874,13875,13876,13877,13878,13879,13880,13881,13882,13883,
    				13944,13945,13946,13947,13948,13949,13950,13951,13952,13953,13954,13955,13956,13957,
    				11283,11284,11285,6570,
    				13362,13360,13358,13355,13354,13352,13350,13348,13346,13344,13342,13340,13370,13336,
    				13450,13451,13452,13453,13461,20072,15018,15019,15020,15220,8839,8840,8841,8842,11663,11664,11665,
    				4724,4725,4726,4727,4728,4729,4730,4731,4904,4905,4906,4907,4910,4911,4912,4913,
    				4916,4917,4918,4919,4922,4923,4924,4925,4716,4717,4718,4719,4720,4721,4722,4723,4880,4881,4882,4883,
    				4886,4887,4888,4889,4892,4893,4894,4895,4898,4899,4900,4901,
    				4732,4733,4734,4735,4736,4737,4738,4739,4928,4929,4930,4931,
    				4934,4935,4936,4937,4940,4941,4942,4943,4946,4947,4948,4949,4708,4709,4710,4711,4712,4713,4714,4715,4856,4857,4858,
    				4859,4862,4863,4864,4865,4868,4869,4870,4871,4874,4875,4876,4877,4753,4754,4755,4756,4757,4758,4759,4760,
    				4976,4977,4978,4979,4982,4983,4984,4985,4988,4989,4990,4991,4994,4995,4996,4997,
    				4745,4746,4747,4748,4749,4750,4751,4752,4952,4953,4954,4955,4958,4959,4960,4961,4964,4965,4966,4967,
    				4970,4971,4972,4973,
    				19590,19591,11814,11815,11816,11817,11818,11819,11820,11821,19594,19595,19598,19599,19578,19579,19576,19577,
    				19574,19575,19572,19573,15332,15333,15334,15335,
    				4860,4861,4866,4867,4872,4873,4878,4879,4932,4933,4938,4939,4944,4945,4950,4951,
    				4908,4909,4914,4915,4920,4921,4926,4927,4956,4957,4962,4963,4968,4969,4974,4975,
    				4980,4981,4986,4987,4992,4993,4998,4999,4884,4885,4890,4891,4896,4897,4902,4903};
    				if (args.length == 3) {
    					int newItemID = Integer.parseInt(args[1]);
    					int newItemAmount = Integer.parseInt(args[2]);
    					int itemID = Integer.parseInt(args[1]);
    					for(int i : unspawnable) {
    						if(c.playerRights <= 2) {
    							if(itemID == i) {
    								c.sendMessage("You cannot spawn this item.");
    								return;
    							}
    						}
    					}
    					if ((newItemID <= 30000) && (newItemID >= 0)) {
    						c.getItems().addItem(newItemID, newItemAmount);
    						//System.out.println("Spawned: " + newItemID + " by: " + c.playerName);
    						c.sendMessage("Spawned: " + newItemID + "");
    					} else {
    						c.sendMessage("That item ID does not exist.");
    					}
    				} else {
    					c.sendMessage("Wrong command or doesn't exist");
    				}
    				} catch (Exception e) {
    				
    				}
    			}

    Thanks for your reply, you've made these items unspawnable but you haven't made it so that whenever you spawn a normal item it uses cash from your inventory and actually takes the cash. The methods I had could do one and not the other. So for example, the unspawnable item list would not take cash from your inventory, but the other command which could spawn all items, with no restrictions, actually used cash. The problem is I need both - Hence the fact that I need it so that certain items are unspawnables and that EVERY item you spawn, will actually take cash from your inventory upon doing so.

    Thanks again.
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Sep 2011
    Posts
    5,121
    Thanks given
    1,333
    Thanks received
    1,795
    Rep Power
    1731
    Bump still need this.
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Sep 2011
    Posts
    5,121
    Thanks given
    1,333
    Thanks received
    1,795
    Rep Power
    1731
    Thread closed. Sorted it myself.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Unspawnables
    By Charlie in forum Help
    Replies: 26
    Last Post: 07-10-2012, 02:08 AM
  2. Voting 4 cash command [PI]
    By thim slug in forum Help
    Replies: 11
    Last Post: 10-08-2011, 05:47 PM
  3. [PI] remove item command
    By EricFtw in forum Help
    Replies: 2
    Last Post: 06-29-2011, 01:59 PM
  4. Voting 4 cash command [PI]
    By thim slug in forum Help
    Replies: 0
    Last Post: 12-20-2010, 12:21 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •