Участник
Пользователь
- Сообщения
- 2,143
- Реакции
- 1,225
- Помог
- 44 раз(а)
О какой второй идет речь? Я что-то упустил?обе кнопки зажать
О какой второй идет речь? Я что-то упустил?обе кнопки зажать
При зажатой кнопке все равно выставляет другое состояние глушителя.Проверил, работает отличноКод:public HookSecondaryAttack(weapon) { set_member(weapon, m_Weapon_flNextSecondaryAttack, 999.0); return HAM_SUPERCEDE; }
Хук на pre, естественно
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "Block Silence"
#define VERSION "0.0.8"
#define AUTHOR "Minni Mouse"
new g_iCmdStart;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
unregister_forward(FM_CmdStart, g_iCmdStart, false);
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_m4a1", "Ham_SecondaryAttack_Pre", false);
}
public Ham_SecondaryAttack_Pre(weapon) {
g_iCmdStart = register_forward(FM_CmdStart, "FM_CmdStart_Pre", false);
return HAM_SUPERCEDE;
}
public FM_CmdStart_Pre(id, ucHandle) {
static button;
button = get_uc(ucHandle, UC_Buttons);
if(button & IN_ATTACK2 && get_user_weapon(id) == CSW_M4A1) set_uc(ucHandle, UC_Buttons, button &= ~IN_ATTACK2);
return FMRES_IGNORED;
}
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "Block Silencer"
#define VERSION "1.0"
#define AUTHOR "In-line & dev-cs guys"
// https://github.com/s1lentq/ReGameDLL_CS/blob/7f9cf53c4906343514e9560e0e536a517c195444/regamedll/dlls/weapons.h#L1255-L1271
enum M4A1
{
M4A1_IDLE,
M4A1_SHOOT1,
M4A1_SHOOT2,
M4A1_SHOOT3,
M4A1_RELOAD,
M4A1_DRAW,
M4A1_ATTACH_SILENCER,
M4A1_UNSIL_IDLE,
M4A1_UNSIL_SHOOT1,
M4A1_UNSIL_SHOOT2,
M4A1_UNSIL_SHOOT3,
M4A1_UNSIL_RELOAD,
M4A1_UNSIL_DRAW,
M4A1_DETACH_SILENCER,
};
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_forward(FM_CmdStart, "FM_CmdStart_Pre", false);
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_m4a1", "Ham_SecondaryAttack_Pre", false);
}
public Ham_SecondaryAttack_Pre(weapon) {
return HAM_SUPERCEDE;
}
public FM_CmdStart_Pre(id, ucHandle) {
new button = get_uc(ucHandle, UC_Buttons);
if((button & IN_ATTACK2) && get_user_weapon(id) == CSW_M4A1) {
set_uc(ucHandle, UC_Buttons, button & ~(IN_ATTACK2 | IN_ATTACK));
new weapon = get_ent_data_entity(id, "CBasePlayer", "m_pActiveItem");
message_begin(MSG_ONE, SVC_WEAPONANIM, .player = id);
write_byte(M4A1_UNSIL_IDLE);
write_byte(pev(weapon, pev_body));
message_end();
}
return FMRES_IGNORED;
}