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

[ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death


Post New Thread Reply   
 
Thread Tools Display Modes
UnspeakableTruthz
Junior Member
Join Date: Dec 2013
Location: i am A Stickman Fighting
Old 12-20-2013 , 05:03   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #11

Cool Could use this sometime
__________________
or MY FB
UnspeakableTruthz is offline
alexclaudiu2003
Senior Member
Join Date: Aug 2011
Location: Romania
Old 01-28-2016 , 03:37   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #12

I tried many times to this zpa classes, don't work,
can you help me ?
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#define ZM_PAIN 3
new pain_zm[ZM_PAIN][] = {"zombie_plague/mycustompain1.wav""zombie_plague/mycustompain2.wav""zombie_plague/mycustompain3.wav" }
#define ZM_DEATH 3
new death_zm[ZM_DEATH][] = {"zombie_plague/mycustomdeath1.wav""zombie_plague/mycustomdeath2.wav""zombie_plague/mycustomdeath3.wav" }
#define ZM_IDLE 3
new idle_zm[ZM_IDLE][] = {"zombie_plague/mycustomidle1.wav""zombie_plague/mycustomidle2.wav""zombie_plague/mycustomidle3.wav" }
#define PLUGIN "[ZP] Class : Leap Zombie"
#define VERSION "1.4.2"
#define AUTHOR "Fry!"
new const zclass_name[] = "Hunter"
new const zclass_info[] = "HP+ Speed++ Gravity++"
new const zclass_model[] = "huunter"
new const zclass_clawmodel[] = "HunterZ.mdl"
const zclass_health 8000
const zclass_speed 250
const Float:zclass_gravity 0.60
const Float:zclass_knockback 0
new bool:g_hasLeap[33]
new 
Float:g_last_LongJump_time[33]
new 
g_zclass_Leapg_Leap_forceg_Leap_height g_LongJump_cooldown
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_cvar("zp_zclass_leap_zombie",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
    
    
g_Leap_force register_cvar("zp_zclass_leap_force""470")
    
g_Leap_height register_cvar("zp_zclass_leap_height""275")
    
g_LongJump_cooldown register_cvar("zp_longjump_cooldown""1.0")
    
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
    
register_forwardFM_EmitSound"fw_EmitSound" )
    
register_event("Damage","event_pain_zombie","be","2!0","3=0")
}
public 
plugin_precache()
{
    
g_zclass_Leap zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
    new 
i
    
    
for (0ZM_DEATHi++)
        
precache_sound(death_zm[i])
    
    for (
0ZM_IDLEi++)
        
precache_sound(idle_zm[i])
    
    for (
0ZM_PAINi++)
        
precache_sound(pain_zm[i])
}
public 
client_connect(id)
{
    
g_hasLeap[id] = false
}
             
public 
zp_user_infected_post(playerinfector)
{
    if (
zp_get_user_zombie_class(player) == g_zclass_Leap)
        
g_hasLeap[player] = true
 zm_idle
(id)
    return 
PLUGIN_CONTINUE
}
public 
zp_user_humanized_post(player)
{
    
g_hasLeap[player] = false
}
public 
fw_EmitSound(idchannelsample[])
{
    
    if (!
is_user_connected(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclass_Leap && !zp_get_user_nemesisid ))
        return 
FMRES_IGNORED;
    
    if(
sample[0] == 'p' && sample[1] == 'l'&& sample[7] == 'd' && !zp_get_user_nemesisid ))
    {
        
emit_sound(idCHAN_VOICE,  death_zm[random_num(0ZM_DEATH 1)], VOL_NORMATTN_NORM0PITCH_NORM)
        return 
FMRES_SUPERCEDE    
    
}
    return 
