Here are some code snippets to add a timer to your plugin
Create a few function prototypes and a few timer variables:
Then add a few functioncalls and variable checks to OnPulse function:
Then put whatever you want to happen on a timer in the timer function code:
If you want to create custom timers for specific events then just set your timer variables (Ex: timer4s = GetTickCount()+4000 conditionally
Create a few function prototypes and a few timer variables:
Code:
VOID timer1sec();
VOID timer2sec();
VOID timer4sec();
VOID timer6sec();
VOID timer30sec();
VOID timer60sec();
int timer1s = 0;
int timer2s = 0;
int timer4s = 0;
int timer6s = 0;
int timer30s = 0;
int timer60s = 0;
Then add a few functioncalls and variable checks to OnPulse function:
Code:
if(GetTickCount() > timer1s){
timer1sec();
timer1s = GetTickCount()+1000;
}
if(GetTickCount() > timer2s){
timer2sec();
timer2s = GetTickCount()+2000;
}
if(GetTickCount() > timer4s){
timer4sec();
timer4s = GetTickCount()+4000;
}
if(GetTickCount() > timer6s){
timer6sec();
timer6s = GetTickCount()+6000;
}
if(GetTickCount() > timer30s){
timer30sec();
timer30s = GetTickCount()+30000;
}
if(GetTickCount() > timer60s){
timer60sec();
timer60s = GetTickCount()+60000;
}
Then put whatever you want to happen on a timer in the timer function code:
Code:
VOID timer1sec(){
}
VOID timer2sec(){
}
VOID timer4sec(){
}
VOID timer6sec(){
}
VOID timer30sec(){
}
VOID timer60sec(){
}
If you want to create custom timers for specific events then just set your timer variables (Ex: timer4s = GetTickCount()+4000 conditionally