HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <engine>
  3.  
  4. new bool:reload[33] = false
  5. new specwho[33]
  6.  
  7. public plugin_init() {
  8. register_plugin("Reloadbar","1.00","NL)Ramon(NL")
  9. register_cvar("amx_reloadbar","1")
  10. register_event("CurWeapon", "stopreload", "be")
  11. register_event("StatusValue", "show_status", "bd", "1=2")
  12. register_event("ResetHUD", "notspecing", "b")
  13. }
  14.  
  15. public notspecing(id) specwho[id] = 0
  16.  
  17. public stopreload(id){
  18. message_begin(MSG_ONE_UNRELIABLE,108,{0,0,0},id)
  19. write_short(0)
  20. message_end()
  21. reload[id] = false
  22. showspecreload(id,0)
  23. }
  24.  
  25. public client_PreThink(id){
  26. if(get_cvar_num("amx_reloadbar") == 0) return PLUGIN_CONTINUE
  27. if (!is_user_connected(id)) return PLUGIN_CONTINUE
  28. if(get_user_button(id) & IN_RELOAD && reload[id] == false)
  29. {
  30. msg(id)
  31. reload[id] = true
  32. }
  33. return PLUGIN_CONTINUE
  34. }
  35.  
  36.  
  37.  
  38. public show_status(id)
  39. {
  40. specwho[id] = read_data(2)
  41. }
  42.  
  43. public showspecreload(id,timetoshow){
  44. new players = get_maxplayers()
  45. new i
  46. for (i = 0 ; i < players ; i++)
  47. {
  48. if(specwho[i] == id)
  49. {
  50. message_begin(MSG_ONE,108,{0,0,0},id)
  51. write_short(timetoshow)
  52. message_end()
  53. }
  54. }
  55. }
  56.  
  57. public canreload(id) reload[id] = false
  58.  
  59. public msg(id){
  60. new ammo
  61. new clip
  62. new weapon = get_user_weapon(id,clip,ammo)
  63. message_begin(MSG_ONE,108,{0,0,0},id)
  64. if(ammo != 0){
  65. switch(weapon){
  66. case 1:
  67. {
  68. if(clip != 13)
  69. {
  70. write_short(3)
  71. message_end()
  72. set_task(3.0,"canreload",id)
  73. showspecreload(id,3)
  74. return PLUGIN_HANDLED
  75. }
  76.  
  77. }
  78. case 3:
  79. {
  80. if(clip != 10)
  81. {
  82. write_short(2)
  83. message_end()
  84. set_task(2.0,"canreload",id)
  85. showspecreload(id,2)
  86. return PLUGIN_HANDLED
  87. }
  88. }
  89. case 7:
  90. {
  91. if(clip != 30)
  92. {
  93. write_short(3)
  94. message_end()
  95. set_task(3.0,"canreload",id)
  96. showspecreload(id,3)
  97. return PLUGIN_HANDLED
  98. }
  99. }
  100. case 8:
  101. {
  102. if(clip != 30)
  103. {
  104. write_short(3)
  105. message_end()
  106. set_task(3.0,"canreload",id)
  107. showspecreload(id,3)
  108. return PLUGIN_HANDLED
  109. }
  110. }
  111. case 10:
  112. {
  113. if(clip != 30)
  114. {
  115. write_short(5)
  116. message_end()
  117. set_task(5.0,"canreload",id)
  118. showspecreload(id,5)
  119. return PLUGIN_HANDLED
  120. }
  121. }
  122. case 11:
  123. {
  124. if(clip != 20)
  125. {
  126. write_short(3)
  127. message_end()
  128. set_task(3.0,"canreload",id)
  129. showspecreload(id,3)
  130. return PLUGIN_HANDLED
  131. }
  132. }
  133. case 12:
  134. {
  135. if(clip != 25)
  136. {
  137. write_short(4)
  138. message_end()
  139. set_task(4.0,"canreload",id)
  140. showspecreload(id,4)
  141. return PLUGIN_HANDLED
  142. }
  143. }
  144. case 13:
  145. {
  146. if(clip != 30)
  147. {
  148. write_short(3)
  149. message_end()
  150. set_task(3.0,"canreload",id)
  151. showspecreload(id,3)
  152. return PLUGIN_HANDLED
  153. }
  154. }
  155. case 14:
  156. {
  157. if(clip != 35)
  158. {
  159. write_short(3)
  160. message_end()
  161. set_task(3.0,"canreload",id)
  162. showspecreload(id,3)
  163. return PLUGIN_HANDLED
  164. }
  165. }
  166. case 15:
  167. {
  168. if(clip != 25)
  169. {
  170. write_short(3)
  171. message_end()
  172. set_task(3.0,"canreload",id)
  173. showspecreload(id,3)
  174. return PLUGIN_HANDLED
  175. }
  176. }
  177. case 16:
  178. {
  179. if(clip != 12)
  180. {
  181. write_short(3)
  182. message_end()
  183. set_task(3.0,"canreload",id)
  184. showspecreload(id,3)
  185. return PLUGIN_HANDLED
  186. }
  187. }
  188. case 17:
  189. {
  190. if(clip != 20)
  191. {
  192. write_short(2)
  193. message_end()
  194. set_task(2.0,"canreload",id)
  195. showspecreload(id,2)
  196. return PLUGIN_HANDLED
  197. }
  198. }
  199. case 18:
  200. {
  201. if(clip != 10)
  202. {
  203. write_short(2)
  204. message_end()
  205. set_task(2.0,"canreload",id)
  206. showspecreload(id,2)
  207. return PLUGIN_HANDLED
  208. }
  209. }
  210. case 19:
  211. {
  212. if(clip != 30)
  213. {
  214. write_short(3)
  215. message_end()
  216. set_task(3.0,"canreload",id)
  217. showspecreload(id,3)
  218. return PLUGIN_HANDLED
  219. }
  220. }
  221. case 20:
  222. {
  223. if(clip != 100)
  224. {
  225. write_short(5)
  226. message_end()
  227. set_task(5.0,"canreload",id)
  228. showspecreload(id,5)
  229. return PLUGIN_HANDLED
  230. }
  231. }
  232. case 22:
  233. {
  234. if(clip != 30)
  235. {
  236. write_short(3)
  237. message_end()
  238. set_task(3.0,"canreload",id)
  239. showspecreload(id,3)
  240. return PLUGIN_HANDLED
  241. }
  242. }
  243. case 23:
  244. {
  245. if(clip != 30)
  246. {
  247. write_short(2)
  248. message_end()
  249. set_task(2.0,"canreload",id)
  250. showspecreload(id,2)
  251. return PLUGIN_HANDLED
  252. }
  253. }
  254. case 24:
  255. {
  256. if(clip != 20)
  257. {
  258. write_short(4)
  259. message_end()
  260. set_task(4.0,"canreload",id)
  261. showspecreload(id,4)
  262. return PLUGIN_HANDLED
  263. }
  264. }
  265. case 26:
  266. {
  267. if(clip != 7)
  268. {
  269. write_short(2)
  270. message_end()
  271. set_task(2.0,"canreload",id)
  272. showspecreload(id,2)
  273. return PLUGIN_HANDLED
  274. }
  275. }
  276. case 27:
  277. {
  278. if(clip != 30)
  279. {
  280. write_short(3)
  281. message_end()
  282. set_task(3.0,"canreload",id)
  283. showspecreload(id,3)
  284. return PLUGIN_HANDLED
  285. }
  286. }
  287. case 28:
  288. {
  289. if(clip != 30)
  290. {
  291. write_short(2)
  292. message_end()
  293. set_task(2.0,"canreload",id)
  294. showspecreload(id,2)
  295. return PLUGIN_HANDLED
  296. }
  297. }
  298. case 30:
  299. {
  300. if(clip != 50)
  301. {
  302. write_short(3)
  303. message_end()
  304. set_task(3.0,"canreload",id)
  305. showspecreload(id,3)
  306. return PLUGIN_HANDLED
  307. }
  308. }
  309. }
  310. }
  311. write_short(0)
  312. message_end()
  313. reload[id] = false
  314. return PLUGIN_CONTINUE
  315. }