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
Author Message
Nax0ne
Senior Member
Join Date: Jul 2011
Location: Chile
Old 12-17-2013 , 11:37   [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #1



How to make our own custom sounds: Idle, Pain & Death

Quote:
This tutorial was tested for me, 100% working. Without any error. But, I do not know if it works in Zombie Plague 5.0, this was tested in Zombie Plague 4.3
Sometimes we'd like zombie classes have different sounds. It is very boring to hear the usual sounds that have the Zombie Plague. In this tutorial I will teach you to how to do it. For that, I need you to follow this tutorial step by step. If you do something wrong, the result will not be expected.

Well... What are we waiting for? let's start with this...




1. We will take as base file zp_zombie_classes_example.sma

PHP Code:
/*================================================================================
    
    -----------------------------------
    -*- [ZP] Zombie Classes Example -*-
    -----------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    This is just an example on how to add additional zombie classes to ZP.
    
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <zombieplague>

// Zombie Attributes
new const zclass_name[] = "My Zombie" // name
new const zclass_info[] = "My Stats" // description
new const zclass_model[] = "zombie_source" // model
new const zclass_clawmodel[] = "v_knife_zombie.mdl" // claw model
const zclass_health 1800 // health
const zclass_speed 190 // speed
const Float:zclass_gravity 1.0 // gravity
const Float:zclass_knockback 1.0 // knockback

// Class IDs
new g_zclassid1

// Zombie Classes MUST be registered on plugin_precache
public plugin_precache()
{
    
register_plugin("[ZP] Additional Zombie Classes""0.1""Example")
    
    
// Register the new class and store ID for reference
    
g_zclassid1 zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)    
}

// User Infected forward
public zp_user_infected_post(idinfector)
{
    
// Check if the infected player is using our custom zombie class
    
if (zp_get_user_zombie_class(id) == g_zclassid1)
    {
        
client_print(idprint_chat"[ZP] You're using a custom zombie class! Enjoy 100 extra HP!")
        
set_pev(idpev_healthfloat(pev(idpev_health)) + 100.0)
    }

2. We have to have in our hand the sounds that we will occupy. First for all, we defined as an array for each.

PHP Code:
/*================================================================================
    
    -----------------------------------
    -*- [ZP] Zombie Classes Example -*-
    -----------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    This is just an example on how to add additional zombie classes to ZP.
    
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

// We defined the sounds

#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" 
3. Now that we have defined the sounds, we will register it in plugin_precache()

PHP Code:
// Zombie Classes MUST be registered on plugin_precache
public plugin_precache()
{
    
register_plugin("[ZP] Additional Zombie Classes""0.1""Example")
    
    
// Register the new class and store ID for reference
    
g_zclassid1 zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)

    
// We recorded the sounds
    
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])

4. The sounds are ready, but there are still some features that we must place in the plugin for that can be heard by the players and by you. So, we will proceed to register a forward and an event.

For that, we must create a plugin_init() and record functions.


PHP Code:
public plugin_init() 
{    
    
// Forward
    
register_forwardFM_EmitSound"fw_EmitSound" )
    
    
// Event
    
register_event("Damage","event_pain_zombie","be","2!0","3=0")

5. Now we must create the public functions.

PHP Code:
public fw_EmitSound(idchannelsample[])
{
    
    if (!
is_user_connected(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclassid1 && !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_zclassid1)
        return 
PLUGIN_HANDLED
    
    
if(is_user_connected(id))
    {
        
        if (
zp_get_user_zombie(id))
        {
            if (
zp_get_user_zombie_class(id) == g_zclassid1 && !zp_get_user_nemesisid ))
            {
                
emit_sound(idCHAN_VOICEpain_zm[random_num(0ZM_PAIN 1)], 1.0ATTN_NORM0PITCH_NORM)
            }
        }
    }
    return 
PLUGIN_HANDLED

6. All is well! Our zombie will have their own custom sounds of death and pain. Now proceed to create the idle sounds.

We must create a task.


PHP Code:
public zm_idle(id)
{
    if (!
is_user_connected(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclassid1 && !zp_get_user_nemesisid ))
        return 
PLUGIN_HANDLED
        
    
    
if (random_num(135) == && zp_get_user_zombie_class(id) == g_zclassid1 && !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_zclassid1)
        
set_task(1.0,"zm_idle",id)
        
    return 
PLUGIN_HANDLED

7. Finally, we must go to zp_user_infected_post (id, infector) and put the zm_idle(id)

PHP Code:
// User Infected forward
public zp_user_infected_post(idinfector)
{
    
// Check if the infected player is using our custom zombie class
    
if (zp_get_user_zombie_class(id) == g_zclassid1)
    {
        
client_print(idprint_chat"[ZP] You're using a custom zombie class! Enjoy 100 extra HP!")
        
set_pev(idpev_healthfloat(pev(idpev_health)) + 100.0)
        
zm_idle(id)
    }



And that's it. Thanks for checking out my tutorial! Any questions, concerns or suggestions may publish it here.


Last edited by Nax0ne; 12-17-2013 at 13:44.
Nax0ne is offline
Old 12-17-2013, 13:24
K4rim
This message has been deleted by K4rim. Reason: nope
Nax0ne
Senior Member
Join Date: Jul 2011
Location: Chile
Old 12-17-2013 , 13:37   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #2

@K4rim

Test it.

PD: I can not compile, I get an error. It is because i don't occupy Zombie Plague 5.0
But it should work perfectly, because you occupy Zombie Plague 5.0

Anyway, i do not know if it will work on Zombie Plague 5.0

PHP Code:
/*================================================================================ 

--------------------------------------- 
-*- [ZP] Class Zombie: Brute Mother -*- 
--------------------------------------- 

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 <cstrike> 
#include <fakemeta> 

#if AMXX_VERSION_NUM < 180 
#assert AMX Mod X v1.8.0 or later library required! 
#endif 

#include <hamsandwich> 

/*================================================================================ 
[Zombie Plague 5.0 Includes] 
=================================================================================*/ 

#include <cs_ham_bots_api> 
#include <zp50_class_zombie> 
#define LIBRARY_NEMESIS "zp50_class_nemesis" 
#include <zp50_class_nemesis> 
#define LIBRARY_AMMOPACKS "zp50_ammopacks" 
#include <zp50_ammopacks> 

/*================================================================================ 
[Sound] // My Custom sound 
=================================================================================*/ 
#define ZM_PAIN 3 
new pain_zm[ZM_PAIN][] = {"nst_player/f_bhit_flesh-1.wav""nst_player/f_bhit_flesh-2.wav""nst_player/f_bhit_flesh-3.wav" 

#define ZM_DEATH 3 
new death_zm[ZM_DEATH][] = {"nst_player/f_die1.wav""nst_player/f_die2.wav""nst_player/f_die3.wav" 

#define ZM_IDLE 3 
new idle_zm[ZM_IDLE][] = {"nst_zombie/zombi_female_laugh.wav""nst_zombie/zombi_female_scream.wav""nst_zombie/zombi_female_headup.wav" }  

/*================================================================================ 
[Constants, Offsets, Macros] 
=================================================================================*/ 

// Plugin Version 
new const PLUGIN_VERSION[] = "1.1.0" 

// Brute Mother 
new const zclass_name[] = { "Brute Mother Zombie" 
new const 
zclass_info[] = { "=Balanced= Heal (hold +use)" 
new const 
zclass_model[][] = { "zombie_source" 
new const 
zclass_clawmodel[][] = { "models/zombie_plague/v_knife_zombie.mdl" 
const 
zclass_health 1800 
const Float:zclass_speed 0.75 
const Float:zclass_gravity 1.00 
const Float:zclass_knockback 1.00 

/*================================================================================ 
[Global Variables] 
=================================================================================*/ 

// Player vars 
new g_bZombie[33// whether player is zombie 
new g_bMother[33// whether player is brute mother 
new g_bHealing[33// whether player is healing 
new g_bInRange[33][33// whether zombie is in range 
new Float:g_flMaxHealth[33// zombie's max health 
new g_iHealCounter[33// brute mother heal counter 

// Game vars 
new g_iMotherIndex // index from the class 
new g_iMaxPlayers // max player counter 

// Cvar pointers 
new cvar_Intervalcvar_Amountcvar_Rangecvar_Counter 

// Healing Color 
new g_iColor[3] = { 150 

// Player stuff 
new g_bIsAlive[33// whether player is alive 
new g_bIsBot[33// whether player is bot 

// Macro 
#define is_user_valid_alive(%1)    (1 <= %1 <= g_iMaxPlayers && g_bIsAlive[%1]) 

// ZP 5.0 cvars 
new cvar_ammopack_to_money_ratio 

/*================================================================================ 
[Precache and Init] 
=================================================================================*/ 

public plugin_precache() 

    
register_plugin("[ZP] Class Zombie: Brute Mother"PLUGIN_VERSION"schmurgel1983"
    
    new 
index 
    g_iMotherIndex 
zp_class_zombie_register(zclass_namezclass_infozclass_healthzclass_speedzclass_gravity
    
zp_class_zombie_register_kb(g_iMotherIndexzclass_knockback
    for (
index 0index sizeof zclass_modelindex++) 
        
zp_class_zombie_register_model(g_iMotherIndexzclass_model[index]) 
    for (
index 0index sizeof zclass_clawmodelindex++) 
        
zp_class_zombie_register_claw(g_iMotherIndexzclass_clawmodel[index]) 
    
    
// Precache Sound
    
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 
plugin_init() 

    
// Event 
    
register_event("SendAudio""event_end_round""a""2&%!MRAD_terwin""2&%!MRAD_ctwin""2&%!MRAD_rounddraw"
    
register_event("TextMsg""event_end_round""a""2=#Game_Commencing""2=#Game_will_restart_in"
    
register_event("Damage","event_pain_zombie","be","2!0","3=0"
    
    
RegisterHam(Ham_Spawn"player""fwd_PlayerSpawn_Post"1
    
RegisterHamBots(Ham_Spawn"fwd_PlayerSpawn_Post"1
    
RegisterHam(Ham_Killed"player""fwd_PlayerKilled_Post"1
    
RegisterHamBots(Ham_Killed"fwd_PlayerKilled_Post"1
    
    
// Forward 
    
register_forward(FM_PlayerPreThink"fwd_PlayerPreThink"
    
register_forward(FM_AddToFullPack"fwd_AddToFullPack_Post"1
    
register_forwardFM_EmitSound"fw_EmitSound" )     
    
    
cvar_Interval register_cvar("zp_mother_interval""0.2"
    
cvar_Amount register_cvar("zp_mother_amount""10"
    
cvar_Range register_cvar("zp_mother_range""128"
    
cvar_Counter register_cvar("zp_mother_counter""200"
    
    
register_cvar("Brute_Mother_version"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY
    
set_cvar_string("Brute_Mother_version"PLUGIN_VERSION
    
    
g_iMaxPlayers get_maxplayers() 


public 
plugin_cfg() cvar_ammopack_to_money_ratio get_cvar_pointer("zp_ammopack_to_money_ratio"

public 
client_putinserver(id

    
set_cvars(id
    
    if (
is_user_bot(id)) g_bIsBot[id] = true


public 
client_disconnected(id

    
set_cvars(id
    
g_bIsBot[id] = false 


public 
plugin_natives() 

    
set_module_filter("module_filter"
    
set_native_filter("native_filter"


public 
module_filter(const module[]) 

    if (
equal(moduleLIBRARY_NEMESIS) || equal(moduleLIBRARY_AMMOPACKS)) 
        return 
PLUGIN_HANDLED
    
    return 
PLUGIN_CONTINUE


public 
native_filter(const name[], indextrap

    if (!
trap
        return 
PLUGIN_HANDLED
    
    return 
PLUGIN_CONTINUE


/*================================================================================ 
[Main Forwards] 
=================================================================================*/ 

public event_pain_zombie(id)
{
    
    if (!
is_user_connected(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_iMotherIndex )
        return 
PLUGIN_HANDLED
    
    
if(is_user_connected(id))
    {
        
        if (
zp_get_user_zombie(id))
        {
            if (
zp_get_user_zombie_class(id) == g_iMotherIndex && !zp_get_user_nemesisid ))
            {
                
emit_sound(idCHAN_VOICEpain_zm[random_num(0ZM_PAIN 1)], 1.0ATTN_NORM0PITCH_NORM)
            }
        }
    }
    return 
PLUGIN_HANDLED
}  

public 
event_end_round() 

    for (new 
id 1id <= g_iMaxPlayersid++) 
        
set_cvars(id


public 
fw_EmitSound(idchannelsample[])
{
    
    if (!
is_user_connected(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_iMotherIndex && !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 
fwd_PlayerSpawn_Post(id

    if (!
is_user_alive(id) || !cs_get_user_team(id)) return 
    
    
g_bIsAlive[id] = true 


public 
fwd_PlayerKilled_Post(victimattackergib

    
g_bIsAlive[victim] = false 
    set_cvars
(victim


public 
fwd_PlayerPreThink(id

    if (!
g_bMother[id] || !g_bIsAlive[id] || g_bIsBot[id]) return 
    
    
g_bHealing[id] = (pev(idpev_button) & IN_USE) ? true false


public 
fwd_AddToFullPack_Post(es_handleeenthostflagsplayerpSet

    if (!
player || !g_bZombie[host] || !g_bZombie[ent]) return FMRES_IGNORED 
    
    
if (g_bHealing[host] && g_bInRange[host][ent] || g_bHealing[ent]) 
    { 
        
set_es(es_handleES_RenderFxkRenderFxGlowShell
        
set_es(es_handleES_RenderColorg_iColor
        
set_es(es_handleES_RenderAmt5
        
        return 
FMRES_IGNORED 
    

    return 
FMRES_IGNORED 


public 
zp_fw_core_infect_post(idattacker

    
set_cvars(id
    
    
g_bZombie[id] = true 
    pev
(idpev_healthg_flMaxHealth[id]) 
    
    if (
zp_class_zombie_get_current(id) == g_iMotherIndex
    { 
        if (
LibraryExists(LIBRARY_NEMESISLibType_Library) && zp_class_nemesis_get(id)) return 
        
        
g_bMother[id] = true 
        set_task
(get_pcvar_float(cvar_Interval), "Mother_Heal"id__"b"
        
zm_idle(id
        
        if (
g_bIsBot[id]) 
            
g_bHealing[id] = true 
    



public 
zp_fw_core_cure_post(idset_cvars(id

// Support CSO In-Game Theme 5.4 or higher 
//forward zp_cso_theme_evohp_lvlup(iInfector, iEvoHp) 
public zp_cso_theme_evohp_lvlup(iInfectoriEvoHp

    new 
Float:health float(iEvoHp
    
    if (
health g_flMaxHealth[iInfector]) 
        
g_flMaxHealth[iInfector] = health 


/*================================================================================ 
[Other Functions] 
=================================================================================*/ 

set_cvars(id

remove_task(id
g_bZombie[id] = g_bMother[id] = g_bHealing[id] = false 
g_iHealCounter
[id] = 


public 
Mother_Heal(id

if (!
g_bHealing[id]) return 

static 
Float:originF[3
pev(idpev_originoriginF

for (new 
1<= g_iMaxPlayersi++) 
    
g_bInRange[id][i] = false 
    
    
static Float:rangeFloat:amountvictim 
    range 
get_pcvar_float(cvar_Range
    
amount get_pcvar_float(cvar_Amount
    
victim = -
    
    
while ((victim engfunc(EngFunc_FindEntityInSpherevictimoriginFrange)) != 0
    { 
        if (!
is_user_valid_alive(victim) || !g_bZombie[victim] || victim == id) continue 
        
        
g_bInRange[id][victim] = true 
        
        
new Float:currentHP 
        pev
(victimpev_healthcurrentHP)         
        if (
currentHP amount g_flMaxHealth[victim]) 
        { 
            
set_pev(victimpev_healthcurrentHP amount
            
g_iHealCounter[id]++ 
        } 
        else 
            
set_pev(victimpev_healthg_flMaxHealth[victim]) 
    } 
    
    while (
g_iHealCounter[id] > get_pcvar_num(cvar_Counter)) 
    { 
        static 
origin[3
        
get_user_origin(idorigin
        
        
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() 
        
        if (
LibraryExists(LIBRARY_AMMOPACKSLibType_Library)) 
            
zp_ammopacks_set(idzp_ammopacks_get(id) + 1
        else if (
cvar_ammopack_to_money_ratio
            
cs_set_user_money(idcs_get_user_money(id) + get_pcvar_num(cvar_ammopack_to_money_ratio)) 
        else 
            
cs_set_user_money(idcs_get_user_money(id) + 160
        
        
g_iHealCounter[id] -= get_pcvar_num(cvar_Counter
    } 
}

public 
zm_idle(id)
{
    if (!
is_user_connected(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_iMotherIndex && !zp_get_user_nemesisid ))
        return 
PLUGIN_HANDLED
    
    
    
if (random_num(135) == && zp_get_user_zombie_class(id) == g_iMotherIndex && !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_iMotherIndex)
        
set_task(1.0,"zm_idle",id)
    
    return 
PLUGIN_HANDLED


Last edited by Nax0ne; 12-17-2013 at 13:45.
Nax0ne is offline
Nax0ne
Senior Member
Join Date: Jul 2011
Location: Chile
Old 12-17-2013 , 13:50   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #3

Quote:
Originally Posted by K4rim View Post
same error as i do before
You are using the "natives" of ZP 5.0

Because it occupies the "natives" of ZP 4.3. And only works on versions lower than 5.0
Nax0ne is offline
K4rim
Senior Member
Join Date: Oct 2013
Location: Malaysia
Old 12-17-2013 , 13:52   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #4

Quote:
Originally Posted by Nax0ne View Post
You are using the "natives" of ZP 5.0

Because it occupies the "natives" of ZP 4.3. And only works on versions lower than 5.0
Yup,maybe this work for zp 43 and zpa while this zombie class is for zp50,i try to fix it.btw thnx man
K4rim is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 12-17-2013 , 15:55   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #5

Try this to 5.0, i used the classic zombie..

PHP Code:
/*================================================================================
    
    -----------------------------------
    -*- [ZP] Class: Zombie: Classic -*-
    -----------------------------------
    
    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 <fakemeta>
#include <zp50_class_zombie>
#include <zp50_class_nemesis>

#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" 

// Classic Zombie Attributes
new const zombieclass1_name[] = "Classic Zombie"
new const zombieclass1_info[] = "=Balanced="
new const zombieclass1_models[][] = { "zombie_source" }
new const 
zombieclass1_clawmodels[][] = { "models/zombie_plague/v_knife_zombie.mdl" }
const 
zombieclass1_health 1800
const Float:zombieclass1_speed 0.75
const Float:zombieclass1_gravity 1.0
const Float:zombieclass1_knockback 1.0

new g_ZombieClassID

public plugin_init() 
{    
    
// Forward
    
register_forwardFM_EmitSound"fw_EmitSound" )
    
    
// Event
    
register_event("Damage","event_pain_zombie","be","2!0","3=0")
}  

public 
plugin_precache()
{
    
register_plugin("[ZP] Class: Zombie: Classic"ZP_VERSION_STRING"ZP Dev Team")
    
    new 
index
    
    g_ZombieClassID 
zp_class_zombie_register(zombieclass1_namezombieclass1_infozombieclass1_healthzombieclass1_speedzombieclass1_gravity)
    
zp_class_zombie_register_kb(g_ZombieClassIDzombieclass1_knockback)
    for (
index 0index sizeof zombieclass1_modelsindex++)
        
zp_class_zombie_register_model(g_ZombieClassIDzombieclass1_models[index])
    for (
index 0index sizeof zombieclass1_clawmodelsindex++)
        
zp_class_zombie_register_claw(g_ZombieClassIDzombieclass1_clawmodels[index])
        
    
// We recorded the sounds
         
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 
fw_EmitSound(idchannelsample[])
{
    
    if (!
is_user_connected(id) || !zp_core_is_zombie(id) || zp_class_zombie_get_current(id) != g_ZombieClassID && !zp_class_nemesis_getid ))
        return 
FMRES_IGNORED;
    
    if(
sample[0] == 'p' && sample[1] == 'l'&& sample[7] == 'd' && !zp_class_nemesis_getid ))
    {
        
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_core_is_zombie(id) || zp_class_zombie_get_current(id) != g_ZombieClassID)
        return 
PLUGIN_HANDLED
    
    
if(is_user_connected(id))
    {
        
        if (
zp_core_is_zombie(id))
        {
            if (
zp_class_zombie_get_current(id) == g_ZombieClassID && !zp_class_nemesis_getid ))
            {
                
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_core_is_zombie(id) || zp_class_zombie_get_current(id) != g_ZombieClassID && !zp_class_nemesis_getid ))
        return 
PLUGIN_HANDLED
        
    
    
if (random_num(135) == && zp_class_zombie_get_current(id) == g_ZombieClassID && !zp_class_nemesis_getid )) 
    {
        if(
is_user_alive(id) && zp_core_is_zombie(id))
            
emit_sound(idCHAN_VOICEidle_zm[random_num(0ZM_IDLE -1)], 1.0ATTN_NORM0PITCH_NORM)
    }
    if(
zp_class_zombie_get_current(id) == g_ZombieClassID)
        
set_task(1.0,"zm_idle",id)
        
    return 
PLUGIN_HANDLED
}  

public 
zp_fw_core_infect_post(idattacker)
{
    
// Check if the infected player is using our custom zombie class
    
if (zp_class_zombie_get_current(id) == g_ZombieClassID)
    {       
        
zm_idle(id)
    }

wicho is offline
K4rim
Senior Member
Join Date: Oct 2013
Location: Malaysia
Old 12-18-2013 , 11:17   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #6

Yup,it work.thnx man

Last edited by K4rim; 12-18-2013 at 11:18.
K4rim is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 12-18-2013 , 12:39   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #7

Sorry but using event damage is useless here because you already use FM_EmitSound forward. So just replace all sounds there.

A better way to set pain and death sounds

Last edited by yokomo; 12-19-2013 at 11:00. Reason: Add a better tutorial.
yokomo is offline
KhaledAwesome
Member
Join Date: Jul 2013
Old 12-18-2013 , 14:21   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #8

need help , the zombie got hands , how i make knife hit sounds? for 1 zombie not to all of zombies
KhaledAwesome is offline
Nax0ne
Senior Member
Join Date: Jul 2011
Location: Chile
Old 12-19-2013 , 10:01   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #9

Quote:
Originally Posted by KhaledAwesome View Post
need help , the zombie got hands , how i make knife hit sounds? for 1 zombie not to all of zombies
You must put this in fw_EmitSound forward. Obviously in your zombie class.

PHP Code:
    if (!is_user_connected(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclassid1 && !zp_get_user_nemesisid ))
        return 
FMRES_IGNORED
    
    
if ( sample[0] == 'w' && sample[1] == 'e' && sample[8] == 'k' && sample[9] == 'n' && !zp_get_user_nemesisid ) )
    {
        switch(
sample[17])
        {
            case 
'l': return FMRES_SUPERCEDE
                
            
case 's''w':
            {                
                
emit_sound(idCHAN_WEAPONmiss_knife[random_num(0KNIFE_MISS 1)], VOL_NORMATTN_NORM0PITCH_HIGH)    
                return 
FMRES_SUPERCEDE
            
}
            
            case 
'b''1''2''3''4':
            {
                
emit_sound(idCHAN_WEAPONhit_knife[random_num(0KNIFE_HIT 1)], VOL_NORMATTN_NORM0PITCH_HIGH)
                return 
FMRES_SUPERCEDE
            
}
        }
    } 
Now, where it says: zp_get_user_zombie_class(id) != g_zclassid1, in g_zclassid1, you must put the class name of your zombie.

Last edited by Nax0ne; 12-19-2013 at 10:05.
Nax0ne is offline
being noob
Senior Member
Join Date: Jan 2012
Location: Hindustan!!
Old 12-19-2013 , 11:21   Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
Reply With Quote #10

Good Job ..!
__________________
<3<3
being noob 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 12:14.


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