have a variable in Player.java that tracks the total amount donated, this value is never deducted from. So every donation increase this variable, and if this variable if over, 10, 20 or 50, give that donator rank on login.
|
So I'm going to add martins auto donation. In my server I do points instead of items, and I know how to change it to give points instead of items but what I'm confused about is how the server will know how to handle the ranks. For my server $10 = Donator $30 = Super donator and $50 = Elite donator. But what if a person donates $20 at some point, and then donates $30. That means they should receive Elite donator status for donating a total of 50, but since their second donation was $30 it would set their rank to Super donator instead of Elite. Basically how would I edit the system to make it work with ranks. And giving the correct rank for the added amount donated. All help would be great
have a variable in Player.java that tracks the total amount donated, this value is never deducted from. So every donation increase this variable, and if this variable if over, 10, 20 or 50, give that donator rank on login.
Okay that makes sense. But where would i put the totalDonated variable? Like where in the donation system code. Or should i put it in process() so that it is always checking and always updating?
Like in process() i could maybe do this?
if (c.totalDonated > 10 && c.totalDonated < 30) { //Donator Rank
c.playerRights = 4;
}
if (c.totalDonated > 30 && c.totalDonated < 50) { //Super Donator Rank
c.playerRights = 5;
}
if (c.totalDonated >= 50) { //Elite Donator Rank
c.playerRights = 6;
}
**or i could create an event of course.
DO NOT PUT IT IN PROCESS, why would you check every second, it ONLY updates when they donate, so where should you put it....
increase the totalDonated, when they donate... Where is that code? put it there.
Try it yourself...
as for the if statements, ever hear of if else?
start with the highest amount:
Code:if(am >= 50){ } else if(am >= 30){ } else if(am >= 10){ }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |