AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   progress bar (https://forums.alliedmods.net/showthread.php?t=147843)

Nyuszy 01-14-2011 20:01

progress bar
 
how can i make a progress bar like planting c4 in cs?
i'm making a plugin that makes you invisible for 5 sec and i want that the player know when will he be visible again.

sorry for my bad english :mrgreen:

Arkshine 01-14-2011 20:07

Re: progress bar
 
See Bartime or BarTime2 message.

Nyuszy 01-15-2011 06:32

Re: progress bar
 
i'm not very good with messages... so
PHP Code:

message_begin(MSG_ONEget_user_msgid("BarTime"), _id)
write_short(10.0)
message_end() 

is this ok?

Arkshine 01-15-2011 06:37

Re: progress bar
 
You can't use float number in a message. You could use MSG_ONE_UNRELIABLE and save the message id into a var global, except that, yes.

Anyway, you should try yourself.

Nyuszy 01-15-2011 06:44

Re: progress bar
 
thanks :)

ConnorMcLeod 01-15-2011 06:52

Re: progress bar
 
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)

ezio_auditore 05-17-2014 00:35

Re: progress bar
 
Helped!!!


All times are GMT -4. The time now is 01:56.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.