Raised This Month: $7 Target: $400
 1% 

changing player 'pain' sounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 11-10-2013 , 17:54   changing player 'pain' sounds
Reply With Quote #1

I am trying to insert my own painsounds into my function, but the engines painsounds are played instead, how would I stop them from playing so the ones in my function play?


PHP Code:
        if(equali(className"trigger_hurt"))
        {
//touching the triggerhurt, lets see what we can do..
            //
            
if(dmc_canshout[id] < halflife_time())
            {
// time has passed, we can redo the pain event
                
new snd[24]
                
format(sndcharsmax(snd), "dmc/player/lburn%d.wav"random_num(12))
                
emit_sound(idCHAN_VOICEsnd0.5ATTN_NORM1PITCH_NORM);
                
dmc_canshout[id] = (halflife_time()+5.0)
                
client_print(0print_chat"PFN1 %s"snd);
                return 
FMRES_HANDLED
            
}
            else
                return 
FMRES_SUPERCEDE;
        } 
PHP Code:
public DMC_TakeDamage(thisidinflictoridattackerFloat:damagedamagebits)
{
//quake-like armor damage.
    
    //client_print(this, print_chat, "%d %d %d [%.3f] %d", this, idinflictor, idattacker, damage, damagebits)
    //new Float:health = entity_get_float(this, EV_FL_health)
    //new Float:armor = entity_get_float(this, EV_FL_armorvalue)
    //new Float:armortype = entity_get_float(this, EV_FL_armortype)
    //client_print(this, print_chat, "%.2f health %.2f armor type %.2f", health, armor, armortype)
    
new watertype entity_get_int(thisEV_INT_watertype)
    
    if(
watertype == -5)
    {
//in 'lava'
        
if(dmc_canshout[this] < halflife_time())
        {
//they can be hurt now.
            
new snd[24]
            
format(sndcharsmax(snd), "dmc/player/lburn%d.wav"random_num(12))
            
emit_sound(thisCHAN_VOICEsnd0.5ATTN_NORM1PITCH_NORM);
            
dmc_canshout[this] = (halflife_time()+5.0)
            
client_print(0print_chat"PFN2 %s"snd);
        }
        else
            return 
HAM_SUPERCEDE;
    }
    return 
HAM_HANDLED;
    
    

the 5.0 delay is simply for testing, value should be 0.5, but I am more interested with getting the sounds working than instantly dying when I step into lava.

if I cannot get this to work how I would like it to, I will just be checking the health and setting it to health-damage and returning supercede on the function (when req's are met) but id rather just only block the damage function when the entity is supposed to be switching from on/off instead of blocking it all the time.
__________________
+|- KARMA Respectively

HLM is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-10-2013 , 18:05   Re: changing player 'pain' sounds
Reply With Quote #2

Are you talking about suit sentences like "seek medical attention" ?
Also, about your TakeDamage hook, instead of checking watertype you could only check :

PHP Code:
if( damagebits == DMG_BURN 
About the other block you shown, i'm curious why you have to check classname, why don't you use register_touch("trigger_hurt", "player", "CALLBACK") ???
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 11-10-2013 , 19:05   Re: changing player 'pain' sounds
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
Are you talking about suit sentences like "seek medical attention" ?
Also, about your TakeDamage hook, instead of checking watertype you could only check :

PHP Code:
if( damagebits == DMG_BURN 
About the other block you shown, i'm curious why you have to check classname, why don't you use register_touch("trigger_hurt", "player", "CALLBACK") ???
im trying to do this

the 1st hook didnt even work as it is actually a func_water that does the damage. I will be chanigng it to check the damagebits.

I dont have to do that, I was just using a FM_registertouch hook I had set up, and I already grab the classname for other entities, I was just adding this code in to check it, it wasnt even called as stated above.. I have ran into a new problem, but it is unrelated to this.. in DMC, players are shifted up 6 units on the Y axis, what would be an easy way to do/simulate this in other games?
__________________
+|- KARMA Respectively

HLM is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-11-2013 , 03:37   Re: changing player 'pain' sounds
Reply With Quote #4

FM_Touch is not efficient to hook, you should never hook it.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 11-11-2013 , 13:18   Re: changing player 'pain' sounds
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
FM_Touch is not efficient to hook, you should never hook it.
Ham_Touch does not register my custom entities.. or any entities at all for that matter.

PHP Code:
//public Hook_Touch(ent, id)//Ham Hook.. idthis, idother??
public Hook_Touch(ident)
{
    
//
    
client_print(0print_chat"%d -> %d"ident);
    
    if(!
pev_valid(ent))
        return 
FMRES_HANDLED;
    if(!
is_user_alive(id))
        return 
FMRES_HANDLED;
    
    
//client_print(0, print_chat, "%d -> %d", id, ent);
    
client_print(0print_chat"Touch Post Checks");//I never get this far, I have only seen when I touch world
    
new className[64];
    
pev(entpev_classnameclassNamecharsmax(className)); 
EDIT: im using register_touch now, is this more efficient?

PHP Code:
register_touch("*""player""Hook_Touch"); 
__________________
+|- KARMA Respectively


Last edited by HLM; 11-11-2013 at 15:10.
HLM is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-11-2013 , 16:08   Re: changing player 'pain' sounds
Reply With Quote #6

If you still need to figure out what is the touched class, would be more efficient to register only wanted classes. But it is better.
You don't get the log because you have commented the correct way :
PHP Code:
//public Hook_Touch(ent, id)//Ham Hook.. idthis, idother??
public Hook_Touch(ident
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
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 07:54.


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