10.11.2009, 11:25
Im making an AFK check, basically if the player is in the same position for 3 seconds, their health is then checked.
If they move from that position, then they wont be checked again for another 3 seconds.
The position part is working perfectly, the problem im having is with the health part of it.
I want to check the players health, save it. Then lower their health by 1hp.
Then check it again to see if there was any change. If there wasn't a change, set their health back to the original amount, and don't check them again for another 3 seconds, because they're not AFk.
Im having trouble though comparing them. Because when i minimize the game, health can't be changed. So in theory it would show im AFK.
But it isnt...
So in each check, i want to check the position, if they're standing idle, then check their health. Decrease their health by 1hp. Check their health again to see if there was a decrease.
So how can i accuratly check their health, set their health and check it again.. All in one AFK check (1 second).
If they move from that position, then they wont be checked again for another 3 seconds.
The position part is working perfectly, the problem im having is with the health part of it.
I want to check the players health, save it. Then lower their health by 1hp.
Then check it again to see if there was any change. If there wasn't a change, set their health back to the original amount, and don't check them again for another 3 seconds, because they're not AFk.
Im having trouble though comparing them. Because when i minimize the game, health can't be changed. So in theory it would show im AFK.
But it isnt...
So in each check, i want to check the position, if they're standing idle, then check their health. Decrease their health by 1hp. Check their health again to see if there was a decrease.
So how can i accuratly check their health, set their health and check it again.. All in one AFK check (1 second).