HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. //----------------------------------------------------------//
  2. /* CREDITS :
  3.   Thanks to Xeroblood, JJkiller, KingPin for helping me make
  4.   this plugin and Firestorm for helping adding a lot of things
  5.  
  6.   INSTALLING :
  7.   Download .SMA to Scripting folder, run compiler, copy the
  8.   file from Compiled folder and paste in Plugins folder, add the plugin name
  9.   in the Amxx plugins.ini ie : spawnprotection.amxx
  10.  
  11.   DESCRIPTION :
  12.   Protects players when the spawn from being killed
  13.  
  14.   CHANGELOG :
  15.   Version 1.0 - First Release
  16.   Version 2.0 - Fixed godmode cvar problems
  17.   Version 3.0 - Added message time control cvar
  18.   Version 4.0 - Fixed errors
  19.   Version 5.0 - Added message control cvar
  20.   Version 6.0 - Fixed errors - THANKS VEN!
  21.   Version 7.0 - Cleaned up plugin and fixed errors - THANKS
  22.   AVALANCHE, VEN and SubStream!
  23.  
  24.   Fordította: BBk - Death of Legend
  25. */
  26. //----------------------------------------------------------//
  27. #include <amxmodx>
  28. #include <amxmisc>
  29. #include <fun>
  30. //----------------------------------------------------------//
  31. public plugin_init()
  32. {
  33. register_plugin("Spawn Protection", "7.0", "Peli") // Plugin Information
  34. register_concmd("amx_sptime", "cmd_sptime", ADMIN_CVAR, "A kezdo vedelem ideje 1-10 masodperc lehet") // Concmd (Console Command) for the CVAR time
  35. register_concmd("amx_spmessage", "cmd_spmessage", ADMIN_CVAR, "1 = Kezdo vedelem uzenetek megjelenitese , 0 = Kezdo vedelem uzenetek elrejtese") // Concmd for the CVAR message
  36. register_concmd("amx_spshellthickness", "cmd_spshellthickness", ADMIN_CVAR, "A burok vastagsaga 1-100 kozotti ertek lehet") // Concmd for the shellthickness
  37. register_cvar("sv_sp", "1") // Cvar (Command Variable) for the plugin on/off
  38. register_cvar("sv_sptime", "5") // Cvar for controlling the message time (1-10 seconds)
  39. register_cvar("sv_spmessage", "1") // Cvar for controlling the message on/off
  40. register_cvar("sv_spshellthick", "25") // Cvar for controlling the glow shell thickness
  41. register_event("ResetHUD", "sp_on", "be")
  42. register_clcmd("fullupdate", "clcmd_fullupdate")
  43. }
  44. //----------------------------------------------------------//
  45. public client_disconnect(id)
  46. {
  47. remove_task(id)
  48. return PLUGIN_HANDLED
  49. }
  50. //----------------------------------------------------------//
  51. public cmd_sptime(id, level, cid) // This is the function for the cvar time control
  52. {
  53. if(!cmd_access(id, level, cid, 2))
  54. return PLUGIN_HANDLED
  55.  
  56. new arg_str[3]
  57. read_argv(1, arg_str, 3)
  58. new arg = str_to_num(arg_str)
  59.  
  60. if(arg > 10 || arg < 1)
  61. {
  62. client_print(id, print_chat, "Csak 1-10 masodperc kozotti ertekre allithatod a kezdovedelmet")
  63. return PLUGIN_HANDLED
  64. }
  65.  
  66. else if (arg > 0 || arg < 11)
  67. {
  68. set_cvar_num("sv_sptime", arg)
  69. client_print(id, print_chat, "A kezdovedelmet %d masodpercre allitottad", arg)
  70. return PLUGIN_HANDLED
  71. }
  72. return PLUGIN_CONTINUE
  73. }
  74. //----------------------------------------------------------//
  75. public cmd_spmessage(id, level, cid) // This is the function for the cvar message control
  76. {
  77. if (!cmd_access(id, level, cid, 2))
  78. {
  79. return PLUGIN_HANDLED
  80. }
  81.  
  82. new sp[3]
  83. read_argv(1, sp, 2)
  84.  
  85. if (sp[0] == '1')
  86. {
  87. set_cvar_num("amx_spmessage", 1)
  88. }
  89.  
  90. else if (sp[0] == '0')
  91. {
  92. set_cvar_num("amx_spmessage", 0)
  93. }
  94.  
  95. else if (sp[0] != '1' || sp[0] != '0')
  96. {
  97. console_print(id, "Usage : amx_spmessage 1 = Messages Be | 0 = Messages Ki")
  98. return PLUGIN_HANDLED
  99. }
  100.  
  101. return PLUGIN_HANDLED
  102. }
  103. //----------------------------------------------------------//
  104. public cmd_spshellthickness(id, level, cid)
  105. {
  106. if(!cmd_access(id, level, cid, 2))
  107. return PLUGIN_HANDLED
  108.  
  109. new arg_str[3]
  110. read_argv(1, arg_str, 3)
  111. new arg = str_to_num(arg_str)
  112.  
  113. if(arg > 100 || arg < 1)
  114. {
  115. client_print(id, print_chat, "Csak 1-100 kozotti ertekre allithatod a burok atlatszosaganak aranyat")
  116. return PLUGIN_HANDLED
  117. }
  118.  
  119. else if (arg > 0 || arg < 101)
  120. {
  121. set_cvar_num("sv_spshellthickness", arg)
  122. client_print(id, print_chat, "A burok atlatszosaganak aranyat %d allitottad", arg)
  123. return PLUGIN_HANDLED
  124. }
  125. return PLUGIN_CONTINUE
  126. }
  127. //----------------------------------------------------------//
  128. public sp_on(id) // This is the function for the event godmode
  129. {
  130. if(get_cvar_num("sv_sp") == 1)
  131. {
  132. set_task(0.1, "protect", id)
  133. }
  134.  
  135. return PLUGIN_CONTINUE
  136. }
  137. //----------------------------------------------------------//
  138. public protect(id) // This is the function for the task_on godmode
  139. {
  140. new Float:SPTime = get_cvar_float("sv_sptime")
  141. new SPSecs = get_cvar_num("sv_sptime")
  142. new FTime = get_cvar_num("mp_freezetime")
  143. new SPShell = get_cvar_num("sv_spshellthick")
  144. set_user_godmode(id, 1)
  145.  
  146. if(get_user_team(id) == 1)
  147. {
  148. set_user_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, SPShell)
  149. }
  150.  
  151. if(get_user_team(id) == 2)
  152. {
  153. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, SPShell)
  154. }
  155.  
  156. if(get_cvar_num("sv_spmessage") == 1)
  157. {
  158. set_hudmessage(255, 1, 1, -1.0, -1.0, 0, 6.0, SPTime+FTime, 0.1, 0.2, 4)
  159. show_hudmessage(id, "Kezdovedelem aktivalva van %d masodpercig!", SPSecs)
  160. }
  161.  
  162. set_task(SPTime+FTime, "sp_off", id)
  163. return PLUGIN_HANDLED
  164. }
  165. //----------------------------------------------------------//
  166. public sp_off(id) // This is the function for the task_off godmode
  167. {
  168. new SPShell = get_cvar_num("sv_spshellthick")
  169. if(!is_user_connected(id))
  170. {
  171. return PLUGIN_HANDLED
  172. }
  173.  
  174. else
  175. {
  176. set_user_godmode(id, 0)
  177. set_user_rendering(id, kRenderFxGlowShell, 0, 0,0, kRenderNormal, SPShell)
  178. return PLUGIN_HANDLED
  179. }
  180.  
  181. return PLUGIN_HANDLED
  182. }
  183. //----------------------------------------------------------//
  184. public clcmd_fullupdate(id)
  185. {
  186. return PLUGIN_HANDLED
  187. }
  188. //----------------------------------------------------------//