Thread: Who could make me time rank code?

Results 1 to 5 of 5
  1. #1 Who could make me time rank code? 
    Registered Member
    Division's Avatar
    Join Date
    Dec 2009
    Age
    29
    Posts
    2,208
    Thanks given
    41
    Thanks received
    78
    Rep Power
    97
    I have no idea to do this so here it goes.

    I need a script that makes you donator if you played 12 hours.
    So it means you have 12 hours gameplay (12 hours being online).

    It has to save when you log out.
    So first day you play 2 hours, next day 3, and so on till 12 hours.
    If its 12 hours it becomes donator.

    I know its weird idea, but i need it
    Reply With Quote  
     

  2. #2  
    Icy Realm Owner
    Icy Whip's Avatar
    Join Date
    May 2007
    Posts
    1,419
    Thanks given
    30
    Thanks received
    35
    Rep Power
    213
    This is going to be very sloppy as im writting it up on the site lol.

    declare these in client.java

    Code:
    public int hours = 0;
    public int minutes = 0;
    public int seconds = 0;
    (Yes i am going to be using process sorry, there is better ways with java to tell time and to implement it and all that crap, but im doing process cuz its an easy way)

    underneath process() add this

    Code:
    if(seconds < 120) {
    seconds += 1;
    } if(seconds >= 120) {
    seconds = 0;
    minutes += 1;
    } if(minutes == 60) {
    hours += 1;
    minutes = 0;
    }
    now all you need to do (depending on server base) have the server save the minutes, and hours the player is online. And this should work, if it does not let me know.


    Edit: add this into run()
    Code:
    if(hours >= 12) {
    //insert code to give donator status
    }


    Signature made by Mr. Ervis

    Any questions, MSN me; [email protected]
    Reply With Quote  
     

  3. #3  
    Registered Member
    Division's Avatar
    Join Date
    Dec 2009
    Age
    29
    Posts
    2,208
    Thanks given
    41
    Thanks received
    78
    Rep Power
    97
    hmm this is a good start, but how i can safe the hours it has played so the timer will stop when its logged off and go on when its logged back
    Reply With Quote  
     

  4. #4  
    Registered Member Moofens's Avatar
    Join Date
    Jul 2009
    Posts
    445
    Thanks given
    23
    Thanks received
    12
    Rep Power
    31
    inclient.java
    Code:
    if (gameplay <= 6000 && System.currentTimeMillis() - gameplaytimer >= 60000) 
    	{
    		gameplay ++;
    		gameplaytimer = System.currentTimeMillis();
    	}
    add this in player.java
    Code:
    public int gameplay;
    public long gameplaytimer;
    Now in client.java
    Code:
    					} else if (token.equals("character-GameTime")) {
    						gameplay = Integer.parseInt(token2);
    					}
    Code:
          			characterfile.write("character-GameTime= ", 0, 19);
          			characterfile.write(Integer.toString(gameplay), 0, Integer.toString(gameplay).length());

    Thats the timer
    Now the check time command (or you could add the timer in quest tab or something)
    Code:
           if (command.startsWith("GameTime")) {
    sM("+gameplay+");
    }
    Code:
    public void donatortimer()
    if(gameplay += 720) {
    playerRights = 1;
    }
    Add the void where your welcome message is so it checks your gametime everytime you log in
    or whatever playerright you set donator as
    its for delta
    90%aintaro for the timer 10% me for the commands and writing it
    Reply With Quote  
     

  5. #5  
    Registered Member
    Division's Avatar
    Join Date
    Dec 2009
    Age
    29
    Posts
    2,208
    Thanks given
    41
    Thanks received
    78
    Rep Power
    97
    but the timer stops when it loggs of and goes on when logged in?
    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
  •