Raised This Month: $ Target: $400
 0% 

progress bar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nyuszy
Senior Member
Join Date: Apr 2009
Old 01-14-2011 , 20:01   progress bar
Reply With Quote #1

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
Nyuszy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-14-2011 , 20:07   Re: progress bar
Reply With Quote #2

See Bartime or BarTime2 message.
__________________
Arkshine is offline
Nyuszy
Senior Member
Join Date: Apr 2009
Old 01-15-2011 , 06:32   Re: progress bar
Reply With Quote #3

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?
Nyuszy is offline
Old 01-15-2011, 06:34
Nyuszy
This message has been deleted by Nyuszy.
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-15-2011 , 06:37   Re: progress bar
Reply With Quote #4

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.
__________________
Arkshine is offline
Nyuszy
Senior Member
Join Date: Apr 2009
Old 01-15-2011 , 06:44   Re: progress bar
Reply With Quote #5

thanks
Nyuszy is offline
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
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-17-2014 , 00:35   Re: progress bar
Reply With Quote #7

Helped!!!
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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