Thread: Loyalty Permanant title buying

Results 1 to 7 of 7
  1. #1 Loyalty Permanant title buying 
    Deathlypvpz Founder

    Join Date
    Aug 2012
    Posts
    486
    Thanks given
    6
    Thanks received
    116
    Rep Power
    43
    guys, im trying to make a boolean so you can buy the title, it activate's the boolean then if you have it true so you can give title free...

    Code:
                    case 113251:
                    if (c.LoyaltyPoints <= 100){
                    c.sendMessage("You Need 100 Loyalty Points for this (Play some more)");
                    } else {
                    c.LoyaltyPoints -=  100;
                    c.sendMessage("You Purchase&Apply Sir, You now have "+c.LoyaltyPoints+"");
                    c.playerTitle = 2;
                    c.sir = true;
                    if (c.sir = true) {
                    c.playerTitle = 2;
                    c.sendMessage("You Apply Sir, As You've Already Bought it!");
                    }
                    }
                    break;
    Why is this not working, do i need to return or something after announcing the boolean true?
    Please comment ASAP

    EDIT:
    Code:
                     case 113251:
                    if (c.LoyaltyPoints <= 100){
                    c.sendMessage("You Need 100 Loyalty Points for this (Play some more)");
                    }
                    if (c.sir = false) {
                    c.LoyaltyPoints -=  100;
                    c.sendMessage("You Purchase&Apply Sir, You now have "+c.LoyaltyPoints+"");
                    c.playerTitle = 2;
                    c.sir = true;
                    }
                    if (c.sir = true) {
                    c.playerTitle = 2;
                    c.sendMessage("You Apply Sir, As You've Already Bought it!");
                    }
                    }
                    break;
    Little edit
    Reply With Quote  
     

  2. #2  
    Registered Member
    vovik ukr's Avatar
    Join Date
    Aug 2010
    Posts
    1,240
    Thanks given
    136
    Thanks received
    187
    Rep Power
    278
    Quote Originally Posted by hack3r View Post
    guys, im trying to make a boolean so you can buy the title, it activate's the boolean then if you have it true so you can give title free...

    Code:
                    case 113251:
                    if (c.LoyaltyPoints <= 100){
                    c.sendMessage("You Need 100 Loyalty Points for this (Play some more)");
                    } else {
                    c.LoyaltyPoints -=  100;
                    c.sendMessage("You Purchase&Apply Sir, You now have "+c.LoyaltyPoints+"");
                    c.playerTitle = 2;
                    c.sir = true;
                    if (c.sir = true) {
                    c.playerTitle = 2;
                    c.sendMessage("You Apply Sir, As You've Already Bought it!");
                    }
                    }
                    break;
    Why is this not working, do i need to return or something after announcing the boolean true?
    Please comment ASAP

    EDIT:
    Code:
                     case 113251:
                    if (c.LoyaltyPoints <= 100){
                    c.sendMessage("You Need 100 Loyalty Points for this (Play some more)");
                    }
                    if (c.sir = false) {
                    c.LoyaltyPoints -=  100;
                    c.sendMessage("You Purchase&Apply Sir, You now have "+c.LoyaltyPoints+"");
                    c.playerTitle = 2;
                    c.sir = true;
                    }
                    if (c.sir = true) {
                    c.playerTitle = 2;
                    c.sendMessage("You Apply Sir, As You've Already Bought it!");
                    }
                    }
                    break;
    Little edit

    You have to save the boolean in playersave.java so each time the servers restart or the player relogs it won't loose the boolean
    Reply With Quote  
     

  3. #3  
    Ain't Messin' Around - Gary Clark Jr.

    Wolfs Darker's Avatar
    Join Date
    Jul 2012
    Posts
    1,530
    Thanks given
    598
    Thanks received
    464
    Rep Power
    252
    bro why you need a boolean? make it set your player title to w.e the id is and do c.logout();, it will save the player or at least should save
    Attached image
    Reply With Quote  
     

  4. #4  
    Registered Member
    vovik ukr's Avatar
    Join Date
    Aug 2010
    Posts
    1,240
    Thanks given
    136
    Thanks received
    187
    Rep Power
    278
    Quote Originally Posted by wolfs darker View Post
    bro why you need a boolean? make it set your player title to w.e the id is and do c.logout();, it will save the player or at least should save
    if you would of read he mentioned how he wants the players who already bought the title not to pay for it again.... There's more than one title you know....
    Reply With Quote  
     

  5. #5  
    PokeFrontier Java Developer

    Pokemon's Avatar
    Join Date
    May 2011
    Posts
    2,726
    Thanks given
    495
    Thanks received
    807
    Rep Power
    1260
    On top of that youre trying to manipulate the boolean through a condition which is a compiler error


    Attached image


    I love
    Reply With Quote  
     

  6. #6  
    (Official) Thanksgiver

    Arham's Avatar
    Join Date
    Jan 2013
    Age
    23
    Posts
    3,415
    Thanks given
    7,254
    Thanks received
    1,938
    Rep Power
    3905
    Strings...

    Save a string in the player saving.

    And your code doesn't follow java conventions at all.
    Code:
    c.LoyaltyPoints
    should be

    Code:
    c.loyaltyPoints
    As names should be camelCased, not FullyCased.

    Also,

    Code:
                    if (c.sir = false) {
                    c.LoyaltyPoints -=  100;
                    c.sendMessage("You Purchase&Apply Sir, You now have "+c.LoyaltyPoints+"");
                    c.playerTitle = 2;
                    c.sir = true;
                    }
                    if (c.sir = true) {
                    c.playerTitle = 2;
                    c.sendMessage("You Apply Sir, As You've Already Bought it!");
                    }
    Should be

    Code:
                    if (c.sir = false) {
                    	c.LoyaltyPoints -=  100;
                    	c.sendMessage("You Purchase&Apply Sir, You now have "+c.LoyaltyPoints+"");
                    	c.playerTitle = 2;
                    	c.sir = true;
                    } else if (c.sir = true) {
                    	c.playerTitle = 2;
                    	c.sendMessage("You Apply Sir, As You've Already Bought it!");
                    }
    But, as I said, you should use strings, not make a gazillion booleans...
    Attached image
    Attached image
    Quote Originally Posted by MrClassic View Post
    Arham is the official thanker!
    List of my work here!
    Reply With Quote  
     

  7. #7  
    Deathlypvpz Founder

    Join Date
    Aug 2012
    Posts
    486
    Thanks given
    6
    Thanks received
    116
    Rep Power
    43
    Quote Originally Posted by RelentlessPK View Post
    Strings...

    Save a string in the player saving.

    And your code doesn't follow java conventions at all.
    Code:
    c.LoyaltyPoints
    should be

    Code:
    c.loyaltyPoints
    As names should be camelCased, not FullyCased.

    Also,

    Code:
                    if (c.sir = false) {
                    c.LoyaltyPoints -=  100;
                    c.sendMessage("You Purchase&Apply Sir, You now have "+c.LoyaltyPoints+"");
                    c.playerTitle = 2;
                    c.sir = true;
                    }
                    if (c.sir = true) {
                    c.playerTitle = 2;
                    c.sendMessage("You Apply Sir, As You've Already Bought it!");
                    }
    Should be

    Code:
                    if (c.sir = false) {
                    	c.LoyaltyPoints -=  100;
                    	c.sendMessage("You Purchase&Apply Sir, You now have "+c.LoyaltyPoints+"");
                    	c.playerTitle = 2;
                    	c.sir = true;
                    } else if (c.sir = true) {
                    	c.playerTitle = 2;
                    	c.sendMessage("You Apply Sir, As You've Already Bought it!");
                    }
    But, as I said, you should use strings, not make a gazillion booleans...

    This looked way easier to use boolean's for and i need a else statment, saying you dont have enough...

    } else if (c.LoyaltyPoints <= 100){
    Because it would let people without 100 buy it..?
    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. Oledis' Loyalty Shop/Interface...
    By oledis in forum Snippets
    Replies: 45
    Last Post: 08-29-2014, 04:45 PM
  2. Loyalty Titles
    By ReactionX in forum Help
    Replies: 0
    Last Post: 01-05-2013, 08:08 AM
  3. Replies: 4
    Last Post: 12-28-2012, 03:31 PM
  4. Loyalty Shop Sprites
    By Nick_xD in forum Downloads
    Replies: 5
    Last Post: 12-21-2012, 01:54 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
  •