Raised This Month: $32 Target: $400
 8% 

Making a script need help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
khris123
Junior Member
Join Date: Jun 2008
Old 06-09-2008 , 23:31   Making a script need help
Reply With Quote #1

Hey, I'm kind of new at this but I used a plug in as a reference to make this one. I made a plug in that when ever your health is low 35 hp (you can customize) you will hear a hard breath sound, as if the player was tired. It works well, the only problem is that once you die the sound does not stop. PLEASE HELP!!
Attached Files
File Type: sma Get Plugin or Get Source (breathe.sma - 187 views - 1.5 KB)
khris123 is offline
elpouletorange
Senior Member
Join Date: Oct 2007
Old 06-10-2008 , 20:34   Re: Making a script need help
Reply With Quote #2

LINE 28: prechace_sound(SOUND_BREATHE_OFF)
__________________
I am 42% addicted to Counterstrike. What about you?

No more CS for me....
elpouletorange is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 06-11-2008 , 06:03   Re: Making a script need help
Reply With Quote #3

PHP Code:
/* Copyright © 2008, Khristofer Whelan

    Low Hp Breathe is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Low Hp Breathe; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>

#define SOUND_BREATHE_ON "player/breathe1.wav"
#define SOUND_BREATHE_OFF "player/none.wav"

new g_pcvarLowHp

public plugin_precache()
{
    
precache_sound(SOUND_BREATHE_ON)
    
precache_sound(SOUND_BREATHE_OFF)
}

public 
plugin_init()
{
    
register_plugin("Low Hp Breathe""1.0""Khristofer Whelan")
    
g_pcvarLowHp    =    register_cvar("amx_low_breathe""30")

    
register_event("Damage""e_Damage""be""2>0")
    
register_event("DeathMsg""e_DeathMsg""a")
}

public 
e_Damage(id)
{
    if(
get_user_health(id) > get_pcvar_num(g_pcvarLowHp) )
        return

    
emit_sound(idCHAN_STATICSOUND_BREATHE_ON0.0ATTN_NONESND_STOP0)
    
client_cmd(id"spk %s"SOUND_BREATHE_ON)
}

public 
e_DeathMsg()
{
    new 
victim read_data(2)

    
emit_sound(victimCHAN_STATICSOUND_BREATHE_OFF0.0ATTN_NONESND_STOP0)
    
client_cmd(victim"spk %s"SOUND_BREATHE_OFF)

__________________
atomen is offline
Send a message via MSN to atomen
khris123
Junior Member
Join Date: Jun 2008
Old 06-12-2008 , 01:54   Re: Making a script need help
Reply With Quote #4

It works, but once you die breath1.wav will not stop.
khris123 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-12-2008 , 06:20   Re: Making a script need help
Reply With Quote #5

PHP Code:
public e_DeathMsg()
    
client_cmd(read_data(2), "stopsound"
__________________
hleV 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 19:15.


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