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

heartbeat


Post New Thread Reply   
 
Thread Tools Display Modes
Joce93
Senior Member
Join Date: Feb 2016
Old 05-01-2016 , 16:59   Re: heartbeat
Reply With Quote #31

Can someone fix 2 things ? :

1) I still hear the heartbeat when i take a medkit for higher HP.

2) I don't want that the other players hear the sound of my heartbeat when my HP is low

Last edited by Joce93; 05-01-2016 at 17:07.
Joce93 is offline
ColaSola
Junior Member
Join Date: Apr 2016
Old 05-01-2016 , 18:33   Re: heartbeat
Reply With Quote #32

Try this:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "FMU HeartBeat"
#define VERSION "1.0"

new const g_szHeartBeat[    ]  =  "misc/fmu_heartbeat.wav";
    
new 
g_iCvarHeartBeatTo;
new 
g_iCvarMinHealth;

public 
plugin_precache( )    precache_soundg_szHeartBeat );
        
public 
plugin_init( )
{
    
register_pluginPLUGINVERSION"Askhanar" );
    
    
g_iCvarHeartBeatTo register_cvar"fmu_hb_enableto""3" );
    
g_iCvarMinHealth register_cvar"fmu_hb_minhp""40" );
    
    
set_task1.0"task_HeartBeat"___"b");
}

public 
task_HeartBeat( )
{
    static 
iHeartBeat;
    
iHeartBeat get_pcvar_numg_iCvarHeartBeatTo );
    
    if( 
iHeartBeat == )
        return 
PLUGIN_CONTINUE;
        
    static 
iPlayers32 ];
    static 
iPlayersNum;
    
    if( 
iHeartBeat == )
        
get_playersiPlayersiPlayersNum"aceh""TERRORIST" );
    else if( 
iHeartBeat == )
        
get_playersiPlayersiPlayersNum"aceh""CT" );
    else if( 
iHeartBeat == )
        
get_playersiPlayersiPlayersNum"ach" );
        
    
/*No players found.*/
    
if( !iPlayersNum )
        return 
PLUGIN_CONTINUE;
    
    static 
idi;
    for( 
0iPlayersNumi++ )
    {
        
id iPlayers];
        
        static 
iUserHealthiMinHealth;
        
iUserHealth =  get_user_healthid );
        
iMinHealth get_pcvar_numg_iCvarMinHealth );
        
        if( 
iUserHealth <= iMinHealth )
        {
            
ShakeScreenid0.8 );
            
FadeScreenid 0.62300050 );
            
emit_soundidCHAN_STATICg_szHeartBeat0.2ATTN_IDLE0PITCH_NORM  );
        }
    }
    
    return 
PLUGIN_CONTINUE;
}
    


ShakeScreenid, const Float:seconds  )
{
    
message_begin(  MSG_ONE,  get_user_msgid"ScreenShake" ),  { 00}, id );
    
write_short(  floatround4096.0 secondsfloatround_round ) );
    
write_short(  floatround4096.0 secondsfloatround_round ) );
    
write_short(  1<<13  );
    
message_end(  );
    
}

FadeScreen(  id, const Float:seconds,  const red,  const green,  const blue,  const alpha  )
{      
    
message_begin(  MSG_ONEget_user_msgid"ScreenFade" ), _id );
    
write_short(  floatround4096.0 secondsfloatround_round )  );
    
write_short(  floatround4096.0 secondsfloatround_round )  );
    
write_short0x0000 );
    
write_byte(  red  );
    
write_byte(  green  );
    
write_byte(  blue  );
    
write_byte(  alpha  );
    
message_end(  );


ColaSola is offline
Joce93
Senior Member
Join Date: Feb 2016
Old 05-02-2016 , 06:45   Re: heartbeat
Reply With Quote #33

Quote:
Originally Posted by ColaSola View Post
Try this:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "FMU HeartBeat"
#define VERSION "1.0"

new const g_szHeartBeat[    ]  =  "misc/fmu_heartbeat.wav";
    
new 
g_iCvarHeartBeatTo;
new 
g_iCvarMinHealth;

public 
plugin_precache( )    precache_soundg_szHeartBeat );
        
public 
plugin_init( )
{
    
register_pluginPLUGINVERSION"Askhanar" );
    
    
g_iCvarHeartBeatTo register_cvar"fmu_hb_enableto""3" );
    
g_iCvarMinHealth register_cvar"fmu_hb_minhp""40" );
    
    
set_task1.0"task_HeartBeat"___"b");
}

public 
task_HeartBeat( )
{
    static 
iHeartBeat;
    
iHeartBeat get_pcvar_numg_iCvarHeartBeatTo );
    
    if( 
iHeartBeat == )
        return 
PLUGIN_CONTINUE;
        
    static 
iPlayers32 ];
    static 
iPlayersNum;
    
    if( 
iHeartBeat == )
        
get_playersiPlayersiPlayersNum"aceh""TERRORIST" );
    else if( 
iHeartBeat == )
        
get_playersiPlayersiPlayersNum"aceh""CT" );
    else if( 
iHeartBeat == )
        
get_playersiPlayersiPlayersNum"ach" );
        
    
/*No players found.*/
    
if( !iPlayersNum )
        return 
PLUGIN_CONTINUE;
    
    static 
idi;
    for( 
0iPlayersNumi++ )
    {
        
id iPlayers];
        
        static 
iUserHealthiMinHealth;
        
iUserHealth =  get_user_healthid );
        
iMinHealth get_pcvar_numg_iCvarMinHealth );
        
        if( 
iUserHealth <= iMinHealth )
        {
            
ShakeScreenid0.8 );
            
