Quote:
Originally Posted by BaussHacker
Code:
if (DateTime.Now.Hour == 00 || DateTime.Now.Hour == 12)
{
// Vote
}
else
{
// Can't vote
}
Might as well make a check if the player already voted.
|
That would be for entire server to reset and doesn't keep track of when THAT IP last voted.
What I do is quite simple...
Make a little database that holds
username, ip, lastvoted
On login I check if that table contains the user's ip...
if ! contains their ip, they can vote (if they chose to vote, set that ip vote to now and credit their account)
if contains their ip, check when lastvoted was, if over 12 hours, let them vote. If they vote set that ip vote to now and credit account, if not don't let them vote
This means it's an IP based check vs username (multiple accounts all voting for rewards) and it takes into account when THEY last voted.