Raised This Month: $ Target: $400
 0% 

T


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shoki123
Senior Member
Join Date: Apr 2011
Old 10-29-2011 , 09:44   T
Reply With Quote #1

..

Last edited by shoki123; 10-30-2011 at 10:10. Reason: add
shoki123 is offline
plowed
Senior Member
Join Date: Oct 2010
Location: germany
Old 10-29-2011 , 14:05   Re: Add a sound
Reply With Quote #2

PHP Code:
new g_cdSounds[10][] = { 
    
"fvox/one.wav"
    
"fvox/two.wav"
    
"fvox/three.wav"
    
"fvox/four.wav"
    
"fvox/five.wav"
    
"fvox/six.wav"
    
"fvox/seven.wav"
    
"fvox/eight.wav"
    
"fvox/nine.wav",
    
"fvox/ten.wav"
    
}

public 
plugin_precache() 
{
    
precache_sound("fvox/one.wav")
    
precache_sound("fvox/two.wav")
    
precache_sound("fvox/three.wav")
    
precache_sound("fvox/four.wav")
    
precache_sound("fvox/five.wav")
    
precache_sound("fvox/six.wav")
    
precache_sound("fvox/seven.wav")
    
precache_sound("fvox/eight.wav")
    
precache_sound("fvox/nine.wav")
    
precache_sound("fvox/ten.wav")
}

//Put this into the public "fn_countdown()" function

public fn_countdown( )
{
    if( 
cStartTimer == )
    {
        
set_hudmessage02550, -1.0, -1.0)
        
show_hudmessage0"CountDown Finished !" )
        return 
PLUGIN_HANDLED
    
}
    else
    {
        
set_hudmessage02550, -1.0, -1.006.01.0 )
        
show_hudmessage0"CountDown: %d"cStartTimer )
        
client_cmd(0"spk %s"g_cdSounds[cStartTimer-1])
    }
    
    
cStartTimer--
    
set_task1.0"fn_countdown" )
    return 
PLUGIN_HANDLED

__________________
Zombie Mod + gameMe stats :

Last edited by plowed; 10-29-2011 at 14:06.
plowed is offline
sake
Senior Member
Join Date: Jul 2011
Old 10-29-2011 , 15:44   Re: Add a sound
Reply With Quote #3

Precaching is not neccesary here. All players have these sounds!

Also use num_to_word for this!

PHP Code:
new number[32];
num_to_word(cStartTimer,number,31);
client_cmd(0"spk %s"number); 
EDIT: You don't even need cStartTimer here:

Just use recurive functions like this (untested):

PHP Code:
public fn_countdown(num)
{
    if(
num == 0)
    {
          
set_hudmessage02550, -1.0, -1.0);
          
show_hudmessage0"CountDown Finished !" );
          return;
    }
    new 
number[32];
    
num_to_word(num,number,charsmax(number));
    
client_cmd(0"spk %s"number);
    
set_hudmessage(0,255,0,-1.0,-1.0,0,6.0,1.0);
    
show_hudmessage(0"Countdown: %i"num);
    
set_task(1.0"fn_countdown"num-1);

EDIT2:

To be even cooler take the number string and make it global .
__________________

Last edited by sake; 10-29-2011 at 15:58.
sake is offline
Reply



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 14:22.


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