FadeScreenid 0.62300050 );
            
emit_soundidCHAN_STATICg_szHeartBeat0.2ATTN_IDLE0PITCH_NORM  );
        }
    }
    
    return 
PLUGIN_CONTINUE;
}
    


ShakeScreenid, const Float:seconds  )
{
    
message_begin(  MSG_ONE,  get_user_msgid"ScreenShake" ),  { 00}, id );
    
write_short(  floatround4096.0 secondsfloatround_round ) );
    
write_short(  floatround4096.0 secondsfloatround_round ) );
    
write_short(  1<<13  );
    
message_end(  );
    
}

FadeScreen(  id, const Float:seconds,  const red,  const green,  const blue,  const alpha  )
{      
    
message_begin(  MSG_ONEget_user_msgid"ScreenFade" ), _id );
    
write_short(  floatround4096.0 secondsfloatround_round )  );
    
write_short(  floatround4096.0 secondsfloatround_round )  );
    
write_short0x0000 );
    
write_byte(  red  );
    
write_byte(  green  );
    
write_byte(  blue  );
    
write_byte(  alpha  );
    
message_end(  );



Thanks but I play on Sven coop not Counter Strike
However I did not try yet, could it work ?

Last edited by Joce93; 05-02-2016 at 06:57.
Joce93 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-02-2016 , 08:04   Re: heartbeat
Reply With Quote #34

Moving your fingers and testing it is the only way to find out.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-02-2016 , 08:16   Re: heartbeat
Reply With Quote #35

PHP Code:
#include <amxmodx>

#define VOL_NULL   0.0
#define VOL_MID    0.5
#define FLAG_NONE  0
#define PITCH_NONE 0
#define CHAN_HEART CHAN_VOICE

new const g_heartbeat[] = "player/heartbeat1.wav"

new g_pcvarLowHp

public plugin_precache() {
  
precache_sound(g_heartbeat)
}

public 
plugin_init() {
  
register_plugin("Low Hp Heart Beat""0.1""DokTor")

  
g_pcvarLowHp register_cvar("heartbeat_hp""25")

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

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

  
emit_sound(idCHAN_HEARTg_heartbeatVOL_NULLATTN_NONESND_STOPPITCH_NONE)
  
emit_sound(idCHAN_HEARTg_heartbeatVOL_MIDATTN_NORMFLAG_NONEPITCH_NORM)
}

public 
e_DeathMsg() {
  
emit_sound(read_data(2), CHAN_HEARTg_heartbeatVOL_NULLATTN_NONESND_STOPPITCH_NONE)

Found on google.

Last edited by siriusmd99; 05-02-2016 at 08:16.
siriusmd99 is offline
Joce93
Senior Member
Join Date: Feb 2016
Old 05-02-2016 , 14:43   Re: heartbeat
Reply With Quote #36

Quote:
Originally Posted by siriusmd99 View Post
PHP Code:
#include <amxmodx>

#define VOL_NULL   0.0
#define VOL_MID    0.5
#define FLAG_NONE  0
#define PITCH_NONE 0
#define CHAN_HEART CHAN_VOICE

new const g_heartbeat[] = "player/heartbeat1.wav"

new g_pcvarLowHp

public plugin_precache() {
  
precache_sound(g_heartbeat)
}

public 
plugin_init() {
  
register_plugin("Low Hp Heart Beat""0.1""DokTor")

  
g_pcvarLowHp register_cvar("heartbeat_hp""25")

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

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

  
emit_sound(idCHAN_HEARTg_heartbeatVOL_NULLATTN_NONESND_STOPPITCH_NONE)
  
emit_sound(idCHAN_HEARTg_heartbeatVOL_MIDATTN_NORMFLAG_NONEPITCH_NORM)
}

public 
e_DeathMsg() {
  
emit_sound(read_data(2), CHAN_HEARTg_heartbeatVOL_NULLATTN_NONESND_STOPPITCH_NONE)

Found on google.

I still hear the heartbeat sound when i take a medkit or when I die and respawn, so not good.

Anything else ?

Last edited by Joce93; 05-02-2016 at 14:43.
Joce93 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-02-2016 , 15:15   Re: heartbeat
Reply With Quote #37

Quote:
Originally Posted by Joce93 View Post
Thanks but I play on Sven coop not Counter Strike
However I did not try yet, could it work ?
What don't you write this information at the beggining? I mean that we give you the code and after 3 filled pages you say that you play Sven Coop...
siriusmd99 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-02-2016 , 15:51   Re: heartbeat
Reply With Quote #38

Quote:
Originally Posted by siriusmd99 View Post
PHP Code:
#include <amxmodx>
// ... 
Found on google.
It's also found on the first page of this thread because it's the same code...
__________________

Last edited by Black Rose; 05-02-2016 at 15:51.
Black Rose is offline
Joce93
Senior Member
Join Date: Feb 2016
Old 05-02-2016 , 16:33   Re: heartbeat
Reply With Quote #39

Quote:
Originally Posted by siriusmd99 View Post
What don't you write this information at the beggining? I mean that we give you the code and after 3 filled pages you say that you play Sven Coop...
Uh, i'm not the author of this thread, what are you talking about dude ?
Joce93 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-02-2016 , 18:46   Re: heartbeat
Reply With Quote #40

Oh sorry, you are not the author but anyway first you said to fix the code but after that u use sven coop.Anyway nevermind..
siriusmd99 is offline
Old 05-15-2016, 19:01
Joce93
This message has been deleted by Joce93. Reason: delete
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 15:14.


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