Thread: need help with buy command.

Results 1 to 4 of 4
  1. #1 need help with buy command. 
    What....Do you mind?

    Join Date
    May 2007
    Age
    32
    Posts
    552
    Thanks given
    27
    Thanks received
    24
    Rep Power
    14
    Can someone help me with a buy command for disk of returning but it will give u it without the money

    Here's the command
    Code:
    if (command.equalsIgnoreCase("disk")) {
    if (playerHasItem(995, 100000))
    	    deleteItem(995, 100000);
    	    addItem(981, 1);
    sM("you bought Disk Of Returning.");
    } else {
    sM("You need 100k to buy Disk Of Returning.");
    }
    its delta source

    Edit: says "You need 100k to buy Disk Of Returning." if i do all other commands
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Aug 2008
    Age
    31
    Posts
    323
    Thanks given
    0
    Thanks received
    5
    Rep Power
    21
    if (command.equalsIgnoreCase("disk")) {
    if (playerHasItem(995, 100000)) {//this was missing
    deleteItem(995, 100000);
    addItem(981, 1);
    sM("you bought Disk Of Returning.");
    } else {
    sM("You need 100k to buy Disk Of Returning.");
    }
    }//this also

    another fail to use correct brackets
    there was no { after the if (playerHasItem(995, 100000)) so i'm surprised it even compiled?
    sigs annoy people
    Reply With Quote  
     

  3. #3  
    Registered Member
    minutes's Avatar
    Join Date
    Apr 2008
    Posts
    1,926
    Thanks given
    2
    Thanks received
    19
    Rep Power
    465
    if (command.equalsIgnoreCase("disk")) {
    if (!playerHasItem(995, 100000)){
    sM("You need 100k to buy Disk Of Returning.");
    } else {
    deleteItem(995, 100000);
    addItem(981, 1);
    sM("you bought Disk Of Returning.");
    } }
    My way



    click banner to join gtracer!
    Reply With Quote  
     

  4. #4  
    What....Do you mind?

    Join Date
    May 2007
    Age
    32
    Posts
    552
    Thanks given
    27
    Thanks received
    24
    Rep Power
    14
    Thanks minutes

    it worked

    and blueflamepaintball u were wrong on that code.

    Code:
    if (command.equalsIgnoreCase("disk")) {
    if (playerHasItem(995, 100000)) {//this was missing
    deleteItem(995, 100000);
    addItem(981, 1);
    sM("you bought Disk Of Returning.");
    } else {
    sM("You need 100k to buy Disk Of Returning.");
    }
    }//this also
    if i added the { it will give errors so don't say (i've tryed) "another fail to use correct brackets" as you got it wrong yourself.
    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

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •