Raised This Month: $ Target: $400
 0% 

[Request] Breathing effect


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
juanjotoronja
Member
Join Date: Mar 2014
Old 05-08-2015 , 12:52   Re: [Request] Breathing effect
Reply With Quote #3

There is a pluggin made by ConnorMcLeod but is for low health, what im looking is one that start playing a custom breath sound at roundstart and when the player is dead/disconnected/spectator it should stop playing. Btw this is the code...

PHP Code:
#include <amxmodx> 

#define PLUGIN "Low health breathe" 
#define VERSION "1.0" 
#define AUTHOR "balck" 

new dmgcvarlowdmgfade;
new 
bool:low_dmg[33] = false;
new 
colorrgb;

public 
plugin_precache() { 
    
precache_sound("breathe.wav");


public 
plugin_init(){ 
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_cvar("lowhealthbreathe"VERSIONFCVAR_SERVER|FCVAR_SPONLY);
    
    
dmgcvar register_cvar"amx_low_dmg""26" );
    
lowdmgfade register_cvar"amx_low_dmg_sfade""1" );
    
color register_cvar"amx_low_color""210 0 0" );
    
    
register_event("Damage""event_damage""be");
    
register_event("DeathMsg""event_deathmsg""a");
    
register_event("HLTV""event_new_round""a""1=0""2=0");

    new 
colors[16], red[4], green[4], blue[4];
    
get_pcvar_stringcolorcolorssizeof colors );
    
parsecolorsred3green3blue);
    
str_to_numred );
    
str_to_numgreen );
    
str_to_numblue );
}

public 
event_damage(id){
    if(!
is_user_connected(id) || is_user_bot(id))
        return 
PLUGIN_HANDLED;
    
    if(
get_user_health(id) < get_pcvar_num(dmgcvar)){
        if(
low_dmg[id] == true){
            return 
PLUGIN_HANDLED
        
}
        else{
            
set_task(1.7"lowdmg"id__"b");
            
low_dmg[id] = true;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
event_deathmsg(){
    new 
id read_data(2);
    
    if(!
is_user_connected(id) || is_user_bot(id) || low_dmg[id] == false)
        return 
PLUGIN_HANDLED;
    
    
remove_task(id);
    
low_dmg[id] = false;
    
    return 
PLUGIN_CONTINUE;
}

public 
event_new_round(){
    new 
pnumidplayers[32];
    
    
get_players(playerspnum"c");
    
    for(new 
0pnumi++){
        
id players[i];
        
        if(
is_user_connected(id) && low_dmg[id] == true){
            
remove_task(id);
            
low_dmg[id] = false;
        }
    } 
}

public 
lowdmg(id){
    if( 
get_user_healthid ) > get_pcvar_numdmgcvar ) ){
        
remove_taskid )
        
low_dmgid ] = false
        
return
    }
    
client_cmd(id"spk sound/breathe");
    
    if(
get_pcvar_num(lowdmgfade)){
        
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, id)
        
write_short10<<12 // fade lasts this long duration
        
write_short10<<16 // fade lasts this long hold time
        
write_short1<<// fade type (in / out)
        
write_byte// fade red
        
write_byte// fade green
        
write_byte// fade blue
        
write_byte210 // fade alpha
        
message_end()
    }


Last edited by juanjotoronja; 05-08-2015 at 12:53.
juanjotoronja is offline
 



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 20:14.


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