Thread: progress bar
View Single Post
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-15-2011 , 06:52   Re: progress bar
Reply With Quote #6

At top of sma, create a global variable :

PHP Code:
new g_iBarTimeg_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(idiSeconds)
{
    
message_begin(MSG_ONE_UNRELIABLEg_iBarTime, .player=id)
    
write_short(iSeconds)
    
message_end()
}

Make_BarTime2(idFloat:flSeconds)
{
    new 
iRoundedSeconds floatround(flSecondsfloatround_ceil)
    new 
iStartPercent floatround((1.0-(flSeconds iRoundedSeconds))*100)
    
message_begin(MSG_ONE_UNRELIABLEg_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)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline