Thread: 718 spawn command pay for items

Results 1 to 9 of 9
  1. #1 718 spawn command pay for items 
    Founder off ExilePsGroup
    ExilePsCoding's Avatar
    Join Date
    Apr 2013
    Age
    29
    Posts
    121
    Thanks given
    3
    Thanks received
    8
    Rep Power
    8
    Hi guys, i got a problem.

    I want to make a command to buy nature runes etc ingame with a command. I want basicly u buy 2500 nature runes and the price is 930k gold.

    But i made this:

    case "buynats":
    player.getInventory().containsItem(995, 930000);
    player.getInventory().deleteItem(995, 930000);
    player.getInventory().addItem(561, 2500); //nature runes
    return true;

    And even if you dont have cash in your inv you get the rules, if you got the money they delete it. So i reworked it into this:

    case "buynats":
    if (player.getInventory().containsItem(995, 930000));
    else if (player.getInventory().deleteItem(995, 930000)
    && player.getInventory().addItem(561, 2500)); //nature runes
    return true;

    I tryed this cuz it needs to give the runes + take the gold but then i got this error:

    starting...
    src\com\rs\game\player\content\Commands.java:2108: error: 'void' type not allowe
    d here
    else if (player.getInventory().deleteItem(995, 930000)
    .................................................. .........^
    1 error
    Press any key to continue . . .

    placed the dots to show u where he gives the error exactly
    There is no error if i do it the first time but like i told befor it gives the runes also when you dont have money. How do u solve this?
    Attached image
    Reply With Quote  
     

  2. #2  
    Donator


    Join Date
    Sep 2015
    Age
    24
    Posts
    532
    Thanks given
    68
    Thanks received
    115
    Rep Power
    414
    Uhm let me re-write it for you lol..

    Code:
    			case "buynats": 
    			    if (player.getInventory().containsItem(995, 930000)); {
    			                        player.getInventory().deleteItem(995, 930000);
    			                        player.getInventory().addItem(561, 2500);
    			                        player.sendMessage("You've bought 2500 nature runes for 930000 gp.");
    			                        return true;
    			                    }
    Reply With Quote  
     

  3. #3  
    Founder off ExilePsGroup
    ExilePsCoding's Avatar
    Join Date
    Apr 2013
    Age
    29
    Posts
    121
    Thanks given
    3
    Thanks received
    8
    Rep Power
    8
    Quote Originally Posted by GlamourGirl View Post
    Uhm let me re-write it for you lol..

    Code:
    			case "buynats": 
    			    if (player.getInventory().containsItem(995, 930000)); {
    			                        player.getInventory().deleteItem(995, 930000);
    			                        player.getInventory().addItem(561, 2500);
    			                        player.sendMessage("You've bought 2500 nature runes for 930000 gp.");
    			                        return true;
    			                    }
    tryd that command, players can still buy nats with the command without using cash
    Attached image
    Reply With Quote  
     

  4. #4  
    Donator


    Join Date
    Sep 2015
    Age
    24
    Posts
    532
    Thanks given
    68
    Thanks received
    115
    Rep Power
    414
    Quote Originally Posted by new-history View Post
    tryd that command, players can still buy nats with the command without using cash
    Here you go

    Code:
    			case "buynats": 
    		         if (player.getInventory().containsItems(new int[]{995}, new int[]{930000})) {
    		                                    player.getInventory().deleteItem(995, 930000);
    					                        player.getInventory().addItem(561, 2500);
    					                        player.sendMessage("You've bought 2500 nature runes for 930000 gp.");
    			
    		         } else {
    		        	 player.sendMessage("Please make sure you have the 930K in your inventory to buy 2500 Nature runes!");
    		         }
    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    Founder off ExilePsGroup
    ExilePsCoding's Avatar
    Join Date
    Apr 2013
    Age
    29
    Posts
    121
    Thanks given
    3
    Thanks received
    8
    Rep Power
    8
    Quote Originally Posted by GlamourGirl View Post
    Here you go

    Code:
    		case "buynats": 
    	         if (player.getInventory().containsItems(new int[]{995}, new int[]{930000})) {
    	                                    player.getInventory().deleteItem(995, 930000);
    				                        player.getInventory().addItem(561, 2500);
    				                        player.sendMessage("You've bought 2500 nature runes for 930000 gp.");
    		
    	         } else {
    	        	 player.sendMessage("Please make sure you have the 930K in your inventory to buy 2500 Nature runes!");
    			return true;	       
    	         }
    Thanks for the help! motified the command so it doesnt give error fergot the return true;
    Attached image
    Reply With Quote  
     

  7. #6  
    Donator


    Join Date
    Sep 2015
    Age
    24
    Posts
    532
    Thanks given
    68
    Thanks received
    115
    Rep Power
    414
    Quote Originally Posted by new-history View Post
    Thanks for the help! motified the command so it doesnt give error fergot the return true;
    Np , It's better for you to use eclipse tho..
    Reply With Quote  
     

  8. #7  
    Founder off ExilePsGroup
    ExilePsCoding's Avatar
    Join Date
    Apr 2013
    Age
    29
    Posts
    121
    Thanks given
    3
    Thanks received
    8
    Rep Power
    8
    Quote Originally Posted by GlamourGirl View Post
    Np , It's better for you to use eclipse tho..
    used that
    Attached image
    Reply With Quote  
     

  9. #8  
    Donator


    Join Date
    Sep 2015
    Age
    24
    Posts
    532
    Thanks given
    68
    Thanks received
    115
    Rep Power
    414
    Quote Originally Posted by Exile718 View Post
    used that
    Then why are you compiling :3
    Reply With Quote  
     

  10. #9  
    Founder off ExilePsGroup
    ExilePsCoding's Avatar
    Join Date
    Apr 2013
    Age
    29
    Posts
    121
    Thanks given
    3
    Thanks received
    8
    Rep Power
    8
    Quote Originally Posted by GlamourGirl View Post
    Then why are you compiling :3
    just to check tthe problem just befor u told me to use eclipse i used it :-)
    Attached image
    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. [718] spawn command
    By kwelje1 in forum Help
    Replies: 1
    Last Post: 02-10-2015, 12:01 AM
  2. 718 Spawn Command
    By Traxar in forum Help
    Replies: 6
    Last Post: 08-19-2013, 09:18 PM
  3. 718 spawn command
    By keyal in forum Help
    Replies: 7
    Last Post: 03-19-2013, 06:21 PM
  4. 718 Adding level requirements for items.
    By ProjectEco718 in forum Requests
    Replies: 1
    Last Post: 11-28-2012, 05:40 PM
  5. ::item full spawn command for players
    By coder eddie in forum Help
    Replies: 12
    Last Post: 11-25-2011, 12:21 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •