Advertisement
Guest User

No Recoil

a guest
Jul 4th, 2015
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>
  4. #include <zombieplague>
  5. #include <zmvip>
  6. #include <xs>
  7.  
  8. new g_norecoil[33]
  9. new Float: cl_pushangle[33][3]
  10. new g_itemid_norecoil, g_maxplayers
  11.  
  12. const WEAPONS_BITSUM = (1<<CSW_KNIFE|1<<CSW_HEGRENADE|1<<CSW_FLASHBANG|1<<CSW_SMOKEGRENADE|1<<CSW_C4)
  13.  
  14. public plugin_init()
  15. {
  16. register_plugin("[ZP] Extra Item: No Recoil", "0.1.0", "CarsonMotion")
  17.  
  18. g_itemid_norecoil = zv_register_extra_item("No Recoil (Single Round)", 20, ZP_TEAM_HUMAN)
  19.  
  20. new weapon_name[24]
  21. for (new i = 1; i <= 30; i++)
  22. {
  23. if (!(WEAPONS_BITSUM & 1 << i) && get_weaponname(i, weapon_name, 23))
  24. {
  25. RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Pre")
  26. RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Post", 1)
  27. }
  28. }
  29.  
  30. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  31.  
  32. g_maxplayers = get_maxplayers()
  33. }
  34.  
  35. public zv_extra_item_selected(player, itemid)
  36. {
  37. if (itemid == g_itemid_norecoil)
  38. {
  39. g_norecoil[player] = true
  40. client_print(player, print_chat, "[ZP] You have bought No Recoil for your weapon!")
  41. }
  42. }
  43.  
  44. public zp_user_infected_post(id)
  45. g_norecoil[id] = false
  46.  
  47. public client_connect(id)
  48. g_norecoil[id] = false
  49.  
  50. public event_round_start()
  51. for (new id = 1; id <= g_maxplayers; id++)
  52. g_norecoil[id] = false
  53.  
  54. public fw_Weapon_PrimaryAttack_Pre(entity)
  55. {
  56. new id = pev(entity, pev_owner)
  57.  
  58. if (g_norecoil[id])
  59. {
  60. pev(id, pev_punchangle, cl_pushangle[id])
  61. return HAM_IGNORED;
  62. }
  63. return HAM_IGNORED;
  64. }
  65.  
  66. public fw_Weapon_PrimaryAttack_Post(entity)
  67. {
  68. new id = pev(entity, pev_owner)
  69.  
  70. if (g_norecoil[id])
  71. {
  72. new Float: push[3]
  73. pev(id, pev_punchangle, push)
  74. xs_vec_sub(push, cl_pushangle[id], push)
  75. xs_vec_mul_scalar(push, 0.0, push)
  76. xs_vec_add(push, cl_pushangle[id], push)
  77. set_pev(id, pev_punchangle, push)
  78. return HAM_IGNORED;
  79. }
  80. return HAM_IGNORED;
  81. }
  82. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  83. *{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1033{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
  84. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement