Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < amxmodx >
- #include < cstrike >
- #include < fakemeta >
- #include < hamsandwich >
- #include < engine >
- new const ZOOMM4[] = "models/champion_cod/v_zoom.mdl"
- new const V_MODELM4[] = "models/v_m4a1.mdl"
- new const ZOOMUSP[] = "models/champion_cod/v_zoom.mdl"
- new const V_MODELUSP[] = "models/v_usp.mdl"
- const EXTRAOFFSET_WEAPONS = 4
- const m_flNextPrimaryAttack = 46
- new bool:Zoom[33]
- public plugin_init( )
- {
- register_plugin("M4A1+USP Ironsight","1.0","MegastorM")
- RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_m4a1", "fw_M4A1SecondaryAttack", 1)
- RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_usp", "fw_uspSecondaryAttack", 1)
- }
- public plugin_precache()
- {
- precache_model(ZOOMM4)
- precache_model(V_MODELM4)
- precache_model(ZOOMUSP)
- precache_model(V_MODELUSP)
- }
- public fw_M4A1SecondaryAttack(iEnt)
- {
- if (!is_valid_ent(iEnt)) return
- new owner = pev(iEnt, pev_owner)
- set_pdata_float(iEnt, m_flNextPrimaryAttack, 0.0, EXTRAOFFSET_WEAPONS)
- if(Zoom[ owner ])
- {
- set_pev(owner, pev_viewmodel2, V_MODELM4)
- Zoom[ owner ] = false
- set_pdata_int(owner, 363, 90, 5);
- }
- else
- {
- set_pev(owner, pev_viewmodel2, ZOOMM4)
- Zoom[ owner ] = true
- set_pdata_int(owner, 363, 55, 5);
- }
- }
- public fw_uspSecondaryAttack(iEnt)
- {
- if (!is_valid_ent(iEnt)) return
- new owner = pev(iEnt, pev_owner)
- set_pdata_float(iEnt, m_flNextPrimaryAttack, 0.0, EXTRAOFFSET_WEAPONS)
- if(Zoom[ owner ])
- {
- set_pev(owner, pev_viewmodel2, V_MODELUSP)
- Zoom[ owner ] = false
- set_pdata_int(owner, 363, 90, 5);
- }
- else
- {
- set_pev(owner, pev_viewmodel2, ZOOMUSP)
- Zoom[ owner ] = true
- set_pdata_int(owner, 363, 55, 5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment