At top of sma, create a global variable :
PHP Code:
new g_iBarTime, g_iBarTime2
In plugin_init, fill that variable to message index :
PHP Code:
g_iBarTime = get_user_msgid("BarTime")
g_iBarTime2 = get_user_msgid("BarTime2")
Private function that you gonna use :
PHP Code:
Make_BarTime(id, iSeconds)
{
message_begin(MSG_ONE_UNRELIABLE, g_iBarTime, .player=id)
write_short(iSeconds)
message_end()
}
Make_BarTime2(id, Float:flSeconds)
{
new iRoundedSeconds = floatround(flSeconds, floatround_ceil)
new iStartPercent = floatround((1.0-(flSeconds / iRoundedSeconds))*100)
message_begin(MSG_ONE_UNRELIABLE, g_iBarTime2, .player=id)
write_short(iRoundedSeconds)
write_short(iStartPercent)
message_end()
}
You use only pass entire seconds, like 5sec or 10sec then use Make_BarTime(id, 5)
If you pass other like 5.7, 6.8, then use Make_BarTime2(id, 5.7)
__________________