HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4. #include <zombieplague>
  5. #include <dhudmessage>
  6.  
  7. new ammo[3][33],string[21],cvarShowType,ammopacks
  8.  
  9. public plugin_init() {
  10. register_plugin("[ZP] AmmoChange", "1.0", "ZETA [M|E|N]")
  11. register_logevent("round_start", 2, "1=Round_Start")
  12. cvarShowType = register_cvar("ac_show_type", "1")
  13.  
  14. register_clcmd("say /change","func_change",ADMIN_ALL,"")
  15. }
  16.  
  17. public round_start() {
  18. new players[32],num,i
  19. get_players(players,num)
  20.  
  21. for(i=1;i<num;i++) {
  22. ammo[0][players[i]] = zp_get_user_ammo_packs(players[i])
  23. }
  24. }
  25.  
  26. public client_putinserver(id) {
  27. set_task(3.0,"func_ammo",id)
  28. }
  29.  
  30. public func_ammo(id) {
  31. ammopacks = zp_get_user_ammo_packs(id)
  32.  
  33. ammo[0][id] = ammopacks
  34. ammo[1][id] = ammopacks
  35. ammo[2][id] = ammopacks
  36.  
  37. set_task(1.0,"change_ammo",id,_,_,"b")
  38. }
  39.  
  40. public change_ammo(id) {
  41. if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
  42. return PLUGIN_HANDLED
  43.  
  44. ammo[1][id] = zp_get_user_ammo_packs(id)
  45.  
  46. if(ammo[1][id] != ammo[2][id]) {
  47. if(ammo[1][id] > ammo[2][id]) {
  48. ammopacks = ammo[1][id] - ammo[2][id]
  49. format(string,charsmax(string),"[ +%d Lőszer Csomag ]", ammopacks)
  50. }
  51. else {
  52. ammopacks = ammo[2][id] - ammo[1][id]
  53. format(string,charsmax(string),"[ -%d Lőszer Csomag ]", ammopacks)
  54. }
  55.  
  56. ammo[2][id] = ammo[1][id]
  57.  
  58. if(get_pcvar_num(cvarShowType)) {
  59. set_dhudmessage(255, 255, 255, -1.0, 0.37, 0, 0.1, 2.0,_,_,3)
  60. show_dhudmessage(id, "%s", string)
  61. }
  62. else
  63. client_print(id, print_center, "%s", string)
  64. }
  65.  
  66. return PLUGIN_HANDLED
  67. }
  68.  
  69. public client_disconnect(id) {
  70. ammo[0][id] = 0
  71. ammo[1][id] = 0
  72. ammo[2][id] = 0
  73.  
  74. remove_task(id)
  75. }
  76.  
  77. public func_change(id) {
  78. if(ammo[0][id] != ammo[2][id]) {
  79. if(ammo[0][id] > ammo[2][id]) {
  80. ammopacks = ammo[0][id] - ammo[2][id]
  81. client_print(id,print_chat,"", ammopacks)
  82. }
  83. else {
  84. ammopacks = ammo[2][id] - ammo[0][id]
  85. client_print(id,print_chat,"", ammopacks)
  86. }
  87. }
  88. else
  89. client_print(id,print_chat,"")
  90. return PLUGIN_HANDLED
  91. }
  92.