Jump to content

How to calculate buys per hour?


cattycatcat

Recommended Posts

Hello guys i finished my shop buying script it works just fine, made simple paint which shows time and money spent but i;m struggling to create buys/hr in my paint.Currently i do it like this: once i bank i just do increase in 27 but due some lagg it can add upto 80+.So if sombody could post flawless solution that would be  damn good :D

Link to comment
Share on other sites

	int itemCount = (int) getScript().getInventory().getAmount("Beer");

	public int getIncrease(String name) {
		int count = 0;
		for (Item item : getScript().getInventory().getItems()) {
			if (item == null)
				break;
			if (item.getName().equals(name))
				count++;
		}
		int increaseAmount = count - itemCount;
		itemCount = count;
		return increaseAmount;
	} 

Don't forget to handle when you bank and the increase becomes negative smile.png

 

Edited by House
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...