Oi gente hoje queria saber como adicinar para berserker uma p_knife.mdl e sons para quando ele bater zm.
ajuda pf:Zplague17:
ajuda pf:Zplague17:
Código:
#include <amxmodx>
#include <fakemeta>
#include <zpa_new_modes>
new const Knife_Sound[][] =
{
"weapons/katanad_draw.wav",
"weapons/katanad_hit1.wav",
"weapons/katanad_hit2.wav",
"weapons/katanad_hitwall.wav",
"weapons/katanad_slash1.wav", // Mude os Sounds da Faca Aqui
"weapons/katanad_slash2.wav",
"weapons/katanad_slash3.wav",
"weapons/katanad_stab.wav",
"weapons/katanad_stab_miss.wav"
}
// Sounds Antigos da Faca (DON'T CHANGE)
new const oldknife_sounds[][] =
{
"weapons/knife_deploy1.wav", // Deploy Sound
"weapons/knife_hit1.wav", // Hit 1
"weapons/knife_hit2.wav", // Hit 2
"weapons/knife_hit3.wav", // Hit 3
"weapons/knife_hit4.wav", // Hit 4
"weapons/knife_hitwall1.wav", // Hit Wall
"weapons/knife_slash1.wav", // Slash 1
"weapons/knife_slash2.wav", // Slash 2
"weapons/knife_stab.wav" // Stab
}
new BERSERKER_P_MODEL[64] = "models/p_knife.mdl" // Coloque a model da knife aqui
new cvar_custommodel, cvar_sounds
public plugin_init()
{
register_plugin("[ZP] Addon: P_model + knife sound for Berserker", "1.0", "[P]erfec[T] [S]cr[@]s[H]")
register_event("CurWeapon", "event_CurWeapon", "b", "1=1")
register_forward(FM_EmitSound, "fw_EmitSound")
cvar_custommodel = register_cvar("zp_berserker_knife_custom", "1") // Liga e Desliga a Model da Faca do Berserker
cvar_sounds = register_cvar("zp_berserker_knife_sound_allow", "1") // Liga e Desliga os Sounds da faca do Berserker
}
public plugin_precache()
{
// Sounds
for(new i = 0; i < sizeof Knife_Sound; i++) precache_sound(Knife_Sound[i]);
for(new i = 0; i < sizeof oldknife_sounds; i++) precache_sound(oldknife_sounds[i]);
// Model
precache_model(BERSERKER_P_MODEL)
}
public event_CurWeapon(id)
{
if(zp_get_user_zombie(id)) return PLUGIN_HANDLED
new szWeapID = read_data(2)
if (szWeapID == CSW_KNIFE && zp_get_user_berserker(id) && get_pcvar_num(cvar_custommodel))
set_pev(id, pev_weaponmodel2, BERSERKER_P_MODEL);
return PLUGIN_CONTINUE
}
public fw_EmitSound(id, channel, const sound[])
{
if(!is_user_connected(id) || !is_user_alive(id) || zp_get_user_zombie(id) || !get_pcvar_num(cvar_sounds))
return FMRES_IGNORED
// Check sound
for(new i = 0; i < sizeof Knife_Sound; i++)
{
if(equal(sound, oldknife_sounds[i]) && zp_get_user_berserker(id))
{
// Emit New sound and Stop old Sound
emit_sound(id, channel, Knife_Sound[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}