Raised This Month: $ Target: $400
 0% 

I am Curious I need Help With Putting Spec Sounds On a Knife Models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Supervoodoo
Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-17-2009 , 18:39   I am Curious I need Help With Putting Spec Sounds On a Knife Models
Reply With Quote #1

Hi Its Me again Maybe this is the last time im asking about something in SH scripting But, Can Someone Tell me How precache Sounds to Models, Because I have a awsmn Sword Model And I need TO Precache Sounds TO it but I Dont Really Know How TO to that .

public plugin_precache()
{
precache_model("models/shmod/messiah_v_knife.mdl")
precache_model("models/shmod/messiah_p_knife.mdl")
precache_sound("sound/shmod/messiah/knife_hit1.wav")
precache_sound("sound/shmod/messiah/knife_hit2.wav")
precache_sound("sound/shmod/messiah/knife_hit3.wav")
precache_sound("sound/shmod/messiah/knife_hit4.wav")
precache_sound("sound/shmod/messiah/knife_hitwall1.wav")
precache_sound("sound/shmod/messiah/knife_slash1.wav")
precache_sound("sound/shmod/messiahknife_slash2.wav")
precache_sound("sound/shmod/knife_stab.wav")
}

after That :
{
public weaponChange(id)
{
if ( !gHasMessiahPowers[id] || !shModActive() ) return

new wpnid = read_data(2)
if ( wpnid != CSW_KNIFE ) return

else {
switchmodel(id)

}
}

and Last :

public switchmodel(id)
{
if ( !is_user_alive(id) ) return
else {
entity_set_string(id, EV_SZ_viewmodel, "models/shmod/messiah_v_knife.mdl")
entity_set_string(id, EV_SZ_viewmodel, "models/shmod/messiah_p_knife.mdl")
}
}

So I have 2 Questions:
1st How Do I put The Sounds So Superhero Knows They Are Used With The Sword Model

And
2nd Do I Have To Put Something Inbetween these to functions to make the sounds emit

Thank you if Who Ever You R
Supervoodoo is offline
Send a message via Skype™ to Supervoodoo
Supervoodoo
Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-17-2009 , 18:40   Re: I am Curious I need Help With Putting Spec Sounds On a Knife Models
Reply With Quote #2

thats the last thing i want to do to finish My Hero. Pls help
Supervoodoo is offline
Send a message via Skype™ to Supervoodoo
Supervoodoo
Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-17-2009 , 18:46   Re: I am Curious I need Help With Putting Spec Sounds On a Knife Models
Reply With Quote #3

i can only tell that it has 38 cvars
Supervoodoo is offline
Send a message via Skype™ to Supervoodoo
Supervoodoo
Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-20-2009 , 16:25   Re: I am Curious I need Help With Putting Spec Sounds On a Knife Models
Reply With Quote #4

is my Q Really Difficult
Supervoodoo is offline
Send a message via Skype™ to Supervoodoo
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 07-20-2009 , 20:12   Re: I am Curious I need Help With Putting Spec Sounds On a Knife Models
Reply With Quote #5

no it just didn't make sense the way you worded it, but assuming you want your sounds to play instead of default knife sounds then this should do it.
PHP Code:
#define MAX_SOUNDS 8

new const origsounds[MAX_SOUNDS][] = {
    
"weapons/knife_hit1.wav",
    
"weapons/knife_hit2.wav",
    
"weapons/knife_hit3.wav",
    
"weapons/knife_hit4.wav",
    
"weapons/knife_hitwall1.wav",
    
"weapons/knife_slash1.wav",
    
"weapons/knife_slash2.wav",
    
"weapons/knife_stab.wav"
}
new const 
newsounds[MAX_SOUNDS][] = {
    
"shmod/messiah/knife_hit1.wav",
    
"shmod/messiah/knife_hit2.wav",
    
"shmod/messiah/knife_hit3.wav",
    
"shmod/messiah/knife_hit4.wav",
    
"shmod/messiah/knife_hitwall1.wav",
    
"shmod/messiah/knife_slash1.wav",
    
"shmod/messiah/knife_slash2.wav",
    
"shmod/knife_stab.wav"
}

public 
plugin_init()
{
    
//...    

    
register_forward(FM_EmitSound"fw_emitsound");
}
public 
plugin_precache()
{
    
//...
    
    
for ( new 0MAX_SOUNDSi++ )
        
precache_sound(newsounds[i]);
}

public 
fw_emitsound(idchannel, const sample[], Float:volumeFloat:attnflagspitch)
{
    if ( !
is_user_connected(id) || !gHasMessiahPowers[id] || !shModActive() )
        return 
FMRES_IGNORED;
        
    if ( 
sample[8] == 'k' && sample[13] == '_' )    //we want to save time and not loop if we are not dealing with a knife sound
        
for ( 0MAX_SOUNDSi++ )
            if ( 
equali(sampleorigsounds[i] )
            {
                
engfunc(EngFunc_EmitSoundidchannelnewsounds[i], volumeattnflagspitch);
                return 
FMRES_SUPERCEDE;
            }
        
    return 
FMRES_IGNORED;

__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 07-21-2009 , 14:07   Re: I am Curious I need Help With Putting Spec Sounds On a Knife Models
Reply With Quote #6

huh ? this part came from Squall ?

i tried this part for M4 but this not working

PHP Code:
//----------------------------------------------------------------------------------------------
public fw_emitsound(idchannel, const sample[], Float:volumeFloat:attnflagspitch)
{
if ( !
is_user_connected(id) || !gHas[id] || !sh_is_active() )
return 
FMRES_IGNORED;
 
if ( 
equali(sample,"weapons/m4a1"12) )

engfunc(EngFunc_EmitSoundidchannelgunsoundvolumeattnflagspitch);
return 
FMRES_SUPERCEDE;
}
return 
FMRES_IGNORED;
}
//---------------------------------------------------------------------------------------------- 

Last edited by Fr33m@n; 07-21-2009 at 14:23.
Fr33m@n is offline
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 07-21-2009 , 15:47   Re: I am Curious I need Help With Putting Spec Sounds On a Knife Models
Reply With Quote #7

You can't change all sounds, most are client side and you can't do anything about them. Knife sounds however you can change since they are server side.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 07-22-2009 , 15:23   Re: I am Curious I need Help With Putting Spec Sounds On a Knife Models
Reply With Quote #8

ok i understand. thanks vittu.
Fr33m@n is offline
Supervoodoo
Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-22-2009 , 16:15   Re: I am Curious I need Help With Putting Spec Sounds On a Knife Models
Reply With Quote #9

thx g-dog Ill Karma you
Supervoodoo is offline
Send a message via Skype™ to Supervoodoo
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 04:11.


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