Thread: ::item command

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 ::item command 
    Banned
    Join Date
    Jun 2011
    Posts
    147
    Thanks given
    3
    Thanks received
    0
    Rep Power
    0
    Code:
    if (playerCommand.startsWith("item")) {
                            if (c.inWild()) {
                            c.sendMessage("you can't spawn items in the wilderness!");
                            return;
                            }
                                    try {
                                    String[] args = playerCommand.split(" ");
                                    if (args.length == 3) {
                                    int newItemID = Integer.parseInt(args[1]);
                                    int newItemAmount = Integer.parseInt(args[2]);
                                                    // add restricted items here.
                                                    int restrictedItems[] = {2438, 2439, 18202, 18203, 18204, 18205, 18206, 18207, 18208, 18209, 18210, 18211, 18212, 18213, 18214, 18215, 18216, 18217, 18218, 18219, 18220, 18221, 18222, 18223, 
    18224, 18225, 18226, 18227, 18228, 18229, 18230, 18231, 18232, 18233, 18234, 18235, 18236, 18237, 18238, 18239, 18240, 18241, 18242, 18243, 18244, 18245, 18246, 18247, 18248, 18249, 18250, 18251, 18252, 18253, 18254, 18255, 
    18256, 18257, 18258, 18259, 18260, 18261, 18262, 18263, 18264, 18265, 18266, 18267, 18268, 18269, 18270, 18271, 18272, 18273, 18274, 18275, 18276, 18277, 18278, 18279, 18280, 18281, 18282, 18283, 18284, 18285, 18286, 18287, 
    18288, 18289, 18290, 18291, 18292, 18293, 18294, 18295, 18296, 18297, 18298, 18299, 18300, 18301, 18302, 18303, 18304, 18305, 18306, 18307, 18308, 18309, 18310, 18311, 18312, 18313, 18314, 18315, 18316, 18317, 18318, 18319, 18320, 18321, 18322, 18323, 18324, 18325, 18326, 18327, 18328, 18329, 
    151, 152, 153, 154, 155, 156, 13746, 13747, 13748, 13749, 13750, 13751, 13752, 13753, 16033, 16044, 11694, 13363, 13362, 15328, 15329, 15330, 15331, 15332, 15333, 15334, 15335, 13845, 13846, 13847, 13848, 13849, 13850, 13851,
    13359, 13358, 15512, 15511, 13361, 13360, 15510, 15509, 15504, 15503, 15506, 15505, 15508, 15507, 14606, 14605, 16712, 
    16711, 18336, 18335, 17260, 17259, 16668, 16667, 16956, 16955, 16710, 16709, 17258, 17257, 16666, 16665, 16708, 16707, 
    17256, 17255, 16664, 16663, 17362, 17361, 17360, 17359, 17358, 17357, 16756, 16755, 16866, 16865, 17238, 17237, 17062, 
    17061, 996, 995, 17194, 17193, 17340, 17339, 16956, 16955, 16954, 16953, 16952, 16951, 16404, 16403, 16402, 16401, 16400, 
    16399, 16910, 16909, 16908, 16907, 16906, 16905, 18350, 18349, 18354, 18353, 18358, 18357, 18356, 18355, 18352, 18351, 
    13356, 13355, 13351, 13350, 13349, 13348, 13347, 13346, 13353, 13352, 13355, 13354, 19670, 19669, 18360, 18359, 18362, 
    18361, 18364, 18363, 4448, 4447, 13852, 13853, 13854, 13855, 13856, 13857, 13858, 13859, 13860, 13861, 13862, 13863, 
    13864, 13865, 13866, 13867, 13868, 13869, 13870, 13871, 13872, 13873, 13874, 13875, 13876, 13877, 13878, 13879, 13880, 
    13881, 13882, 13883, 13884, 13885, 13886, 13887, 13888, 13889, 13890, 13891, 13892, 13893, 13894, 13895, 13896, 13897, 
    13898, 13899, 13900, 13901, 13902, 13903, 13904, 13905, 13906, 13907, 13908, 13909, 13910, 13911, 13912, 13913, 13914, 
    13915, 13916, 13917, 13918, 13919, 
    13920, 13921, 13922, 13923, 13924, 13925, 13926, 13927, 13928, 13929, 13930, 13931, 13932, 13933, 13934, 13935, 13936, 
    13937, 13938, 13939, 13940, 13941, 13942, 13943, 13944, 13945, 13946, 13947, 13948, 13949, 13950, 13951, 13952, 13953, 
    13954, 13955, 13956, 13957, 1038, 1037, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 
    1053, 1054, 1055, 1056, 1057, 1058, 2422, 13531, 13532, 13533, 13534, 13535, 13536, 13537, 13538, 13539, 13540, 
    20072, 19784, 19785, 19786, 19787, 19788, 19789, 19790, 19780, 18786, 15300, 15301, 15302, 15303, 
    15773,  15774,  15818, 15888, 15890, 15891, 15924, 15935, 15946, 16001, 16023, 
    16034, 16045, 16090, 16126, 16137, 16152, 16184, 16206, 16217, 16258, 16259, 
    16260, 16261, 16272, 16293, 16294, 16315, 16316, 16359, 16360, 16381, 16382, 
    16403, 16404, 16425, 16426, 16667, 16668, 16689, 16690, 16711, 16712, 16733, 
    16734, 16837, 16838, 16839, 16840, 16841, 16842, 16843, 16844, 16909, 16910, 
    16955, 16956, 17039, 17040, 17143, 17144, 17145, 17146, 17147, 17148, 17149, 
    17150, 17259, 17260, 17361, 17362, 20822, 20823, 20824, 20825, 20826, 20833, 
    13734, 13735, 13737, 13738, 13739, 13740, 13741, 13742, 13743, 13744, 
    13745, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4753, 4754, 4755, 4756, 
    4757, 4758, 4759, 4760, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4708, 
    4709, 4710, 4711, 4712, 4713, 4714, 4715, 14484, 14485, 14486, 11695, 13450, 
    18349, 18350, 18351, 18352, 18353, 18354, 18355, 18356, 18357, 18358, 18359, 
    18360, 11702, 11703, 11704, 11705, 11706, 11707, 11708, 11709, 15486, 15487, 
    15502, 14642, 14645, 14642, 14645, 15433, 15435, 15474, 14641, 15432, 15434, 2570, 2571, 
    4856, 4857, 4858, 4859, 4860, 4861, 4862, 4863, 4864, 4865, 4866,  4867, 4868,  4869, 4870, 4871, 4872, 4873, 4874, 4875, 4876, 4877, 4878, 4879, 4880, 4881, 4882, 4883, 4884, 4885, 4886, 4887, 4888, 4889, 4890, 4891, 4892, 4893, 4894, 4895, 4896, 4897, 4898, 4899, 
    4900, 4901, 4902, 4903, 4904, 4905, 4906, 4907, 4908, 4909, 4910, 4911, 4912, 4913, 4914, 4915, 4916, 4917, 4918, 4919, 4920, 4921, 4922, 4923, 4924, 4925, 4926, 4927, 4928, 4929, 4930, 4931, 4932, 4933, 4934, 4935, 4936, 4937, 4938, 4939, 4940, 4941, 4942, 4943, 
    4944, 4945, 4946, 4947, 4948, 4949, 4950, 4951, 4952, 4953, 4954, 4955, 4956, 4957, 4958, 4959, 4960, 4961, 4962, 4963, 4964, 4965, 4966, 4967, 4968, 4969, 4970, 4971, 4972, 4973, 4974, 4975, 4976, 4977, 4978, 4979, 4980, 4981, 4982, 4983, 4984, 4985, 4986, 4987, 
    4988, 4989, 4990, 4991, 4992, 4993, 4994, 4995, 4996, 4997, 4998, 4999, 8850, 8849, 11665, 11664, 11663, 11676, 11675, 11674, 10611, 8842, 8839, 19711, 
    8840, 8841, 8842, 14997, 14998, 14999, 15000, 15001, 15002, 15003, 15004, 15005, 15006, 15007, 15008, 15009, 15010, 15011, 15012, 15013, 15014, 15015, 15016, 15017, 15018, 15019, 15020, 15021, 15022, 15023, 15024, 15025, 15026, 15027, 15028, 15029, 15030, 15031, 15032, 15033,
    15034, 15035, 15036, 15037, 15038, 15039, 15040, 15041, 15042, 15043, 15044, 15045, 15046, 15047, 15048, 15049, 15050, 15051, 15052, 15053, 15054, 15055, 15056, 15057, 15058,
    15059, 15060, 15061, 15062, 15063, 15064, 15065, 15066, 15067, 15068, 15069, 15070};
    
                                                    for (int i : restrictedItems) {
                                                    if (i == newItemID) {
                                                            if (c.playerRights != 3 && c.playerRights != 2) {
                                                                    c.sendMessage("You can't spawn this item!");
                                                            return;
                                                            }
                                                    }
                                            }
                                    if ((newItemID <= 30000) && (newItemID >= 0)) {
                                            c.getItems().addItem(newItemID, newItemAmount);
                                    } else {
                                            c.sendMessage("You can't spawn this item!");
                                    }
                                    } else {
                                            c.sendMessage("Wrong usage: (Ex:(::item_ID_Amount)(::item 995 1))");
                                    }
                                    } catch(Exception e) {
                            }}
    That is my ::item command, this has some items free spawn for everyone, admin + has free spawn for all. I want this command altered so it costs money to spawn all items for reg players up to mods.
    Reply With Quote  
     

  2. #2  
    Registered Member thatsgodzkill's Avatar
    Join Date
    May 2011
    Age
    28
    Posts
    159
    Thanks given
    0
    Thanks received
    6
    Rep Power
    3
    Well depends, thats going to take a lot more... but... try just making the shops... it would be a lot easier.... thats going to take hours just for some of the items to have prices...
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Jun 2011
    Posts
    147
    Thanks given
    3
    Thanks received
    0
    Rep Power
    0
    There should be an easy way to just make every item cost money and have it load through prices.txt or something.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Mar 2011
    Posts
    4,062
    Thanks given
    194
    Thanks received
    689
    Rep Power
    0
    holy shit i lold at the int inside the command xD

    ot: just put under the if(playerCommand...

    if (!c.getItems().playerHasItem(995, 100000)) {
    c.sendMessage("You need atleast 100,000 gp to spawn!");
    return;
    }
    Reply With Quote  
     

  5. #5  
    Banned
    Join Date
    Jun 2011
    Posts
    147
    Thanks given
    3
    Thanks received
    0
    Rep Power
    0
    You sure that makes the prices cost to spawn what they cost in prices.txt?
    Reply With Quote  
     

  6. #6  
    Banned

    Join Date
    Mar 2011
    Posts
    4,062
    Thanks given
    194
    Thanks received
    689
    Rep Power
    0
    Quote Originally Posted by walex80 View Post
    You sure that makes the prices cost to spawn what they cost in prices.txt?
    oh, no then....whats the point of that...just put them in shops
    Reply With Quote  
     

  7. #7  
    Banned
    Join Date
    Jun 2011
    Posts
    147
    Thanks given
    3
    Thanks received
    0
    Rep Power
    0
    Because I have a pk spawn server, and that's just how i want it pretty much.
    Reply With Quote  
     

  8. #8  
    Kacey
    I Am Kacey's Avatar
    Join Date
    May 2011
    Posts
    738
    Thanks given
    243
    Thanks received
    56
    Rep Power
    19
    Lol just make a click to spawn list.

    and create something like this

    case ####:
    if (c.inWild()) {
    c.sendMessage("You cannot do this right now");
    } else if(c.getItems().freeSlots() <= 1) {
    c.sendMessage("You need atleast 1 free slot's to use this feature.");
    } else if (c.getItems().playerHasItem(995, 7000000)) {
    c.getItems().deleteItem2(995, 7000000);
    c.getItems().addItem(4716, 1);
    } else {
    c.sendMessage("You need atleast 7M coins to buy this item.");
    }
    c.getPA().closeAllWindows();
    break;
    Nothing But Love
    Attached image
    Reply With Quote  
     

  9. #9  
    Registered Member

    Join Date
    Mar 2010
    Age
    29
    Posts
    686
    Thanks given
    35
    Thanks received
    92
    Rep Power
    157
    Code:
    if (playerCommand.startsWith("item")) {
        String[] args = playerCommand.split(' ');
    
        int id = Integer.parseInt(args[1]);
        int amt;
    
        if (args.length == 3) {
           amt = Integer.parseInt(args[2]);
        } else {
           amt = 1;
        }
    
        if (!c.getItems().playerHasItem(995, Server.itemHandler.ItemList[id].ShopValue)) {
            c.sendMessage("You need " + Server.itemHandler.ItemList[id].ShopValue + " coins to spawn that item!");
            return;
        } else {
            c.getItems().addItem(id, amt);
            c.getItems().deleteItem(995, Server.itemHandler.ItemList[id].ShopValue);
        }
    }
    I believe that would work.

    Sorry if there are any mistakes; haven't worked with servers in quite some time. Just did this off memory.
    "Let's practice what we preach, and with the acceptance that we expect from
    others, let's stop being so damn judgmental and crucifying everyone
    who doesn't fit in to our boxed-in perception of what is right."
    - Gillian Anderson
    Reply With Quote  
     

  10. #10  
    Registered Member

    Join Date
    Aug 2010
    Age
    30
    Posts
    1,026
    Thanks given
    373
    Thanks received
    175
    Rep Power
    103
    Quote Originally Posted by walex80 View Post
    Code:
    if (playerCommand.startsWith("item")) {
                            if (c.inWild()) {
                            c.sendMessage("you can't spawn items in the wilderness!");
                            return;
                            }
                                    try {
                                    String[] args = playerCommand.split(" ");
                                    if (args.length == 3) {
                                    int newItemID = Integer.parseInt(args[1]);
                                    int newItemAmount = Integer.parseInt(args[2]);
                                                    // add restricted items here.
                                                    int restrictedItems[] = {2438, 2439, 18202, 18203, 18204, 18205, 18206, 18207, 18208, 18209, 18210, 18211, 18212, 18213, 18214, 18215, 18216, 18217, 18218, 18219, 18220, 18221, 18222, 18223, 
    18224, 18225, 18226, 18227, 18228, 18229, 18230, 18231, 18232, 18233, 18234, 18235, 18236, 18237, 18238, 18239, 18240, 18241, 18242, 18243, 18244, 18245, 18246, 18247, 18248, 18249, 18250, 18251, 18252, 18253, 18254, 18255, 
    18256, 18257, 18258, 18259, 18260, 18261, 18262, 18263, 18264, 18265, 18266, 18267, 18268, 18269, 18270, 18271, 18272, 18273, 18274, 18275, 18276, 18277, 18278, 18279, 18280, 18281, 18282, 18283, 18284, 18285, 18286, 18287, 
    18288, 18289, 18290, 18291, 18292, 18293, 18294, 18295, 18296, 18297, 18298, 18299, 18300, 18301, 18302, 18303, 18304, 18305, 18306, 18307, 18308, 18309, 18310, 18311, 18312, 18313, 18314, 18315, 18316, 18317, 18318, 18319, 18320, 18321, 18322, 18323, 18324, 18325, 18326, 18327, 18328, 18329, 
    151, 152, 153, 154, 155, 156, 13746, 13747, 13748, 13749, 13750, 13751, 13752, 13753, 16033, 16044, 11694, 13363, 13362, 15328, 15329, 15330, 15331, 15332, 15333, 15334, 15335, 13845, 13846, 13847, 13848, 13849, 13850, 13851,
    13359, 13358, 15512, 15511, 13361, 13360, 15510, 15509, 15504, 15503, 15506, 15505, 15508, 15507, 14606, 14605, 16712, 
    16711, 18336, 18335, 17260, 17259, 16668, 16667, 16956, 16955, 16710, 16709, 17258, 17257, 16666, 16665, 16708, 16707, 
    17256, 17255, 16664, 16663, 17362, 17361, 17360, 17359, 17358, 17357, 16756, 16755, 16866, 16865, 17238, 17237, 17062, 
    17061, 996, 995, 17194, 17193, 17340, 17339, 16956, 16955, 16954, 16953, 16952, 16951, 16404, 16403, 16402, 16401, 16400, 
    16399, 16910, 16909, 16908, 16907, 16906, 16905, 18350, 18349, 18354, 18353, 18358, 18357, 18356, 18355, 18352, 18351, 
    13356, 13355, 13351, 13350, 13349, 13348, 13347, 13346, 13353, 13352, 13355, 13354, 19670, 19669, 18360, 18359, 18362, 
    18361, 18364, 18363, 4448, 4447, 13852, 13853, 13854, 13855, 13856, 13857, 13858, 13859, 13860, 13861, 13862, 13863, 
    13864, 13865, 13866, 13867, 13868, 13869, 13870, 13871, 13872, 13873, 13874, 13875, 13876, 13877, 13878, 13879, 13880, 
    13881, 13882, 13883, 13884, 13885, 13886, 13887, 13888, 13889, 13890, 13891, 13892, 13893, 13894, 13895, 13896, 13897, 
    13898, 13899, 13900, 13901, 13902, 13903, 13904, 13905, 13906, 13907, 13908, 13909, 13910, 13911, 13912, 13913, 13914, 
    13915, 13916, 13917, 13918, 13919, 
    13920, 13921, 13922, 13923, 13924, 13925, 13926, 13927, 13928, 13929, 13930, 13931, 13932, 13933, 13934, 13935, 13936, 
    13937, 13938, 13939, 13940, 13941, 13942, 13943, 13944, 13945, 13946, 13947, 13948, 13949, 13950, 13951, 13952, 13953, 
    13954, 13955, 13956, 13957, 1038, 1037, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 
    1053, 1054, 1055, 1056, 1057, 1058, 2422, 13531, 13532, 13533, 13534, 13535, 13536, 13537, 13538, 13539, 13540, 
    20072, 19784, 19785, 19786, 19787, 19788, 19789, 19790, 19780, 18786, 15300, 15301, 15302, 15303, 
    15773,  15774,  15818, 15888, 15890, 15891, 15924, 15935, 15946, 16001, 16023, 
    16034, 16045, 16090, 16126, 16137, 16152, 16184, 16206, 16217, 16258, 16259, 
    16260, 16261, 16272, 16293, 16294, 16315, 16316, 16359, 16360, 16381, 16382, 
    16403, 16404, 16425, 16426, 16667, 16668, 16689, 16690, 16711, 16712, 16733, 
    16734, 16837, 16838, 16839, 16840, 16841, 16842, 16843, 16844, 16909, 16910, 
    16955, 16956, 17039, 17040, 17143, 17144, 17145, 17146, 17147, 17148, 17149, 
    17150, 17259, 17260, 17361, 17362, 20822, 20823, 20824, 20825, 20826, 20833, 
    13734, 13735, 13737, 13738, 13739, 13740, 13741, 13742, 13743, 13744, 
    13745, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4753, 4754, 4755, 4756, 
    4757, 4758, 4759, 4760, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4708, 
    4709, 4710, 4711, 4712, 4713, 4714, 4715, 14484, 14485, 14486, 11695, 13450, 
    18349, 18350, 18351, 18352, 18353, 18354, 18355, 18356, 18357, 18358, 18359, 
    18360, 11702, 11703, 11704, 11705, 11706, 11707, 11708, 11709, 15486, 15487, 
    15502, 14642, 14645, 14642, 14645, 15433, 15435, 15474, 14641, 15432, 15434, 2570, 2571, 
    4856, 4857, 4858, 4859, 4860, 4861, 4862, 4863, 4864, 4865, 4866,  4867, 4868,  4869, 4870, 4871, 4872, 4873, 4874, 4875, 4876, 4877, 4878, 4879, 4880, 4881, 4882, 4883, 4884, 4885, 4886, 4887, 4888, 4889, 4890, 4891, 4892, 4893, 4894, 4895, 4896, 4897, 4898, 4899, 
    4900, 4901, 4902, 4903, 4904, 4905, 4906, 4907, 4908, 4909, 4910, 4911, 4912, 4913, 4914, 4915, 4916, 4917, 4918, 4919, 4920, 4921, 4922, 4923, 4924, 4925, 4926, 4927, 4928, 4929, 4930, 4931, 4932, 4933, 4934, 4935, 4936, 4937, 4938, 4939, 4940, 4941, 4942, 4943, 
    4944, 4945, 4946, 4947, 4948, 4949, 4950, 4951, 4952, 4953, 4954, 4955, 4956, 4957, 4958, 4959, 4960, 4961, 4962, 4963, 4964, 4965, 4966, 4967, 4968, 4969, 4970, 4971, 4972, 4973, 4974, 4975, 4976, 4977, 4978, 4979, 4980, 4981, 4982, 4983, 4984, 4985, 4986, 4987, 
    4988, 4989, 4990, 4991, 4992, 4993, 4994, 4995, 4996, 4997, 4998, 4999, 8850, 8849, 11665, 11664, 11663, 11676, 11675, 11674, 10611, 8842, 8839, 19711, 
    8840, 8841, 8842, 14997, 14998, 14999, 15000, 15001, 15002, 15003, 15004, 15005, 15006, 15007, 15008, 15009, 15010, 15011, 15012, 15013, 15014, 15015, 15016, 15017, 15018, 15019, 15020, 15021, 15022, 15023, 15024, 15025, 15026, 15027, 15028, 15029, 15030, 15031, 15032, 15033,
    15034, 15035, 15036, 15037, 15038, 15039, 15040, 15041, 15042, 15043, 15044, 15045, 15046, 15047, 15048, 15049, 15050, 15051, 15052, 15053, 15054, 15055, 15056, 15057, 15058,
    15059, 15060, 15061, 15062, 15063, 15064, 15065, 15066, 15067, 15068, 15069, 15070};
    
                                                    for (int i : restrictedItems) {
                                                    if (i == newItemID) {
                                                            if (c.playerRights != 3 && c.playerRights != 2) {
                                                                    c.sendMessage("You can't spawn this item!");
                                                            return;
                                                            }
                                                    }
                                            }
                                    if ((newItemID <= 30000) && (newItemID >= 0)) {
                                            c.getItems().addItem(newItemID, newItemAmount);
                                    } else {
                                            c.sendMessage("You can't spawn this item!");
                                    }
                                    } else {
                                            c.sendMessage("Wrong usage: (Ex:(::item_ID_Amount)(::item 995 1))");
                                    }
                                    } catch(Exception e) {
                            }}
    That is my ::item command, this has some items free spawn for everyone, admin + has free spawn for all. I want this command altered so it costs money to spawn all items for reg players up to mods.
    No offence but what a horrible code..

    Take a look on this page
    - Me
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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] Item Command
    By Spider- in forum Help
    Replies: 6
    Last Post: 09-03-2011, 05:17 PM
  2. [PI] Item Command
    By I'm A Jerk in forum Help
    Replies: 10
    Last Post: 04-24-2011, 03:31 AM
  3. [PI] Item Command [ Will Rep ]
    By nMik in forum Help
    Replies: 2
    Last Post: 04-24-2011, 02:30 AM
  4. 614 item command help
    By Rsp Ownz in forum Help
    Replies: 0
    Last Post: 08-20-2010, 04:13 AM
  5. ::item command Finding your item?
    By zx Bubbles zx in forum Requests
    Replies: 10
    Last Post: 11-10-2008, 06:41 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
  •