FMRES_IGNORED;
}
public 
event_pain_zombie(id)
{
    
    if (!
is_user_connected(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclass_Leap)
        return 
PLUGIN_HANDLED
    
    
if(is_user_connected(id))
    {
        
        if (
zp_get_user_zombie(id))
        {
            if (
zp_get_user_zombie_class(id) == g_zclass_Leap && !zp_get_user_nemesisid ))
            {
                
emit_sound(idCHAN_VOICEpain_zm[random_num(0ZM_PAIN 1)], 1.0ATTN_NORM0PITCH_NORM)
            }
        }
    }
    return 
PLUGIN_HANDLED
}
public 
zm_idle(id)
{
    if (!
is_user_connected(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclass_Leap && !zp_get_user_nemesisid ))
        return 
PLUGIN_HANDLED
        
    
    
if (random_num(135) == && zp_get_user_zombie_class(id) == g_zclass_Leap && !zp_get_user_nemesisid )) {
        if(
is_user_alive(id) && zp_get_user_zombie(id))
            
emit_sound(idCHAN_VOICEidle_zm[random_num(0ZM_IDLE -1)], 1.0ATTN_NORM0PITCH_NORM)
    }
    if(
zp_get_user_zombie_class(id) == g_zclass_Leap)
        
set_task(1.0,"zm_idle",id)
        
    return 
PLUGIN_HANDLED
}
public 
fw_PlayerPreThink(id)
{
    if (!
is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_nemesis(id))
 return 
FMRES_IGNORED
    
    
if (zp_get_user_zombie_class(id) != g_zclass_Leap)
    {
        
g_hasLeap[id] = false
    
}
    
    if (
allowed_Leap(id))
    {
        
g_hasLeap[id] = true
        
        
static Float:velocity[3]
        
velocity_by_aim(idget_pcvar_num(g_Leap_force), velocity)
        
        
velocity[2] = get_pcvar_float(g_Leap_height)
        
        
set_pev(idpev_velocityvelocity)
        
g_last_LongJump_time[id] = get_gametime()
    }
    
    return 
FMRES_IGNORED
}
allowed_Leap(id)
{   
    if (!
zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclass_Leap)
        return 
false
       
    
    
static buttons
    buttons 
pev(idpev_button)
    
    if (!(
pev(idpev_flags) & FL_ONGROUND) || fm_get_speed(id) < 20 || !(buttons IN_JUMP) || !(buttons IN_DUCK))
        return 
false
    
if (get_gametime() - g_last_LongJump_time[id] < get_pcvar_float(g_LongJump_cooldown))
      return 
false
   
                     
return true
}
stock fm_get_speed(entity)
{
    static 
Float:velocity[3]
    
pev(entitypev_velocityvelocity)
    
    return 
floatround(vector_length(velocity))

Name:  Untitled-1.jpg
Views: 409
Size:  54.0 KB

Last edited by alexclaudiu2003; 02-02-2016 at 12:00.
alexclaudiu2003 is offline
Ryoukumin
New Member
Join Date: Oct 2018
Old 10-30-2018 , 14:36   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #13

Has anyone actually managed to get the custom death sound(s) part to work? I've been spending time with this EmitSound forward and so far I have had zero success.

The custom pain sounds can be heard if I register the Damage event, otherwise whenever I insert the code inside EmitSound I don't hear them in-game. It matters not whether I search for samples in player/... or in zombie_plague/... Neither location yields results. I even borrowed the same structure from zp50_zombie_sounds.sma.

After one of my countless tests I found out something interesting. When I changed this:
PHP Code:
if (sample[0] == 'z' && sample[14] == 'z' && sample[21] == 'p' && sample[24] == 'n')
    {
        
emit_sound(idCHAN_VOICESoundPain[random(sizeof(SoundPain))], volumeattnflagspitch)
        return 
FMRES_SUPERCEDE
    

Into this:
PHP Code:
if ((sample[0] == 'z' && sample[14] == 'z' && sample[21] == 'p' && sample[24] == 'n') || (sample[7] == 'h' && sample[8] == 'e' && sample[9] == 'a'))
    {
        
emit_sound(idCHAN_VOICESoundPain[random(sizeof(SoundPain))], volumeattnflagspitch)
        return 
FMRES_SUPERCEDE
    


I am able to hear the custom pain sounds when the zombie class receives headshot damage, anything else (body shots, death) still not working. Then immediately after, it occurred to me that Zombie Plague (5.0.8?) does not replace headshot sounds by default.

To me it makes little to no sense. Why would only one part of the if statement work? I have attached the dummy class I've been conducting these tests on for the past 36 hours.
Attached Files
File Type: sma Get Plugin or Get Source (zp_class_zombie_test.sma - 294 views - 3.6 KB)
Ryoukumin is offline
Reply



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 18:41.


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