A single timer can do all the job actually.
Example with multiple timers and hard work to start/pause/stop..
pawn Код:
#include <a_samp>
public OnFilterScriptInit()
{
SetTimer("MyFunction1", 200, true); //Every 200ms
SetTimer("MyFunction2", 60 * 1000, true); //Every Minute
SetTimer("MyFunction3", 2000, true); //Every 2 second
return 1;
}
forward MyFunction1();
public MyFunction1() {}
forward MyFunction2();
public MyFunction2() {}
forward MyFunction3();
public MyFunction3() {}
Alternative Method to start/stop/pause and manage different stuff under a single timer:
pawn Код:
#include <a_samp>
new F1, F2, F3;
new bool:F1Enabled, bool:F2Enabled, bool:F3Enabled;
public OnFilterScriptInit()
{
SetTimer("AllMyFunctions", 100, true);
return 1;
}
forward AllMyFunctions();
public AllMyFunctions()
{
F1++; F2++; F3++;
if(F1 >= 2 && F1Enabled)
{
//Stuff located here will be called every 200ms (100ms ticks twice, which means 200ms has passed)
F1 = 0;
}
if(F2 >= 60 * 10 && F2Enabled)
{
//Stuff located here will be called every minute (100ms ticks 600 times, i.e 1 minute has passed)
F2 = 0;
}
if(F3 >= 60 * 10 && F3Enabled)
{
//Stuff located here will be called every 2000ms (100ms ticks 20 times, i.e 2000 ms)
F3 = 0;
}
}
stock StartFunction1()
{
F1 = 0;
F1Enabled = true;
}
stock PauseFunction1() F1Enabled = false;
stock ResumeFunction1() F1Enabled = true;
stock StopFunction1()
{
F1Enabled = false;
F1 = 0;
}
Untested, but this should probably work.