hey,
is it possible to make a milisecond timer with steps per 50 miliseconds or lower?
I just made a 100milisecond step timer and i'm also wondering if this is a correct way to make a timer:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <dhudmessage>
#define PLUGIN "ms Timer"
#define VERSION "1.0"
#define AUTHOR "striker07"
new g_iMiliSeconds;
new g_iSeconds;
new g_iMinutes;
new g_iSync;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
g_iSync = CreateHudSyncObj();
// Add your code here...
}
public Start_Timer()
{
set_task(0.1, "Add_100ms" , 1337, _, _, "b");
set_task(0.1, "Update_Timer", _, _, _, "b");
}
public Stop_Timer()
{
remove_task(1337);
}
public Add_100ms()
{
g_iMiliSeconds = g_iMiliSeconds+100;
if(g_iMiliSeconds == 1000)
{
g_iMiliSeconds = 0;
g_iSeconds++;
if(g_iSeconds == 60)
{
g_iSeconds = 0;
g_iMinutes++;
}
}
}
public Update_timer()
{
new Msg[512];
set_dhudmessage(255, 204, 0, 0.01, -0.66, 0, _, 0.1, 0.1, 0.1);
format(Msg,511," Chronometer: ^n %i:%i.%.3i ", g_iMinutes, g_iSeconds, g_iMiliSeconds );
ShowSyncHudMsg(0, g_iSync, Msg);
}
__________________