06.01.2017, 00:24
Well, basically you have to do five things
1. Get the TickCount under OnPlayerConnect (furthermore at the point where he actually logs in)
2. Get the TickCount inside of your timer function
3. Get the difference using for example this method:
4. check if the difference (in ms) is more or equal to 25 minutes (assuming u want the payday to hapen every 25 minutes)
5. reset the "connectedTickCount" and do the payout
OR you just create a playertimer doing a payout every 25 minutes, as soon he connects
1. Get the TickCount under OnPlayerConnect (furthermore at the point where he actually logs in)
2. Get the TickCount inside of your timer function
3. Get the difference using for example this method:
PHP код:
stock getTickDiff(newTick, oldTick)
{
if (oldTick < 0 && newTick >= 0) {
return newTick - oldTick;
} else if (oldTick >= 0 && newTick < 0 || oldTick > newTick) {
return (cellmax - oldTick + 1) - (cellmin - newTick);
}
return newTick - oldTick;
}
5. reset the "connectedTickCount" and do the payout
OR you just create a playertimer doing a payout every 25 minutes, as soon he connects