Пользователь
- Сообщения
- 76
- Реакции
- 3
- Помог
- 1 раз(а)
Подскажите как сделать
Код:
public Ham_KnifeSecondaryAttack_Post(iEntity)
{
new id = get_pdata_cbase(iEntity, , linux_diff_weapon);
if(g_has_strong[id]) set_pdata_float(id, m_flNextAttack, 1.0);
return;
}
Код:
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "[ZP] Addon: Knifes"
#define VERSION "NEW"
#define AUTHOR "Mr.TheFold"
#define m_flNextAttack 83
new KNIFE1_V_MODEL[] = "models/STIL_KNIFE/v_hand.mdl"
new KNIFE1_P_MODEL[] = "models/STIL_KNIFE/p_hand.mdl"
new bool:g_has_strong[33]
new const strong_sounds[][] =
{
"STIL_KNIFE/hand_deploy.wav",
"STIL_KNIFE/hand_hit.wav",
"STIL_KNIFE/hand_hit.wav",
"STIL_KNIFE/hand_hit.wav",
"STIL_KNIFE/hand_slash.wav",
"STIL_KNIFE/strong_stab.wav"
}
public plugin_init()
{
register_plugin(PLUGIN , VERSION , AUTHOR);
register_event("CurWeapon","checkWeapon","be","1=1");
register_forward(FM_EmitSound, "CEntity__EmitSound");
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "Ham_KnifeSecondaryAttack_Post", true);
}
public client_connect(id)
{
g_has_strong[id] = true
}
public client_disconnected(id)
{
g_has_strong[id] = false
}
public plugin_precache()
{
precache_model(KNIFE1_V_MODEL)
precache_model(KNIFE1_P_MODEL)
for(new i = 0; i < sizeof strong_sounds; i++)
precache_sound(strong_sounds[i])
}
public Ham_KnifeSecondaryAttack_Post(iEntity)
{
new id = get_pdata_cbase(iEntity, , linux_diff_weapon);
if(g_has_strong[id]) set_pdata_float(id, m_flNextAttack, 1.0);
return;
}
public checkWeapon(id)
{
if(get_user_weapon(id) != CSW_KNIFE)
return;
if(g_has_strong[id])
{
set_pev(id, pev_viewmodel2, KNIFE1_V_MODEL)
set_pev(id, pev_weaponmodel2, KNIFE1_P_MODEL)
set_pdata_float(id, m_flNextAttack, 0.5);
}
return;
}
public CEntity__EmitSound(id, channel, const sample[], Float:volume, Float:attn, flags, pitch)
{
if (!is_user_connected(id))
return HAM_IGNORED
if (sample[8] == 'k' && sample[9] == 'n' && sample[10] == 'i')
{
if (sample[14] == 'd')
{
if(g_has_strong[id])
emit_sound(id, channel, strong_sounds[0], volume, attn, flags, pitch)
}
else if (sample[14] == 'h')
{
if (sample[17] == 'w')
{
if(g_has_strong[id])
emit_sound(id, channel, strong_sounds[3], volume, attn, flags, pitch)
}
else
{
if(g_has_strong[id])
emit_sound(id, channel, strong_sounds[random_num(1,2)], volume, attn, flags, pitch)
}
}
else
{
if (sample[15] == 'l')
{
if(g_has_strong[id])
emit_sound(id, channel, strong_sounds[4], volume, attn, flags, pitch)
}
else
{
if(g_has_strong[id])
emit_sound(id, channel, strong_sounds[5], volume, attn, flags, pitch)
}
}
return HAM_SUPERCEDE
}
return HAM_IGNORED
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!team", "^3")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}