Using RoundTimer as my own timer.
So as the title says I'm using that way RoundTimer. But I've got one problem...
Time doesn't project as it sould...
It works this way:
0:01
0:02
0:03
0:02
0:03
0:04 etc.
Tried to change halflife_time to game_time and value of calling task, but it doesn't help at all...
Code:
public plugin_init(){
register_message( get_user_msgid( "RoundTime" ), "tajmer2" );
RoundTime = get_user_msgid( "RoundTime" );
}
public tajmer2(msgid, dest, id) {
set_msg_arg_int( 1, ARG_SHORT, 0 );
set_task(0.5, "tajmer1", id+TASK_ID_START2);
}
public tajmer1(id){
id -= TASK_ID_START2;
new EndTime = stock_get_user_roundtime(id) + 1;
if(!is_user_alive(id))
return PLUGIN_HANDLED;
message_begin(MSG_ONE, RoundTime, _, id);
write_short(EndTime);
message_end();
set_task(0.5, "tajmer1", id+TASK_ID_START2);
return PLUGIN_CONTINUE;
}
stock stock_get_user_roundtime( const id ) {
if(!g_RoundEnd){
g_EndTime2 = floatround(halflife_time() - g_StartTime[id], floatround_method:floatround_ceil );
}
return g_EndTime2;
}
g_StartTime is of course halflife_time took on player's spawn.
Oh, and if I'll show
Code:
stock_get_user_roundtime(id)
in HUD timer, it works correct..
|