Thread: 24 Hour Donor Chest Timer

Results 1 to 6 of 6
  1. #1 24 Hour Donor Chest Timer 
    Registered Member
    Join Date
    Mar 2011
    Posts
    569
    Thanks given
    146
    Thanks received
    65
    Rep Power
    52
    I am wanting to give donors access to the donor chest every 24 hours. What code do i need to add to give them access to the chest every 24 hours?

    This is what i currently have. I need c.donatorChest to equal 1 every 24 hours.

    case 104:
    if (c.isDonator == 1 && c.donatorChest == 0) {
    c.sendMessage("There appears to be nothing inside.");

    } else if (c.isDonator == 1 && c.donatorChest >= 1) {
    c.donatorChest -= 1;
    c.getItems().addItem(donatorRitem(),Misc.random(1) );
    //c.getItems().addItem(donatorRitem2(),Misc.random(1 ));
    c.getItems().addItem(995,Misc.random(1000000));

    } else {
    c.sendMessage("This is a donator-only chest.");
    }
    break;
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Jan 2013
    Posts
    485
    Thanks given
    58
    Thanks received
    132
    Rep Power
    248
    1. Set a new player save, call it something like, donatorChestTime.

    2. 10 min = 1,000 ticks, so 24 hours = 144000 ticks.

    3. Now check if the donatorChestTime save is 0, if yes, give tiems and set it back to 144000 ticks.

    Just like this:


    Code:
    	case 104:
    		// Check if donator and if the donatorChestTime is not 0.
    		if (c.isDonator == 1 && c.donatorChestTime != 0) {
    			c.sendMessage("There appears to be nothing inside.");	
    		// If he is a donator and donator chest time is 0 give items.
    		} else if (c.isDonator == 1 && c.donatorChestTime == 0) {
    			c.getItems().addItem(donatorRitem(),Misc.random(1) );
    			c.getItems().addItem(995,Misc.random(1000000));	
    			// Set donatorChestTime back to 24 hours.
    			c.donatorChestTime = 144000;			
    		} else {
    			c.sendMessage("This is a donator-only chest.");
    		}
    	break;
    Hope it helped, obviosuly make the declares at player.java, exactly like pk-points.

    In client.java at process() or whatever it called,

    check if dontorChestTime is not 0, if its not 0 then do donatorChestTime--;
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Mar 2011
    Posts
    569
    Thanks given
    146
    Thanks received
    65
    Rep Power
    52
    In playersave would it be like this?
    else if (token.equals("donatorChestTime")) {
    p.donatorChestTIme = Integer.parseInt(token2);
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Jan 2013
    Posts
    485
    Thanks given
    58
    Thanks received
    132
    Rep Power
    248
    Quote Originally Posted by DezzzNutz View Post
    In playersave would it be like this?
    Ye, I don't remember but find a tutorial on how set pk-points, exactly like this.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Mar 2011
    Posts
    569
    Thanks given
    146
    Thanks received
    65
    Rep Power
    52
    pk-points is like this:
    } else if (token.equals("pk-points")) {
    p.pkPoints = Integer.parseInt(token2);
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Mar 2011
    Posts
    569
    Thanks given
    146
    Thanks received
    65
    Rep Power
    52
    I tried it and it doesn't work correctly. Is there any other way of doing it or have i done something wrong?
    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. Replies: 13
    Last Post: 06-04-2011, 07:38 PM
  2. Replies: 15
    Last Post: 08-03-2010, 09:16 AM
  3. What do you do in ur 24 hours?
    By Realityx in forum Chat
    Replies: 11
    Last Post: 05-17-2009, 01:49 AM
  4. Removing 1 day of membership every 24 hours.
    By Hyperventilate in forum Help
    Replies: 13
    Last Post: 04-16-2009, 07:24 AM
  5. how do i add a 24 hour timer?
    By 1112 in forum Help
    Replies: 0
    Last Post: 11-03-2008, 05:03 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
  •