MegastoRM

m4+usp ironsight

Nov 12th, 2012
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < cstrike >
  3. #include < fakemeta >
  4. #include < hamsandwich >
  5. #include < engine >
  6.  
  7. new const ZOOMM4[] = "models/champion_cod/v_zoom.mdl"
  8. new const V_MODELM4[] = "models/v_m4a1.mdl"
  9. new const ZOOMUSP[] = "models/champion_cod/v_zoom.mdl"
  10. new const V_MODELUSP[] = "models/v_usp.mdl"
  11.  
  12. const EXTRAOFFSET_WEAPONS = 4
  13. const m_flNextPrimaryAttack = 46
  14.  
  15. new bool:Zoom[33]
  16.  
  17. public plugin_init( )
  18. {
  19. register_plugin("M4A1+USP Ironsight","1.0","MegastorM")
  20.  
  21. RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_m4a1", "fw_M4A1SecondaryAttack", 1)
  22. RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_usp", "fw_uspSecondaryAttack", 1)
  23. }
  24.  
  25. public plugin_precache()
  26. {
  27. precache_model(ZOOMM4)
  28. precache_model(V_MODELM4)
  29. precache_model(ZOOMUSP)
  30. precache_model(V_MODELUSP)
  31. }
  32.  
  33. public fw_M4A1SecondaryAttack(iEnt)
  34. {
  35. if (!is_valid_ent(iEnt)) return
  36. new owner = pev(iEnt, pev_owner)
  37. set_pdata_float(iEnt, m_flNextPrimaryAttack, 0.0, EXTRAOFFSET_WEAPONS)
  38.  
  39. if(Zoom[ owner ])
  40. {
  41. set_pev(owner, pev_viewmodel2, V_MODELM4)
  42. Zoom[ owner ] = false
  43. set_pdata_int(owner, 363, 90, 5);
  44. }
  45. else
  46. {
  47. set_pev(owner, pev_viewmodel2, ZOOMM4)
  48. Zoom[ owner ] = true
  49. set_pdata_int(owner, 363, 55, 5);
  50. }
  51.  
  52. }
  53.  
  54. public fw_uspSecondaryAttack(iEnt)
  55. {
  56. if (!is_valid_ent(iEnt)) return
  57. new owner = pev(iEnt, pev_owner)
  58. set_pdata_float(iEnt, m_flNextPrimaryAttack, 0.0, EXTRAOFFSET_WEAPONS)
  59.  
  60. if(Zoom[ owner ])
  61. {
  62. set_pev(owner, pev_viewmodel2, V_MODELUSP)
  63. Zoom[ owner ] = false
  64. set_pdata_int(owner, 363, 90, 5);
  65. }
  66. else
  67. {
  68. set_pev(owner, pev_viewmodel2, ZOOMUSP)
  69. Zoom[ owner ] = true
  70. set_pdata_int(owner, 363, 55, 5);
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment