HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*************************************************************************************************************
  2.   AMX No Team Flash
  3.  
  4.   Version: 0.2
  5.   Author: KRoT@L
  6.  
  7.   0.1 Release
  8.   0.2 Bug fix
  9.  
  10.  
  11.   You won't be flashed by your teammates.
  12.  
  13.  
  14.   Cvar:
  15.  
  16. no_team_flash "1" - 0: Disables the plugin
  17.   1: Enables the plugin
  18.  
  19.  
  20.   Setup (AMX 0.9.9):
  21.  
  22. Install the amx file.
  23.   Enabled VexdUM (both in metamod/plugins.ini and amx/config/modules.ini)
  24.  
  25.  
  26.   Credits:
  27.  
  28.   Requested by baldbobby
  29.   Cluster Grenade by doomy
  30.  
  31. *************************************************************************************************************/
  32.  
  33. #include <amxmodx>
  34.  
  35. new g_msgScreenFade, grenade[32], last
  36. new Float:g_gametime, g_owner
  37.  
  38. public plugin_init()
  39. {
  40. register_plugin("No Team Flash", "0.2", "KRoTaL")
  41. register_cvar("no_team_flash", "1")
  42. register_event("ScreenFade", "eventFlash", "be", "4=255", "5=255", "6=255", "7>199")
  43. register_event("TextMsg", "fire_in_the_hole", "b", "2&#Game_radio", "4&#Fire_in_the_hole")
  44. register_event("TextMsg", "fire_in_the_hole2", "b", "3&#Game_radio", "5&#Fire_in_the_hole")
  45. register_event("99", "grenade_throw", "b")
  46. g_msgScreenFade = get_user_msgid("ScreenFade")
  47. }
  48.  
  49. public eventFlash(id)
  50. {
  51. new Float:gametime = get_gametime()
  52. if(gametime != g_gametime)
  53. {
  54. g_owner = get_grenade_owner()
  55. g_gametime = gametime
  56. }
  57. if(is_user_connected(g_owner) && g_owner != id && get_user_team(id) == get_user_team(g_owner))
  58. {
  59. message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, id)
  60. write_short(1)
  61. write_short(1)
  62. write_short(1)
  63. write_byte(0)
  64. write_byte(0)
  65. write_byte(0)
  66. write_byte(255)
  67. message_end()
  68. }
  69. }
  70.  
  71. public grenade_throw()
  72. {
  73. if(read_datanum() < 2)
  74. return PLUGIN_HANDLED_MAIN
  75.  
  76. if(read_data(1) == 11 && (read_data(2) == 0 || read_data(2) == 1))
  77. {
  78. add_grenade_owner(last)
  79. }
  80.  
  81. return PLUGIN_CONTINUE
  82. }
  83.  
  84. public fire_in_the_hole()
  85. {
  86. new name[32]
  87. read_data(3, name, 31)
  88. last = get_user_index(name)
  89.  
  90. return PLUGIN_CONTINUE
  91. }
  92.  
  93. public fire_in_the_hole2()
  94. {
  95. new name[32]
  96. read_data(4, name, 31)
  97. last = get_user_index(name)
  98.  
  99. return PLUGIN_CONTINUE
  100. }
  101.  
  102. add_grenade_owner(owner)
  103. {
  104. for(new i = 0; i < 32; i++)
  105. {
  106. if(grenade[i] == 0)
  107. {
  108. grenade[i] = owner
  109. return
  110. }
  111. }
  112. }
  113.  
  114. get_grenade_owner()
  115. {
  116. new which = grenade[0]
  117. for(new i = 1; i < 32; i++)
  118. {
  119. grenade[i-1] = grenade[i]
  120. }
  121. grenade[31] = 0
  122. return which
  123. }
  124.