HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2.  
  3.  
  4. [ZP] Extra Item : Invisible
  5. ( For Humans and Zombies )
  6.  
  7. by Fry!
  8.  
  9.  
  10. Description :
  11.  
  12. Have You ever wanted that if there are so many zombies around You and then You can't escape from them?
  13. Now You can just buy this ability and You will be invisible until invisible will end or till Death.
  14. Same for zombies. If there are so many Humans around You and can't hide from them then now You can, just buy this ability.
  15.  
  16.  
  17. Cvars :
  18.  
  19. // Medium Invisible
  20. zp_medium_invisble_amount "30" - Amount of invisible
  21. zp_medium_invisible_cost "40" - How much this ability will cost to You
  22. zp_medium_invisible_long "25.0" - How long you will have invisibility
  23.  
  24. // Max Invisible
  25. zp_max_invisible_amount "5" - Amount of invisible
  26. zp_max_invisible_cost "60" - How much it will cost
  27. zp_max_invisible_long "15.0" - How long you will have invisibility
  28.  
  29.  
  30. Credits :
  31.  
  32. Antibots - For little helping
  33. Dores - For correcting me ^^
  34.  
  35.  
  36. Changelog :
  37.  
  38. 19/10/2008 - v1.0 - First release
  39. 19/10/2008 - v1.1 - fixed invisibility and removed unnecessary cvar.
  40. 19/10/2008 - v1.1.1 - changed to lower render that at least someone could notice invisible person.
  41. 19/10/2008 - v1.1.2 - changed plugin name
  42. 19/10/2008 - v1.2 - removed unnecessary code and fun module, added some new one and using fakemeta instead. (Thanks for Antibots)
  43. 19/10/2008 - v1.2.1 - changed render stuff
  44. 24/10/2008 - v1.3 - rewrited plugin, added some cvars and commands.
  45. 25/10/2008 - v1.3.1 - fixed small typo. (Thanks to Mlk27)
  46. 22/11/2008 - v1.3.2 - added cvar for invisible amount
  47. 04/12/2008 - v1.3.4 - fixed invisible was working all the time, added cvar for after how long time invisibility will end.
  48. 05/12/2008 - v1.3.6 - corrected chat messages, added message when invisibility are over, changed glow shell cuz that was possibly for player glowing.
  49. 05/02/2009 - v1.4.1 - Added 1 more invisibility feature, removed chat commands, fixed round start invisible, removed toggle cvar, fixed small typo caused debug.
  50. 05/02/2009 - v1.4.2 - fixed some minor stuff.
  51.  
  52. */
  53.  
  54. #include <amxmodx>
  55. #include <fakemeta>
  56. #include <zombieplague>
  57.  
  58. #define PLUGIN "[ZP] Extra Item : Invisible"
  59. #define VERSION "1.4.2"
  60. #define AUTHOR "Fry!"
  61.  
  62. new g_item_name[] = "Medium Invisible"
  63. new g_item_name2[] = "Max Invisible"
  64.  
  65. new g_itemid_invisible, invisible_amount, invisible_cost, invisible_long
  66. new g_itemid_invisible2, invisible_amount2, invisible_cost2, invisible_long2
  67. new bool:g_hasInvisible[33]
  68.  
  69. public plugin_init()
  70. {
  71. register_plugin(PLUGIN, VERSION, AUTHOR)
  72.  
  73. register_cvar("zp_extra_invisible",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
  74.  
  75. invisible_amount = register_cvar("zp_medium_invisble_amount", "30")
  76. invisible_cost = register_cvar("zp_medium_invisible_cost", "40")
  77. invisible_long = register_cvar("zp_medium_invisible_long", "25.0")
  78.  
  79. invisible_amount2 = register_cvar("zp_max_invisible_amount", "5")
  80. invisible_cost2 = register_cvar("zp_max_invisible_cost", "60")
  81. invisible_long2 = register_cvar("zp_max_invisible_long", "15.0")
  82.  
  83. register_event("DeathMsg", "Death", "a")
  84. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  85.  
  86. g_itemid_invisible = zp_register_extra_item(g_item_name, get_pcvar_num(invisible_cost), ZP_TEAM_HUMAN & ZP_TEAM_ZOMBIE)
  87. g_itemid_invisible2 = zp_register_extra_item(g_item_name2, get_pcvar_num(invisible_cost2), ZP_TEAM_HUMAN & ZP_TEAM_ZOMBIE)
  88. }
  89.  
  90. public client_connect(id)
  91. {
  92. g_hasInvisible[id] = false
  93. fm_set_rendering(id, kRenderFxNone, 0,0,0,kRenderNormal, 255)
  94. }
  95.  
  96. public client_disconnect(id)
  97. {
  98. g_hasInvisible[id] = false
  99. fm_set_rendering(id, kRenderFxNone, 0,0,0,kRenderNormal, 255)
  100. }
  101.  
  102. public Death()
  103. {
  104. g_hasInvisible[read_data(2)] = false
  105. }
  106.  
  107. public event_round_start()
  108. {
  109. for (new i = 1; i <= 32; i++)
  110. {
  111. g_hasInvisible[i] = false
  112.  
  113. if (is_user_alive(i))
  114. {
  115. set_pev(i, pev_renderfx, kRenderFxNone)
  116. set_pev(i, pev_renderamt, 255.0)
  117. }
  118. }
  119. }
  120.  
  121. public zp_extra_item_selected(player, itemid)
  122. {
  123. if ( g_hasInvisible[player] )
  124. {
  125. client_print(player, print_chat, "[ZP] Mar megvasaroltad ezt a kepesseget")
  126. return PLUGIN_HANDLED
  127. }
  128.  
  129. if (itemid == g_itemid_invisible)
  130. {
  131. g_hasInvisible[player] = true
  132.  
  133. fm_set_rendering(player, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(invisible_amount))
  134. set_task(get_pcvar_float(invisible_long), "invisible_over", player)
  135. client_print(player, print_chat, "[ZP] Vettel egy kozepes lathatatlansagot.")
  136. }
  137.  
  138. if (itemid == g_itemid_invisible2)
  139. {
  140. g_hasInvisible[player] = true
  141.  
  142. fm_set_rendering(player, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(invisible_amount2))
  143. set_task(get_pcvar_float(invisible_long2), "invisible_over2", player)
  144. client_print(player, print_chat, "[ZP] Vettel egy teljes lathatatlansagot.")
  145. }
  146. return PLUGIN_CONTINUE
  147. }
  148.  
  149. public invisible_over(id)
  150. {
  151. g_hasInvisible[id] = false
  152.  
  153. fm_set_rendering(id, kRenderFxNone, 0,0,0,kRenderNormal, 255)
  154. client_print(id, print_chat, "[ZP] Kozepes lathatatlansag kikapcsolva lejart az ido!!!")
  155. }
  156.  
  157. public invisible_over2(id)
  158. {
  159. g_hasInvisible[id] = false
  160.  
  161. fm_set_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 255)
  162. client_print(id, print_chat, "[ZP] Teljes lathatatlansag kikapcsolva lejart az ido!!!")
  163. }
  164.  
  165. stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 255)
  166. {
  167. new Float:RenderColor[3]
  168. RenderColor[0] = float(r)
  169. RenderColor[1] = float(g)
  170. RenderColor[2] = float(b)
  171.  
  172. set_pev(entity, pev_renderfx, fx)
  173. set_pev(entity, pev_rendercolor, RenderColor)
  174. set_pev(entity, pev_rendermode, render)
  175. set_pev(entity, pev_renderamt, float(amount))
  176.  
  177. return 1
  178. }