Raised This Month: $51 Target: $400
 12% 

Sounds in ghw_ctf


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
marcremz
Junior Member
Join Date: Aug 2006
Old 08-25-2006 , 16:52   Sounds in ghw_ctf
Reply With Quote #1

Hey everyone,

I worked on a modification of the ghw_ctf plugin to add some sound effects when a player takes the flag and when he scores.

The script includes 3 sounds:
- CT takes the flag
- T takes the flag
- Score sound

Heres how it works :

--------------------------------

First of all, modify the plugin_precache function like this:
Code:
public plugin_precache()
{
    beamsprite = precache_model("sprites/dot.spr")
    precache_sound("misc/tflag.wav")
    precache_sound("misc/ctflag.wav")
    precache_sound("misc/alert.wav")
    if(file_exists(CTFLAGMODEL) && file_exists(TFLAGMODEL))
    {
        flag_exists=true
        precache_model(CTFLAGMODEL)
        precache_model(TFLAGMODEL)
        ctflagent = create_flag_entities(2)
        tflagent = create_flag_entities(1)
    }
}
Then, those 2 emitters:

Code:
                    if(!TFlag_holder || TFlag_holder==-1)
                    {
                        emit_sound(0,CHAN_AUTO, "misc/ctflag.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                        TFlag_holder=id
                        client_print(0,print_chat,"%L",LANG_PLAYER,"GRABT",name)
                        
                    }
Code:
if(!CTFlag_holder || CTFlag_holder==-1)
                    {
                        emit_sound(0,CHAN_AUTO, "misc/tflag.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                        CTFlag_holder=id
                        client_print(0,print_chat,"%L",LANG_PLAYER,"GRABCT",name)
                        
                    }
And finally,

Code:
if(TFlag_holder==id && !CTFlag_holder && get_distance(idorigin,CTFlag_stand)<=40)
    {
        emit_sound(0,CHAN_AUTO, "misc/alert.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
        //client_cmd(0,"spk misc/alert")
        TFlag_holder=0
        client_print(0,print_chat,"%L",LANG_PLAYER,"CAPTURET",name)
        client_print(id,print_chat,"%L",id,"CAPTUREREWARDED",get_cvar_num(cvar_ctf_capture_reward))
        cs_set_user_money(id,cs_get_user_money(id) + get_cvar_num(cvar_ctf_capture_reward))
        CTcount++
        check_scores()
    }
Code:
if(CTFlag_holder==id && !TFlag_holder && get_distance(idorigin,TFlag_stand)<=40)
    {
        emit_sound(0,CHAN_AUTO, "misc/alert.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)        
        CTFlag_holder=0
        client_print(0,print_chat,"%L",LANG_PLAYER,"CAPTURECT",name)
        client_print(id,print_chat,"%L",id,"CAPTUREREWARDED",get_cvar_num(cvar_ctf_capture_reward))
        client_cmd(0,"spk misc/alert")
        cs_set_user_money(id,cs_get_user_money(id) + get_cvar_num(cvar_ctf_capture_reward))
        Tcount++
        check_scores()
    }
Note that for the 2 last emitters, you can use two different sounds instead of 1 (alarm.wav). Just don't forget to add your other sound in the precache list!

Put the sound files of the zip file in the sound/misc folder.
Attached Files
File Type: zip sounds.zip (110.2 KB, 50 views)
marcremz is offline
Deviance
Veteran Member
Join Date: Nov 2004
Location: Sweden
Old 08-25-2006 , 16:59   Re: Sounds in ghw_ctf
Reply With Quote #2

Post this either in offtopic or the plugin topic, as this doesn't make any sence posting here.
Deviance 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 06:48.


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