Thread: Total Time Online (in minutes)

Results 1 to 9 of 9
  1. #1 Total Time Online (in minutes) 
    Evil
    Guest
    Before I start.. please note... TEST THIS ON A COPY OF YOUR SERVER BECAUSE IT WILL RESET PLAYER FILES!!!

    Don't cry to me say omgomgom my dood iz delted (

    Purpose: To determine how many minutes you've been online ever since you started! (Well, since you added this code.)

    Difficulty: I'd say 3/10

    Assumed Knowledge: Know how/where to add things. basic java..

    Server Base: I used Testscape. Should work on all? I don't know.

    Classes Modified: Client.java, PlayerSave.java

    Procedure
    Step 1: Open your Client.java and do a search for
    Code:
    				playerXP = loadgame.playerXP;
    You should see something like this
    Code:
    				playerItems = loadgame.playerItem;
    				playerItemsN = loadgame.playerItemN;
    				playerEquipment = loadgame.playerEquipment;
    				playerEquipmentN = loadgame.playerEquipmentN;
    				bankItems = loadgame.bankItems;
    				bankItemsN = loadgame.bankItemsN;
    				playerLevel = loadgame.playerLevel;
    				playerXP = loadgame.playerXP;
    ... At the end of playerXP = loadgame.playerXP; put
    Code:
    				playerGameTime = loadgame.playerGameTime;
    .


    Step 2: do a search for
    Code:
    		ResetBonus();
    		GetBonus();
    		WriteBonus();
                    Poisoned = false;
    which is basically your startup stuffs. add
    Code:
     		GetLastLogin(playerGameTime);
    after Poisoned = false;


    Step 3: Declare
    Code:
    		sendFrame126("@yel@Play Time: @whi@" +playerGameTime+ " min.", 6664);
    in the boolean process ... If you have something there already, such as coords or something, you should move them to a different frame.


    If you don't have any text that shows at the top of your screen, add
    Code:
    		sendFrame126("", 6570);
    		sendFrame126("", 6572);
    Step 4: Search for this
    Code:
    		//GameTime
    		playerGameCount++;
    		if (playerGameCount == 120000) { //evry minute
    			playerGameTime++;
    			playerGameCount = 0;
    		}
    .. replace it with
    Code:
    		//GameTime
    		playerGameCount++;
    		if (playerGameCount == 180) { //every minute
    			playerGameTime++;
    			playerGameCount = 0;
    		}


    [OPTIONAL] Step 5: Under Gametime should be something like
    Code:
    		if ((playerGameTime % 1440) == 0) { //1440 minutes = 24 hours
    			for (int i = 0; i < bankItems.length; i++) {
    				if (bankItems[i] == 995) {
    					bankItemsN[i] += ((bankItemsN / 100) * 4); //increase money like in real banks (4% rente)
    				}
    			}
    		}
    ... This adds to your money in bank after 24 hours of gameTime.. I don't know if it works, but you can keep it and tell me if you want to or not .

    -----Your done in Client.java-----

    Now open PlayerSave.java.

    Step 6: Your playerSave.java should look similar to this
    Code:
    import java.io.*;
    
    public class PlayerSave implements Serializable
    {
    	public String playerPass="";
    	public String playerName="";
    	//public String connectedFrom=""; //Don't enable this yet, or the old save-files get corrupted
    	public int playerPosX;
    	public int playerPosY;
    	public int playerHeight;
    	public int playerRights;
    	public int playerStatus;
    	public int playerHeadIcon;
    	public int[] playerItem;
    	public int[] playerItemN;
    	public int[] playerEquipment;
    	public int[] playerEquipmentN;
    	public int[] bankItems;
    	public int[] bankItemsN;
    	public int[] playerLevel;
    	public int[] playerXP;
    	public int[] playerQuest;
    	public int currentHealth;
    	public int maxHealth;
    
    
    	public PlayerSave(Player plr)
    	{
    		playerPass = plr.playerPass;
    		playerName = plr.playerName;
    		playerPosX = plr.absX;
    		playerPosY = plr.absY;
    		playerHeight = plr.heightLevel;
    		playerRights = plr.playerRights;
    		playerItem = plr.playerItems;
    		playerItemN = plr.playerItemsN;
    		bankItems = plr.bankItems;
    		bankItemsN = plr.bankItemsN;
    		playerEquipment = plr.playerEquipment;
    		playerEquipmentN = plr.playerEquipmentN;
    		playerLevel = plr.playerLevel;
    		maxHealth = plr.playerLevel[3];
    		currentHealth = plr.maxHealth;
    		playerXP = plr.playerXP;
    		//connectedFrom = plr.connectedFrom;
    
    	}
    }
    ...

    Under
    Code:
    	public int maxHealth;
    , add
    Code:
    	public int playerGameTime;
    ... and under
    Code:
    		//connectedFrom = plr.connectedFrom;
    , add
    Code:
    		playerGameTime = plr.playerGameTime;


    *From there on you can do what you like with the gameTime that has been added. What I did was make a command that told everyone how long you've been playing .

    When completed if should look like this below. However, your's will not say "Evilscape Server" at the top.


    Credits: This was my idea!! If you claim I "leeched it" from somewhere, please provide proof.

    I do NOT have a moparscape account, or anywhere else. If you see this ANYWHERE else, it was leeched!!!
     

  2. #2  
    Well, aren't you clever!

    Concious's Avatar
    Join Date
    Feb 2008
    Posts
    1,696
    Thanks given
    27
    Thanks received
    60
    Rep Power
    195
    so wait, it will say UpTime or like GameTime, 50 hours and 5 mins, something like that?
     

  3. #3  
    Evil
    Guest
    This is the total time your character has been logged onto your server.

    one sec, I'll post a picture.


    EDIT: pic is up now, check bottom of first post!
    Last edited by Evil; 03-01-2008 at 08:58 PM. Reason: pic is up now
     

  4. #4  
    mazeingmaze
    Guest
    Great job man
     

  5. #5  
    Community Veteran

    WH:II:DOW's Avatar
    Join Date
    Dec 2007
    Age
    34
    Posts
    2,017
    Thanks given
    145
    Thanks received
    872
    Rep Power
    4275
    ncie, won't use tho
    hella titties
     

  6. #6  
    t3aowner
    Guest
    i lol'd 2094 minutes. 60 minutes = 1 hour

    600 = 10
    1200 = 20
    1800 = 30

    Lol? wow
     

  7. #7  
    Registered Member
    Shamon King's Avatar
    Join Date
    Aug 2007
    Posts
    3,335
    Thanks given
    90
    Thanks received
    228
    Rep Power
    1363
    Quote Originally Posted by t3aowner View Post
    i lol'd 2094 minutes. 60 minutes = 1 hour

    600 = 10
    1200 = 20
    1800 = 30

    Lol? wow
    and why cant people play for 90 hours?
    good job looks nice
     

  8. #8  
    Evil
    Guest
    Quote Originally Posted by t3aowner View Post
    i lol'd 2094 minutes. 60 minutes = 1 hour

    600 = 10
    1200 = 20
    1800 = 30

    Lol? wow
    Why did you revive this?

    o well yeah I stayed logged in a lot of the time... There's no way I have 30+ hours of legit game time.. i do somewhat have a life
     

  9. #9  
    Client Hacking

    Join Date
    May 2007
    Age
    32
    Posts
    1,497
    Thanks given
    3
    Thanks received
    15
    Rep Power
    599
    Nice I can use this for my Premiums Status members
    elid.r-s
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Tags for this Thread

View Tag Cloud

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