Senior Member
Join Date: Aug 2011
Location: Romania
|
01-28-2016
, 03:37
Re: [ZP][Tutorial] How to make our own custom sounds: Idle, Pain & Death
|
#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_Leap, g_Leap_force, g_Leap_height , g_LongJump_cooldown public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) 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_forward( FM_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_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback) new i for (i = 0; i < ZM_DEATH; i++) precache_sound(death_zm[i]) for (i = 0; i < ZM_IDLE; i++) precache_sound(idle_zm[i]) for (i = 0; i < ZM_PAIN; i++) precache_sound(pain_zm[i]) } public client_connect(id) { g_hasLeap[id] = false } public zp_user_infected_post(player, infector) { 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(id, channel, sample[]) { if (!is_user_connected(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclass_Leap && !zp_get_user_nemesis( id )) return FMRES_IGNORED; if(sample[0] == 'p' && sample[1] == 'l'&& sample[7] == 'd' && !zp_get_user_nemesis( id )) { emit_sound(id, CHAN_VOICE, death_zm[random_num(0, ZM_DEATH - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_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_nemesis( id )) { emit_sound(id, CHAN_VOICE, pain_zm[random_num(0, ZM_PAIN - 1)], 1.0, ATTN_NORM, 0, PITCH_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_nemesis( id )) return PLUGIN_HANDLED if (random_num(1, 35) == 5 && zp_get_user_zombie_class(id) == g_zclass_Leap && !zp_get_user_nemesis( id )) { if(is_user_alive(id) && zp_get_user_zombie(id)) emit_sound(id, CHAN_VOICE, idle_zm[random_num(0, ZM_IDLE -1)], 1.0, ATTN_NORM, 0, PITCH_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(id, get_pcvar_num(g_Leap_force), velocity) velocity[2] = get_pcvar_float(g_Leap_height) set_pev(id, pev_velocity, velocity) 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(id, pev_button) if (!(pev(id, pev_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(entity, pev_velocity, velocity) return floatround(vector_length(velocity)) }
Last edited by alexclaudiu2003; 02-02-2016 at 12:00.
|
|