Quote:
Originally Posted by go for it
" complete array of packets" ? i don't really understand what you mean by this
but all i know is that at any threat of your's which is executing by timer
ex. at trinity there is 7-9 threads executing with a timer , you can simply do a check at any of them like that
create datetime variable
if datetime now day is gw day
if datetime now min ( >= 0 and <= 5 ) or ( >= 30 and <= 35)
if last chat packet sent to tell players to get out is .min + 1 is less than now
foreach player online
if map = gw jail
send chat packet tellin them to get out
set a datetime variable = date time now
and do almost the same with npc to release them on time
never knew it got some special packets but that's how i handle it and i don't think it takes much cpu to check for 1 or 2 conditions per second
and i don't think there is a better way to handle it , you will always need to raise an event from a timer which will do that check on the timer
wish that was what you want
|
A thread running with a loop checking time should never take any memory literally. You could probably run 500 threads doing it and it wouldn't really do a lot.
What you should remember is if your loops are running for quite some time then you should always sleep the thread for minimum 1 millisecond.
A loop like this:
Will leak memory like there was no tomorrow.