HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fun>
  4. #include <zombieplague>
  5.  
  6. #define PLUGIN "[ZP] Armor Free"
  7. #define VERSION "0.2"
  8. #define AUTHOR "tii"
  9.  
  10. //pcvar
  11. new armor_value
  12.  
  13. public plugin_init()
  14. {
  15. register_plugin(PLUGIN, VERSION, AUTHOR)
  16. register_event("ResetHUD", "playerSpawn", "be")
  17. armor_value = register_cvar("zp_armor", "50") //Lehet valtoztatni
  18.  
  19. }
  20.  
  21. public playerSpawn(id)
  22. {
  23. set_task(2.0, "shield", id)
  24. }
  25.  
  26. public shield(id)
  27. {
  28. if(is_user_alive(id) && !zp_get_user_zombie(id))
  29. set_user_armor(id,get_pcvar_num(armor_value))
  30. zp_colored_print(id, "^x04[ZP]^x01 Armor-t kapta'l!")
  31. }
  32.  
  33. // Colored Print (zp_colored_print)
  34. stock zp_colored_print(target, const message[], any:...)
  35. {
  36. static g_msgSayText, maxplayers;
  37. if ( !g_msgSayText )
  38. g_msgSayText = get_user_msgid("SayText")
  39.  
  40. if ( !maxplayers )
  41. maxplayers = get_maxplayers();
  42.  
  43. static buffer[512], i, argscount;
  44. argscount = numargs();
  45.  
  46. // Send to everyone
  47. if (!target)
  48. {
  49. static player;
  50. for (player = 1; player <= maxplayers; player++)
  51. {
  52. // Not connected
  53. if (!is_user_connected(player))
  54. continue;
  55.  
  56. // Remember changed arguments
  57. static changed[5], changedcount; // [5] = max LANG_PLAYER occurencies
  58. changedcount = 0;
  59.  
  60. // Replace LANG_PLAYER with player id
  61. for (i = 2; i < argscount; i++)
  62. {
  63. if (getarg(i) == LANG_PLAYER)
  64. {
  65. setarg(i, 0, player);
  66. changed[changedcount] = i;
  67. changedcount++;
  68. }
  69. }
  70.  
  71. // Format message for player
  72. vformat(buffer, sizeof buffer - 1, message, 3);
  73.  
  74. // Send it
  75. message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, player);
  76. write_byte(player);
  77. write_string(buffer);
  78. message_end();
  79.  
  80. // Replace back player id's with LANG_PLAYER
  81. for (i = 0; i < changedcount; i++)
  82. setarg(changed[i], 0, LANG_PLAYER);
  83. }
  84. }
  85.  
  86. // Send to specific target
  87. else
  88. {
  89. // Format message for player
  90. vformat(buffer, sizeof buffer - 1, message, 3);
  91.  
  92. // Send it
  93. message_begin(MSG_ONE, g_msgSayText, _, target);
  94. write_byte(target);
  95. write_string(buffer);
  96. message_end();
  97. }
  98. }