Advertisement
supertimor

Untitled

Feb 14th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdkhooks>
  3. #include <sdktools>
  4.  
  5. new String:nazwy_broni[][] =
  6. {
  7. "weapon_none", // 0
  8. "weapon_negev", // 1
  9. "weapon_m249", // 2
  10. "weapon_awp", // 3
  11. "weapon_scar20", // 4
  12. "weapon_g3sg1", // 5
  13. "weapon_aug", // 6
  14. "weapon_sg556", // 7
  15. "weapon_m4a1_silencer", // 8
  16. "weapon_m4a1", // 9
  17. "weapon_ak47", // 10
  18. "weapon_ssg08", // 11
  19. "weapon_famas", // 12
  20. "weapon_galilar", // 13
  21. "weapon_bizon", // 14
  22. "weapon_p90", // 15
  23. "weapon_ump45", // 16
  24. "weapon_mp9", // 17
  25. "weapon_mp7", // 18
  26. "weapon_mac10", // 19
  27. "weapon_sawedoff", // 20
  28. "weapon_mag7", // 21
  29. "weapon_xm1014", // 22
  30. "weapon_nova", // 23
  31. "weapon_fiveseven", // 24
  32. "weapon_elite", // 25
  33. "weapon_revolver", // 26
  34. "weapon_deagle", // 27
  35. "weapon_cz75a", // 28
  36. "weapon_tec9", // 29
  37. "weapon_p250", // 30
  38. "weapon_hkp2000", // 31
  39. "weapon_usp_silencer", // 32
  40. "weapon_glock", // 33
  41. "weapon_knife", // 34
  42. "weapon_taser", // 35
  43. "weapon_decoy", // 36
  44. "weapon_hegrenade", // 37
  45. "weapon_incgrenade", // 38
  46. "weapon_molotov", // 39
  47. "weapon_flashbang", // 40
  48. "weapon_smokegrenade", // 41
  49. "weapon_c4" // 42
  50. };
  51. new naboje_broni[][] =
  52. {
  53. {0, 0}, // 0
  54. {150, 200}, // 1
  55. {100, 200}, // 2
  56. {10, 30}, // 3
  57. {20, 90}, // 4
  58. {20, 90}, // 5
  59. {30, 90}, // 6
  60. {30, 90}, // 7
  61. {20, 40}, // 8
  62. {30, 90}, // 9
  63. {30, 90}, // 10
  64. {10, 90}, // 11
  65. {25, 90}, // 12
  66. {35, 90}, // 13
  67. {64, 120}, // 14
  68. {50, 100}, // 15
  69. {25, 100}, // 16
  70. {30, 120}, // 17
  71. {30, 120}, // 18
  72. {30, 100}, // 19
  73. {7, 32}, // 20
  74. {5, 32}, // 21
  75. {7, 32}, // 22
  76. {8, 32}, // 23
  77. {20, 100}, // 24
  78. {30, 120}, // 25
  79. {8, 8}, // 26
  80. {7, 35}, // 27
  81. {12, 12}, // 28
  82. {32, 120}, // 29
  83. {13, 26}, // 30
  84. {13, 52}, // 31
  85. {12, 24}, // 32
  86. {20, 120}, // 33
  87. {0, 0}, // 34
  88. {-1, 1}, // 35
  89. {-1, 1}, // 36
  90. {-1, 1}, // 37
  91. {-1, 1}, // 38
  92. {-1, 1}, // 39
  93. {-1, 2}, // 40
  94. {-1, 1}, // 41
  95. {-1, 1} // 42
  96. };
  97.  
  98. public Plugin:myinfo =
  99. {
  100. name = "nazwa",
  101. author = "Linux`",
  102. description = "Cod Item",
  103. version = "1.0",
  104. url = "http://steamcommunity.com/id/linux2006"
  105. };
  106. public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapons)
  107. {
  108. if(!IsPlayerAlive(client))
  109. return Plugin_Continue;
  110.  
  111. new active_weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  112. if(active_weapon != -1)
  113. {
  114. new naboje = GetEntData(active_weapon, FindSendPropInfo("CWeaponCSBase", "m_iClip1"));
  115. if((!naboje || buttons & IN_RELOAD) && !(buttons & IN_ATTACK))
  116. {
  117. new String:weapon[32];
  118. GetClientWeapon(client, weapon, sizeof(weapon));
  119. new weaponid = GetUserWeaponId(weapon);
  120. if(weaponid && naboje < naboje_broni[weaponid][0] && naboje_broni[weaponid][1])
  121. {
  122. new amunicja = GetEntProp(active_weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
  123. if(amunicja)
  124. {
  125. SetEntData(active_weapon, FindSendPropInfo("CWeaponCSBase", "m_iClip1"), (naboje+amunicja < naboje_broni[weaponid][0])? naboje+amunicja: naboje_broni[weaponid][0]);
  126. SetEntProp(active_weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", (amunicja-(naboje_broni[weaponid][0]-naboje) < 1)? 0: amunicja-(naboje_broni[weaponid][0]-naboje));
  127. }
  128. }
  129. }
  130. }
  131.  
  132. return Plugin_Continue;
  133. }
  134. public GetUserWeaponId(String:weapon[])
  135. {
  136. for(new i = 1; i < sizeof(nazwy_broni); i ++)
  137. {
  138. if(StrEqual(weapon, nazwy_broni[i]))
  139. return i;
  140. }
  141.  
  142. return -1;
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement