AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [Request] Breathing effect (https://forums.alliedmods.net/showthread.php?t=262459)

juanjotoronja 05-04-2015 18:55

[Request] Breathing effect
 
Hello im looking for a simple plugin that emulates gasmask breathing sound, i have the sound but i need a plugin that when the round begins start playing the sound file and when the player is dead/disconnect/spectator the sound should stop. The sound file lenght is 1:35 min this should be loop everytime it ends. Thanks

ANTICHRISTUS 05-08-2015 08:55

Re: [Request] Breathing effect
 
If you (or anyone else) may extract the related part of code: there is a plugin made by ConnorMcLeod.

juanjotoronja 05-08-2015 12:52

Re: [Request] Breathing effect
 
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()
    }




All times are GMT -4. The time now is 20:14.

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