that looks right but... you forgot about equipment and another thing why are you using a long.. it should be an int..
|
I'm trying to make a networth command on my 317 server.
I have this:
But when I type ::networth, the number changes each time.Code:public long totalvalue() { try { for(int i = 0; i < bankItems.length; i++){ totvalue += GetItemValue(bankItems[i]-1); } for(int i = 0; i < playerItems.length; i++){ totvalue += GetItemValue(playerItems[i]); } return (long)(totvalue); } catch ( Exception e ) {} return 0; }
Here's my networth command:
Code:if(command.startsWith("networth")) { sM("Your networth is @or2@"+totalvalue()+ "@bla@ coins."); }
that looks right but... you forgot about equipment and another thing why are you using a long.. it should be an int..
Eh, a long would do the job better cause many players will get over 2.1b in items+cash.
If you're casting an int to a long, it's still truncating..
declare it as a long and return it as a long
If you need to assign a number to it manually, do it like this
The literal L is promoting what the compiler thinks is an int to a longCode:long l = 9223372036854775807L;
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |