AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Suggestion / Subplugin Request ZP 5.0 Infected sound like Biohazard (https://forums.alliedmods.net/showthread.php?t=345846)

rh4ptor 02-01-2024 06:24

ZP 5.0 Infected sound like Biohazard
 
Hello, for ZP 5.0 I want the infected sound to be heard by everyone in the game like Biohazard mode

mlibre 02-01-2024 11:56

Re: ZP 5.0 Infected sound like Biohazard
 
sma?

rh4ptor 02-01-2024 19:37

Re: ZP 5.0 Infected sound like Biohazard
 
Quote:

Originally Posted by mlibre (Post 2817198)
sma?

Yes please

mlibre 02-02-2024 10:00

Re: ZP 5.0 Infected sound like Biohazard
 
provide the one you use

rh4ptor 02-02-2024 15:48

Re: ZP 5.0 Infected sound like Biohazard
 
Quote:

Originally Posted by mlibre (Post 2817279)
provide the one you use

I don't understand exactly what you want

mlibre 02-03-2024 07:30

Re: ZP 5.0 Infected sound like Biohazard
 
where did you get the mode, source code

rh4ptor 02-03-2024 08:03

Re: ZP 5.0 Infected sound like Biohazard
 
Quote:

Originally Posted by mlibre (Post 2817343)
where did you get the mode, source code

I don't understand much about these issues, it would be better for me if you explain it in a way that everyone can understand.

What I want is for the screams of the infected to be heard by everyone

rh4ptor 02-03-2024 08:12

Re: ZP 5.0 Infected sound like Biohazard
 
Quote:

Originally Posted by mlibre (Post 2817343)
where did you get the mode, source code

I think this is what you want

PHP Code:

/*================================================================================
    
    ----------------------------
    -*- [ZP] Effects: Infect -*-
    ----------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include <amxmodx>
#include <hlsdk_const>
#include <amx_settings_api>
#include <zp50_core>

// Settings file
new const ZP_SETTINGS_FILE[] = "zombieplague.ini"

// Default sounds
new const sound_infect[][] = { "zombie_plague/zombie_infec1.wav" "zombie_plague/zombie_infec2.wav" "zombie_plague/zombie_infec3.wav" "scientist/c1a0_sci_catscream.wav" "scientist/scream01.wav" }

#define SOUND_MAX_LENGTH 64

// Custom sounds
new Array:g_sound_infect

// HUD messages
#define HUD_INFECT_X 0.05
#define HUD_INFECT_Y 0.45
#define HUD_INFECT_R 255
#define HUD_INFECT_G 0
#define HUD_INFECT_B 0

// Some constants
const UNIT_SECOND = (1<<12)
const 
FFADE_IN 0x0000

new g_HudSync
new g_MsgDeathMsgg_MsgScoreAttrib
new g_MsgScreenFadeg_MsgScreenShakeg_MsgDamage

new cvar_infect_show_hud
new cvar_infect_show_notice
new cvar_infect_sounds

new cvar_infect_screen_fadecvar_infect_screen_fade_Rcvar_infect_screen_fade_Gcvar_infect_screen_fade_B
new cvar_infect_screen_shake
new cvar_infect_hud_icon
new cvar_infect_tracers
new cvar_infect_particles
new cvar_infect_sparklecvar_infect_sparkle_Rcvar_infect_sparkle_Gcvar_infect_sparkle_B

public plugin_init()
{
    
register_plugin("[ZP] Effects: Infect"ZP_VERSION_STRING"ZP Dev Team")
    
    
// Create the HUD Sync Objects
    
g_HudSync CreateHudSyncObj()
    
    
g_MsgDeathMsg get_user_msgid("DeathMsg")
    
g_MsgScoreAttrib get_user_msgid("ScoreAttrib")
    
g_MsgScreenFade get_user_msgid("ScreenFade")
    
g_MsgScreenShake get_user_msgid("ScreenShake")
    
g_MsgDamage get_user_msgid("Damage")
    
    
cvar_infect_show_hud register_cvar("zp_infect_show_hud""1")
    
cvar_infect_show_notice register_cvar("zp_infect_show_notice""1")
    
cvar_infect_sounds register_cvar("zp_infect_sounds""1")
    
    
cvar_infect_screen_fade register_cvar("zp_infect_screen_fade""1")
    
cvar_infect_screen_fade_R register_cvar("zp_infect_screen_fade_R""0")
    
cvar_infect_screen_fade_G register_cvar("zp_infect_screen_fade_G""150")
    
cvar_infect_screen_fade_B register_cvar("zp_infect_screen_fade_B""0")
    
cvar_infect_screen_shake register_cvar("zp_infect_screen_shake""1")
    
cvar_infect_hud_icon register_cvar("zp_infect_hud_icon""1")
    
cvar_infect_tracers register_cvar("zp_infect_tracers""1")
    
cvar_infect_particles register_cvar("zp_infect_particles""1")
    
cvar_infect_sparkle register_cvar("zp_infect_sparkle""1")
    
cvar_infect_sparkle_R register_cvar("zp_infect_sparkle_R""0")
    
cvar_infect_sparkle_G register_cvar("zp_infect_sparkle_G""150")
    
cvar_infect_sparkle_B register_cvar("zp_infect_sparkle_B""0")
}

public 
plugin_precache()
{
    
// Initialize arrays
    
g_sound_infect ArrayCreate(SOUND_MAX_LENGTH1)
    
    
// Load from external file
    
amx_load_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ZOMBIE INFECT"g_sound_infect)
    
    
// If we couldn't load custom sounds from file, use and save default ones
    
new index
    
if (ArraySize(g_sound_infect) == 0)
    {
        for (
index 0index sizeof sound_infectindex++)
            
ArrayPushString(g_sound_infectsound_infect[index])
        
        
// Save to external file
        
amx_save_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ZOMBIE INFECT"g_sound_infect)
    }
    
    
// Precache sounds
    
new sound[SOUND_MAX_LENGTH]
    for (
index 0index ArraySize(g_sound_infect); index++)
    {
        
ArrayGetString(g_sound_infectindexsoundcharsmax(sound))
        
precache_sound(sound)
    }
}

public 
zp_fw_core_infect_post(idattacker)
{    
    
// Attacker is valid?
    
if (is_user_connected(attacker))
    {
        
// Infection sounds?
        
if (get_pcvar_num(cvar_infect_sounds))
        {
            static 
sound[SOUND_MAX_LENGTH]
            
ArrayGetString(g_sound_infectrandom_num(0ArraySize(g_sound_infect) - 1), soundcharsmax(sound))
            
emit_sound(idCHAN_VOICEsound1.0ATTN_NORM0PITCH_NORM)
        }
        
        
// Player infected himself
        
if (attacker == id)
        {
            
// Show Infection HUD notice? (except for first zombie)
            
if (get_pcvar_num(cvar_infect_show_hud) && !zp_core_is_first_zombie(id))
            {
                new 
victim_name[32]
                
get_user_name(idvictim_namecharsmax(victim_name))
                
set_hudmessage(HUD_INFECT_RHUD_INFECT_GHUD_INFECT_BHUD_INFECT_XHUD_INFECT_Y00.05.01.01.0, -1)
                
ShowSyncHudMsg(0g_HudSync"%L"LANG_PLAYER"NOTICE_INFECT"victim_name)
            }
        }
        else
        {
            
// Show Infection HUD notice?
            
if (get_pcvar_num(cvar_infect_show_hud))
            {
                new 
attacker_name[32], victim_name[32]
                
get_user_name(attackerattacker_namecharsmax(attacker_name))
                
get_user_name(idvictim_namecharsmax(victim_name))
                
set_hudmessage(HUD_INFECT_RHUD_INFECT_GHUD_INFECT_BHUD_INFECT_XHUD_INFECT_Y00.05.01.01.0, -1)
                
ShowSyncHudMsg(0g_HudSync"%L"LANG_PLAYER"NOTICE_INFECT2"victim_nameattacker_name)
            }
            
            
// Show infection death notice?
            
if (get_pcvar_num(cvar_infect_show_notice))
            {
                
// Send death notice and fix the "dead" attrib on scoreboard
                
SendDeathMsg(attackerid)
                
FixDeadAttrib(id)
            }
        }
    }
    
    
// Infection special effects (delay needed so origin is updated after spawning)
    
set_task(0.1"infection_effects"id)
}

public 
infection_effects(id)
{
    
// Player died/disconnected
    
if (!is_user_alive(id))
        return;
    
    
// Screen fade?
    
if (get_pcvar_num(cvar_infect_screen_fade))
    {
        
message_begin(MSG_ONE_UNRELIABLEg_MsgScreenFade_id)
        
write_short(UNIT_SECOND// duration
        
write_short(0// hold time
        
write_short(FFADE_IN// fade type
        
write_byte(get_pcvar_num(cvar_infect_screen_fade_R)) // r
        
write_byte(get_pcvar_num(cvar_infect_screen_fade_G)) // g
        
write_byte(get_pcvar_num(cvar_infect_screen_fade_B)) // b
        
write_byte (255// alpha
        
message_end()
    }
    
    
// Screen shake?
    
if (get_pcvar_num(cvar_infect_screen_shake))
    {
        
message_begin(MSG_ONE_UNRELIABLEg_MsgScreenShake_id)
        
write_short(UNIT_SECOND*4// amplitude
        
write_short(UNIT_SECOND*2// duration
        
write_short(UNIT_SECOND*10// frequency
        
message_end()
    }
    
    
// Infection icon?
    
if (get_pcvar_num(cvar_infect_hud_icon))
    {
        
message_begin(MSG_ONE_UNRELIABLEg_MsgDamage_id)
        
write_byte(0// damage save
        
write_byte(0// damage take
        
write_long(DMG_NERVEGAS// damage type - DMG_RADIATION
        
write_coord(0// x
        
write_coord(0// y
        
write_coord(0// z
        
message_end()
    }
    
    
// Get player's origin
    
new origin[3]
    
get_user_origin(idorigin)
    
    
// Tracers?
    
if (get_pcvar_num(cvar_infect_tracers))
    {
        
message_begin(MSG_PVSSVC_TEMPENTITYorigin)
        
write_byte(TE_IMPLOSION// TE id
        
write_coord(origin[0]) // x
        
write_coord(origin[1]) // y
        
write_coord(origin[2]) // z
        
write_byte(128// radius
        
write_byte(20// count
        
write_byte(3// duration
        
message_end()
    }
    
    
// Particle burst?
    
if (get_pcvar_num(cvar_infect_particles))
    {
        
message_begin(MSG_PVSSVC_TEMPENTITYorigin)
        
write_byte(TE_PARTICLEBURST// TE id
        
write_coord(origin[0]) // x
        
write_coord(origin[1]) // y
        
write_coord(origin[2]) // z
        
write_short(50// radius
        
write_byte(70// color
        
write_byte(3// duration (will be randomized a bit)
        
message_end()
    }
    
    
// Light sparkle?
    
if (get_pcvar_num(cvar_infect_sparkle))
    {
        
message_begin(MSG_PVSSVC_TEMPENTITYorigin)
        
write_byte(TE_DLIGHT// TE id
        
write_coord(origin[0]) // x
        
write_coord(origin[1]) // y
        
write_coord(origin[2]) // z
        
write_byte(20// radius
        
write_byte(get_pcvar_num(cvar_infect_sparkle_R)) // r
        
write_byte(get_pcvar_num(cvar_infect_sparkle_G)) // g
        
write_byte(get_pcvar_num(cvar_infect_sparkle_B)) // b
        
write_byte(2// life
        
write_byte(0// decay rate
        
message_end()
    }
}

// Send Death Message for infections
SendDeathMsg(attackervictim)
{
    
message_begin(MSG_BROADCASTg_MsgDeathMsg)
    
write_byte(attacker// killer
    
write_byte(victim// victim
    
write_byte(1// headshot flag
    
write_string("infection"// killer's weapon
    
message_end()
}

// Fix Dead Attrib on scoreboard
FixDeadAttrib(id)
{
    
message_begin(MSG_BROADCASTg_MsgScoreAttrib)
    
write_byte(id// id
    
write_byte(0// attrib
    
message_end()



mlibre 02-03-2024 10:39

Re: ZP 5.0 Infected sound like Biohazard
 
Quote:

Originally Posted by rh4ptor (Post 2817350)
I think this is what you want

thank God :comply:

secret


Quote:

Originally Posted by rh4ptor (Post 2817150)
want the infected sound to be heard by everyone in the game like Biohazard mode

try to change the id

Code:
emit_sound(id, CHAN_VOICE, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)

:arrow:

PHP Code:

emit_sound(0CHAN_VOICEsound1.0ATTN_NORM0PITCH_NORM


haxhi qamili 02-27-2024 08:16

Re: ZP 5.0 Infected sound like Biohazard
 
emit_sound has origin therefore replacing id with 0 won't work well

you can replace
PHP Code:

emit_sound(idCHAN_VOICEsound1.0ATTN_NORM0PITCH_NORM

with
PHP Code:

client_cmd(0"spk %s"sound



All times are GMT -4. The time now is 06:34.

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