HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* AMX Mod X script.
  2. *
  3. * Follow The Bomb
  4. *
  5. * by The Specialist
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software Foundation,
  19. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. * In addition, as a special exception, the author gives permission to
  22. * link the code of this program with the Half-Life Game Engine ("HL
  23. * Engine") and Modified Game Libraries ("MODs") developed by Valve,
  24. * L.L.C ("Valve"). You must obey the GNU General Public License in all
  25. * respects for all of the code used other than the HL Engine and MODs
  26. * from Valve. If you modify this file, you may extend this exception
  27. * to your version of the file, but you are not obligated to do so. If
  28. * you do not wish to do so, delete this exception statement from your
  29. * version.
  30. */
  31.  
  32. #include <amxmodx>
  33. #include <engine>
  34. #include <fun>
  35. #include <cstrike>
  36.  
  37. new g_iFollow_Bomb;
  38. new g_iPunish;
  39. new g_iRadius;
  40. new g_Mode[8];
  41. new Float:c4origin[3];
  42. new Float:pOrigin[3];
  43.  
  44. public plugin_init()
  45. {
  46. register_plugin("Kövesd a bombát","1.1","The Specialist");
  47. register_dictionary("follow_the_bomb.txt");
  48. register_event("ResetHUD","reset_hud","be");
  49. register_event("BarTime", "bomb_planting", "be", "1=3");
  50. register_logevent("bomb_is_planted", 3, "2=Planted_The_Bomb");
  51. register_logevent("bomb_is_dropped", 3, "2=Dropped_The_Bomb");
  52. register_logevent("bomb_defuse_no_kit", 3, "2=Begin_Bomb_Defuse_Without_Kit");
  53. register_logevent("bomb_defuse_kit", 3, "2=Begin_Bomb_Defuse_With_Kit");
  54. g_iFollow_Bomb = register_cvar("ftb_switch","1");
  55. g_iPunish = register_cvar("ftb_punishment","a");
  56. g_iRadius = register_cvar("ftb_radius","1000");
  57. set_task(2.0,"find_bomb",0,"",0,"b");
  58. }
  59. // hud nullázása
  60. public reset_hud(id)
  61. {
  62. if( cs_get_user_team(id) == CS_TEAM_T && find_ent_by_class(-1 , "weapon_c4"))
  63. {
  64. set_hudmessage(255, 255, 255, -1.0, 0.31, 0, 6.0, 12.0);
  65. show_hudmessage(id, "%L",id,"FOLLOW",get_pcvar_num(g_iRadius));
  66. return PLUGIN_HANDLED;
  67. }
  68. return PLUGIN_HANDLED;
  69. }
  70. // bomba és a közel/távol lévők keresése
  71. public find_bomb(id)
  72. {
  73. new g_iBomb = find_ent_by_class(-1,"weapon_c4");
  74. if(get_pcvar_num(g_iFollow_Bomb)==0 || g_iBomb == 0)
  75. {
  76. return PLUGIN_HANDLED;
  77. }else{
  78. entity_get_vector(g_iBomb,EV_VEC_origin,c4origin);
  79. new players[32];
  80. new num;
  81. get_players(players,num,"ace","TERRORIST");
  82.  
  83. for(new i=0;i<num;i++)
  84. {
  85. entity_get_vector(players[i],EV_VEC_origin,pOrigin);
  86. new Float: g_Dist = get_distance_f(c4origin,pOrigin);
  87. new g_iDist = floatround(g_Dist);
  88.  
  89. set_hudmessage(255, 255, 255, -1.0, 0.79, 0, 6.0, 2.0);
  90. show_hudmessage(players[i], "%L",players,"METER",g_iDist);
  91.  
  92. if( g_Dist > get_pcvar_num(g_iRadius))
  93. {
  94. punish_mode(players[i]);
  95.  
  96. }else if(g_Dist > get_pcvar_num(g_iRadius) / 2)
  97. {
  98. set_hudmessage(255, 0, 0, -1.0, 0.31, 0, 6.0, 12.0);
  99. show_hudmessage(players[i], "%L",players,"WARNING");
  100. }
  101. }
  102. }
  103. return PLUGIN_HANDLED;
  104. }
  105. // büntetés funkció
  106. public punish_mode(players)
  107. {
  108. get_pcvar_string(g_iPunish,g_Mode,7);
  109. new g_iMode = read_flags(g_Mode);
  110. new g_iArmor = get_user_armor(players);
  111. new g_iMoney = cs_get_user_money(players);
  112. new g_iHealth = get_user_health(players);
  113.  
  114. set_hudmessage(255, 255, 255, -1.0, 0.34, 0, 6.0, 2.0);
  115. show_hudmessage(players, "%L",players,"LEAVING");
  116.  
  117. if(g_iMode & 1 ) // flag a
  118. {
  119. user_slap(players,0);
  120. }
  121. if(g_iMode & 2 ) // flag b
  122. {
  123. set_user_armor(players,(g_iArmor - 1));
  124. }
  125. if(g_iMode & 4 ) // flag c
  126. {
  127. strip_user_weapons(players);
  128. }
  129. if(g_iMode & 8 ) // flag d
  130. {
  131. cs_set_user_money(players,(g_iMoney - 10));
  132. }
  133. if(g_iMode & 16) // flag e
  134. {
  135. user_kill(players);
  136. }
  137. if(g_iMode & 32 ) // flag f
  138. {
  139. return PLUGIN_HANDLED;
  140. }
  141. if(g_iMode & 64) // flag g
  142. {
  143. set_user_health(players,(g_iHealth - 1));
  144. }
  145. return PLUGIN_HANDLED;
  146. }
  147. // az állapotjelző csíkon át észleli az élesítést
  148. public bomb_planting(id)
  149. {
  150. new i,num;
  151. new g_Name[32];
  152. new players[32];
  153. get_user_name(id,g_Name,31);
  154. get_players(players,num,"ace","TERRORIST");
  155. for(i = 0; i < num ; ++i)
  156. {
  157. set_hudmessage(255, 255, 255, -1.0, 0.35, 0, 6.0, 12.0);
  158. show_hudmessage(players[i], "%L",id,"PLANTING",g_Name);
  159. return PLUGIN_HANDLED;
  160. }
  161. return PLUGIN_HANDLED;
  162. }
  163. // észleli a bomba élesítve üzenetet
  164. public bomb_is_planted()
  165. {
  166. new players[32],num;
  167. get_players(players,num,"ace","TERRORIST");
  168. for(new i = 0; i < num ; ++i)
  169. {
  170. set_hudmessage(255, 255, 255, -1.0, 0.34, 0, 6.0, 12.0);
  171. show_hudmessage(players[i], "%L",players,"PLANTED");
  172. return PLUGIN_HANDLED;
  173. }
  174. return PLUGIN_HANDLED;
  175. }
  176. // figyeli a bomba eldobását
  177. public bomb_is_dropped()
  178. {
  179. new players = get_loguser_index();
  180. punish_mode(players);
  181.  
  182. set_hudmessage(255, 255, 255, -1.0, 0.19, 0, 6.0, 12.0);
  183. show_hudmessage(players, "%L",players,"DROPPED");
  184.  
  185. new ct_players[32]
  186. new num,i;
  187. entity_get_vector(ct_players[i],EV_VEC_origin,pOrigin);
  188. new Float: g_Dist = get_distance_f(c4origin,pOrigin);
  189. new g_iDist = floatround(g_Dist);
  190. get_players(ct_players,num,"ace","CT");
  191. for( i = 0 ; i < num ; ++i)
  192. {
  193. set_hudmessage(255, 255, 255, -1.0, 0.24, 0, 6.0, 12.0);
  194. show_hudmessage(ct_players[i], "Bomb Down ^n %i Units Away!",g_iDist);
  195. }
  196. }
  197. // észleli a bomba hatástalanítását defkit nélkül
  198. public bomb_defuse_no_kit()
  199. {
  200. new id = get_loguser_index();
  201. new g_Name[33];
  202. new players[32],num;
  203. get_user_name(id,g_Name,32);
  204. get_players(players,num,"ace","CT");
  205. for(new i = 0 ; i < num ; ++i)
  206. {
  207. set_hudmessage(255, 255, 255, -1.0, 0.3, 0, 6.0, 12.0);
  208. show_hudmessage(players[i], "%L",players,"NO_KIT",g_Name);
  209. }
  210. }
  211. // észleli a bomba hatástalanítását defkittel
  212. public bomb_defuse_kit()
  213. {
  214. new id = get_loguser_index();
  215. new g_Name[33];
  216. new players[32],num;
  217. get_user_name(id,g_Name,32);
  218. get_players(players,num,"ace","CT");
  219. for(new i = 0 ; i < num ; ++i)
  220. {
  221. set_hudmessage(255, 255, 255, -1.0, 0.3, 0, 6.0, 12.0);
  222. show_hudmessage(players[i], "%L",players,"KIT",g_Name);
  223. }
  224. }
  225. // index szerzése az eseményekből
  226. stock get_loguser_index()
  227. {
  228. new loguser[80], name[32];
  229. read_logargv(0, loguser, 79);
  230. parse_loguser(loguser, name, 31);
  231. return get_user_index(name);
  232. }
  233.  
  234.