Approved No Recoil (1 round)

Zombies/Humans Extra-Items
Post Reply
User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 279
Joined: 9 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 21 times
Age: 33
Contact:

No Recoil (1 round)

#1

Post by Mark » 9 Months Ago

No - Recoil 1 Round


Description:
  • A new extra-item for Humans, No Recoil (1 round)



  1. #include <zombie_escape>
  2. #include <xs>
  3.  
  4. new g_norecoil[33]
  5. new Float: cl_pushangle[33][3]
  6. new g_itemid_norecoil, g_maxplayers
  7.  
  8. const WEAPONS_BITSUM = (1<<CSW_KNIFE|1<<CSW_HEGRENADE|1<<CSW_FLASHBANG|1<<CSW_SMOKEGRENADE|1<<CSW_C4)
  9.  
  10. public plugin_init()
  11. {
  12.     register_plugin("[ZE] Extra Item: No Recoil", "1.0", "Mark")
  13.  
  14.     g_itemid_norecoil = ze_register_item("No Recoil (Single Round)", 50, 0)
  15.  
  16.     new weapon_name[24]
  17.     for (new i = 1; i <= 30; i++)
  18.     {
  19.         if (!(WEAPONS_BITSUM & 1 << i) && get_weaponname(i, weapon_name, 23))
  20.         {
  21.             RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Pre")
  22.             RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Post", 1)
  23.         }
  24.     }
  25.  
  26.     register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  27.  
  28.     g_maxplayers = get_maxplayers()
  29. }
  30.  
  31. public ze_select_item_pre(id, itemid)
  32. {
  33.     if (itemid != g_itemid_norecoil)
  34.         return ZE_ITEM_AVAILABLE
  35.    
  36.     if (ze_is_user_zombie(id))
  37.         return ZE_ITEM_DONT_SHOW
  38.        
  39.     return ZE_ITEM_AVAILABLE
  40. }
  41.  
  42. public ze_select_item_post(id, itemid)
  43. {
  44.     if (itemid != g_itemid_norecoil)
  45.         return
  46.  
  47.     ze_colored_print(id, "Congrats! You have bought No Recoil! :D")
  48.    
  49.     Get_NoRecoil(id)
  50. }
  51.  
  52. public Get_NoRecoil(id)
  53. {
  54.     g_norecoil[id] = true
  55. }
  56.  
  57. public ze_user_humanized(id)
  58. {
  59.     g_norecoil[id] = false
  60. }
  61.  
  62. public ze_user_infected(iVictim)
  63. {
  64.     g_norecoil[iVictim] = false
  65. }
  66.  
  67.  
  68. public client_connect(id)
  69. {
  70.     g_norecoil[id] = false
  71. }
  72.  
  73. public event_round_start()
  74. {
  75.     for (new id = 1; id <= g_maxplayers; id++)
  76.         g_norecoil[id] = false
  77. }
  78.  
  79. public fw_Weapon_PrimaryAttack_Pre(entity)
  80. {
  81.     new id = pev(entity, pev_owner)
  82.  
  83.     if (g_norecoil[id])
  84.     {
  85.         pev(id, pev_punchangle, cl_pushangle[id])
  86.         return HAM_IGNORED;
  87.     }
  88.     return HAM_IGNORED;
  89. }
  90.  
  91. public fw_Weapon_PrimaryAttack_Post(entity)
  92. {
  93.     new id = pev(entity, pev_owner)
  94.  
  95.     if (g_norecoil[id])
  96.     {
  97.         new Float: push[3]
  98.         pev(id, pev_punchangle, push)
  99.         xs_vec_sub(push, cl_pushangle[id], push)
  100.         xs_vec_mul_scalar(push, 0.0, push)
  101.         xs_vec_add(push, cl_pushangle[id], push)
  102.         set_pev(id, pev_punchangle, push)
  103.         return HAM_IGNORED;
  104.     }
  105.     return HAM_IGNORED;
  106. }
  107.  
These users thanked the author Mark for the post (total 4):
Raheem (9 Months Ago) • Luxurious (9 Months Ago) • shady101852 (8 Months Ago) • Muhammet20 (2 Months Ago)

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1793
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 89 times
Age: 21
Contact:

#2

Post by Raheem » 9 Months Ago

Nice one, +LIKE. Thanks.
You don't know? Learn and you will know.

User avatar
Muhammet20
Senior Member
Senior Member
Turkey
Posts: 115
Joined: 9 Months Ago
Has thanked: 14 times
Been thanked: 1 time
Contact:

#3

Post by Muhammet20 » 2 Months Ago

+LIKE
Nice Bro
Don't Say This Is Impossible , Because Nothing Impossible.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests