AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   zp custom zombie idle, pain, death sounds (https://forums.alliedmods.net/showthread.php?t=278516)

alexclaudiu2003 02-02-2016 12:04

zp custom zombie idle, pain, death sounds
 
Hello everyone,
I try to put sounds: death, pain and idle
but receive compilation error
Attachment 151532
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))



OciXCrom 12-18-2016 10:29

Re: zp custom zombie idle, pain, death sounds
 
@shehzad1234 - don't help if you don't know how to. You just broke the entire plugin by removing that line.
@alexclaudiu2003 - in zp_user_infected_post, there's no "id", so change zm_idle(id) to player or infector depending on what you need it for.


All times are GMT -4. The time now is 09:21.

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