|
发表于 2022-7-14 19:06:37
|
显示全部楼层
来自 美国
- #include <amxmodx>
- #include <amxmisc>
- #include <fakemeta>
- #include <hamsandwich>
- #include <xs>
- #define PLUGIN_NAME "Weapon Recoil Set"
- #define PLUGIN_VERSION "1.0"
- #define PLUGIN_AUTHOR "Jim"
- #define Access "m" //权限代码
- const m_weapId = 43
- const OFFSET_LINUX_WEAPONS = 4
- new const weapon_classname[][] = { "", "weapon_p228", "", "weapon_scout", "", "weapon_xm1014", "", "weapon_mac10",
- "weapon_aug", "", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas",
- "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1",
- "weapon_tmp", "weapon_g3sg1", "", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_p90" }
- // Recoil set (正常後座力=1.0 , 後座力減半=0.5 , 無後座力=0.0 , 無設定=-1.0)
- new const weapon_recoil[][] = { "", "0.5", "", "0.5", "", "0.5", "", "0.5",
- "0.5", "", "0.5", "0.5", "0.5", "0.5", "0.5", "0.5",
- "0.5", "0.5", "0.5", "0.5", "0.5", "0.5", "0.5",
- "0.5", "0.5", "", "0.5", "0.5", "0.5", "0.5" }
- new g_weap_recoil[sizeof weapon_classname]
- public plugin_init()
- {
- register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
- new cvar_string[32]
- for (new i = 0; i < sizeof weapon_classname; i++)
- {
- if (strlen(weapon_classname[i]) == 0)
- continue;
- formatex(cvar_string, charsmax(cvar_string), "weap_%s_recoil", weapon_classname[i][7])
- g_weap_recoil[i] = register_cvar(cvar_string, weapon_recoil[i])
- RegisterHam(Ham_Weapon_PrimaryAttack, weapon_classname[i], "fw_WeapPriAttack", 1)
- }
- }
- public fw_WeapPriAttack(weapon)
- {
- static owner
- owner = pev(weapon, pev_owner)
- static weap_id
- weap_id = fm_get_weaponid(weapon)
- static Float:multiplier
- multiplier = get_pcvar_float(g_weap_recoil[weap_id])
- if(has_all_flags(owner,Access)== 0)
- return HAM_IGNORED;
- if (multiplier < 0.0)
- return HAM_IGNORED;
- new Float:punchangle[3]
- pev(owner, pev_punchangle, punchangle)
- xs_vec_mul_scalar(punchangle, multiplier, punchangle)
- set_pev(owner, pev_punchangle, punchangle)
- return HAM_IGNORED;
- }
- stock fm_get_weaponid(entity)
- {
- return get_pdata_int(entity, m_weapId, OFFSET_LINUX_WEAPONS);
- }
复制代码
欢迎加群:923526724 |
|