HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fun>
  4. #include <cstrike>
  5. #include <amxmisc>
  6. #include <fakemeta>
  7.  
  8. new Float:TEST_TIME=0.1
  9. new Float:WARN_TIME=1.0
  10. new Float:FLASH_TIME=0.8
  11.  
  12. #define MAX_ZONES 8
  13. new MIN_PLAYERS=2 /*Dobre do testowania w mniej osob
  14. lub gdy chcesz by koniec rashu byl
  15. przy wiekszej liczbbie osob*/
  16. #define TASK_ZONE 600743
  17. #define TASK_LOOP 500743
  18. #define TASK_VIEW 400743
  19. #define TASK_INFO 300743
  20. #define TASK_FLASH 200743
  21.  
  22. #define AUTHOR "Miczu"
  23.  
  24. new mUsuwaniestrefy // Menu
  25. new mcbUsuwaniestrefy // Menu Callback
  26. new mZapisacstrefy // Menu
  27. new mcbZapisacstrefy // Menu Callback
  28. new mAntirushControlMenu // Menu
  29. new mcbAntirushControlMenu // Menu Callback
  30. //Uzylem generatora i takie malo eleganckie wyszlo
  31.  
  32. new map_cors_edit[MAX_ZONES*6]
  33. new zones_edit
  34. new zone_editing=0
  35. new map_editor
  36. new map_cors_file_line=127
  37. new zone_incresment=10
  38. new zone_coords_num=0
  39. new zone_coords[3][13] = { "X Kordinata", "Y Kordinata", "Z Kordinata"}
  40. new editign=0
  41. new edit_g_team[3]
  42. new round_start=0
  43. new lines
  44.  
  45. new gMsgScreenFade
  46. new rasher[33]=0
  47. new raszer[33]
  48. new flashed[33]=0
  49. new sounded[33]=0
  50. new speed_limit[33]=0
  51. new Float:g_time
  52. new g_team[3]
  53. new g_origin[3]
  54. new map_cors_pre=2
  55. new map_cors_origin[MAX_ZONES*6]
  56. new slap
  57. new warn_control = 0 // miczu
  58. new zones = 0
  59.  
  60. new zone_color_aktiv[3] = { 0, 0, 255 }
  61. new zone_color_red[3] = { 0, 255, 0 }
  62. new zone_color_yellow[3] = { 255, 255, 0 }
  63. new spr_dot
  64.  
  65. new actions[11][32] = { "barney/donthurtem.wav","nihilanth/nil_now_die.wav","hgrunt/c2a3_hg_laugh.wav","hgrunt/silence!.wav","hgrunt/silence!.wav","barney/whatsgoingon.wav","barney/rightway.wav","barney/nosir.wav","barney/openfire.wav","barney/stophere.wav","hgrunt/c2a2_hg_chat5a.wav"}
  66.  
  67. public plugin_init()
  68. {
  69. register_plugin("Anti-Rush","2.5d",AUTHOR)
  70. log_amx(" <<Uruchomiono M_Antirusher 2.5d>>")
  71.  
  72. register_dictionary("M_antirusher.txt")
  73. register_dictionary("common.txt")
  74.  
  75. register_clcmd("say /rules","info")
  76. register_clcmd("say /antirusher_menu","amx_antirusher_menu")
  77.  
  78. register_cvar("Antirusher", "2.5d",FCVAR_SERVER)
  79. register_cvar("amx_antirusher","1")
  80. register_cvar("amx_antirusher_sound","1")
  81. register_cvar("amx_antirusher_sound_mode","0")
  82. register_cvar("amx_antirusher_warn","1")
  83. register_cvar("amx_antirusher_slap","3")
  84. register_cvar("amx_antirusher_time","60.0")
  85. register_cvar("amx_antirusher_freq","0.1")
  86. register_cvar("amx_antirusher_action","7")
  87. register_cvar("amx_antirusher_cash","50")
  88. register_cvar("amx_antirusher_cash_end","2")
  89. register_cvar("amx_antirusher_immunity","0")
  90. register_cvar("amx_antirusher_zasady","1")
  91. register_cvar("amx_antirusher_people","2")
  92.  
  93. register_event("HLTV","Event_StartRound","a","1=0","2=0")
  94. register_event("RoundTime","event_roundtime","bc")
  95. register_event("SendAudio", "bomb_planted", "a", "2&%!MRAD_BOMBPL")
  96. register_event("DeathMsg","DeathMsg","ade")
  97. register_event("CurWeapon","CurWeapon","be")
  98.  
  99. gMsgScreenFade = get_user_msgid("ScreenFade")
  100. map_cors_pre = map_cors_present(map_cors_origin,g_team)
  101. TEST_TIME=get_cvar_float("amx_antirusher_freq")
  102.  
  103. register_menucmd(register_menuid("Antirush Menu"), 1023, "Antirush_menu")
  104. register_menucmd(register_menuid("Punishment Menu"), 1023, "Punishment_menu")
  105. register_menucmd(register_menuid("Antirush Zone Creator"), 1023, "Antirush_Zone_Creator")
  106. register_menucmd(register_menuid("Edit Zone"), 1023, "edit_zone2")
  107.  
  108. mAntirushControlMenu = menu_create("Antirush Control Menu", "mh_AntirushControlMenu")
  109. mcbAntirushControlMenu = menu_makecallback("mcb_AntirushControlMenu")
  110. menu_additem(mAntirushControlMenu, "Antirush cvar control", "ma_AntirushControlMenu", ADMIN_CVAR, mcbAntirushControlMenu)
  111. menu_additem(mAntirushControlMenu, "Antirush Punishments", "ma_AntirushControlMenu", ADMIN_CVAR, mcbAntirushControlMenu)
  112. menu_additem(mAntirushControlMenu, "Antirush Zone Creator", "ma_AntirushControlMenu", ADMIN_RCON, mcbAntirushControlMenu)
  113.  
  114. mZapisacstrefy = menu_create("Zapisac strefy", "mh_Zapisacstrefy")
  115. mcbZapisacstrefy = menu_makecallback("mcb_Zapisacstrefy")
  116. menu_additem(mZapisacstrefy, "TAK", "ma_Zapisacstrefy", ADMIN_ALL, mcbZapisacstrefy)
  117. menu_additem(mZapisacstrefy, "NIE", "ma_Zapisacstrefy", ADMIN_ALL, mcbZapisacstrefy)
  118.  
  119. mUsuwaniestrefy = menu_create("Usuwanie strefy", "mh_Usuwaniestrefy")
  120. mcbUsuwaniestrefy = menu_makecallback("mcb_Usuwaniestrefy")
  121. menu_additem(mUsuwaniestrefy, "TAK", "ma_Usuwaniestrefy", ADMIN_ALL, mcbUsuwaniestrefy)
  122. menu_additem(mUsuwaniestrefy, "NIE", "ma_Usuwaniestrefy", ADMIN_ALL, mcbUsuwaniestrefy)
  123.  
  124. require_module("fakemeta")
  125.  
  126. require_module("engine")
  127. require_module("fun")
  128. require_module("cstrike")
  129.  
  130. return PLUGIN_CONTINUE
  131. }
  132.  
  133. public plugin_precache() {
  134. spr_dot = precache_model("sprites/dot.spr") // potrzebne do robienia lini
  135. }
  136.  
  137. ///////////////////////////////////////////////////////////////////////
  138. ///////// M_Antirusher Events /////////
  139. ////////////////////////////////////////////////////////////////////////
  140.  
  141. public client_connect(id){
  142. free_the_man(id) //nie chcemy by ktos kto sie polaczy byl karany
  143. } //kiedy osoba co opuszczajac serwer miala kare
  144. //czyli gdy stary i nowy gracz beda mieli te same id
  145.  
  146. public client_disconnect(id) {
  147. free_the_man(id) //tak na wszelki wypadek, ale mozna sobie odpuscic
  148. return PLUGIN_CONTINUE
  149. }
  150.  
  151. public Event_StartRound(){
  152. round_start++
  153. MIN_PLAYERS = get_cvar_num("amx_antirusher_people") // zmiana people dziala na starcie rundy
  154. }
  155.  
  156. public client_putinserver(id){ //tu informacja o rashu
  157. new arg[1] //Zoptymalizowane uzycie set_task
  158. arg[0]=id //Deklaracja 1 kumurki pamieci zamiast 4 i bez zmian z str-> num i na odwrot
  159.  
  160. if (map_cors_pre && get_cvar_num("amx_antirusher"))
  161. set_task(45.0,"informclient",TASK_INFO+id,arg,1)
  162. }
  163.  
  164. public bomb_planted() { //podlozono bombe
  165. remove_task(TASK_LOOP) //przerywa sprawdzanie rashu
  166. remove_task(TASK_VIEW) //przerywa wyswietlanie granic dla userow
  167. free_the_world() //mozna rashowac
  168. }
  169.  
  170. public event_roundtime() {
  171. if (round_start<1) return PLUGIN_CONTINUE //takie zabezpieczenie by nie sprawdzalo po czasie rashu
  172. if (map_cors_pre && get_cvar_num("amx_antirusher")) {
  173. slap = floatround(get_cvar_num("amx_antirusher_slap")*(10.0*TEST_TIME)) // slapy biora zawsze tyle samo hp w przedziale czasu
  174. remove_task(TASK_LOOP)
  175. remove_task(TASK_VIEW)
  176. g_time = get_gametime() + get_cvar_float("amx_antirusher_time")
  177. set_task(2*TEST_TIME, "checkOrigin",TASK_LOOP)
  178. set_task(2*WARN_TIME, "rash_warn",TASK_VIEW)
  179.  
  180. }
  181. return PLUGIN_CONTINUE
  182. } //
  183.  
  184. public DeathMsg(){
  185. new vid = read_data(2) //id trupa
  186. free_the_man(vid) //uwalnia trupa by zaczol runde z czystym kontem
  187. }
  188.  
  189. //////////////////////////////////////////////////////////////////////
  190. ///////// M_Antirusher Things /////////
  191. //////////////////////////////////////////////////////////////////////
  192.  
  193. map_cors_present(maporigin[MAX_ZONES*6],team[3]) {
  194.  
  195. new zonefile[256],zonefile2[256]
  196.  
  197. get_configsdir(zonefile, 255)
  198.  
  199. if(is_linux_server()){
  200. format(zonefile2, 255, "%s/antirusher", zonefile)
  201. if(!(dir_exists(zonefile2))) mkdir (zonefile2)
  202. format(zonefile2, 255, "%s/antirusher/rush.cor", zonefile)
  203. }
  204. else{
  205. format(zonefile2, 255, "%s\antirusher", zonefile)
  206. if(!(dir_exists(zonefile2))) mkdir (zonefile2)
  207. format(zonefile2, 255, "%s\antirusher\rush.cor", zonefile)
  208. }
  209.  
  210. if (file_exists(zonefile2)){
  211.  
  212. new readdata[512]
  213. new currentmap[32]
  214. get_mapname(currentmap,31)
  215. new map[32], len
  216. new x11[16],x12[16],y11[16],y12[16],z11[16],z12[16]
  217. new x21[16],x22[16],y21[16],y22[16],z21[16],z22[16]
  218. new x31[16],x32[16],y31[16],y32[16],z31[16],z32[16]
  219. new x41[16],x42[16],y41[16],y42[16],z41[16],z42[16]
  220. new x51[16],x52[16],y51[16],y52[16],z51[16],z52[16]
  221. new x61[16],x62[16],y61[16],y62[16],z61[16],z62[16]
  222. new x71[16],x72[16],y71[16],y72[16],z71[16],z72[16]
  223. new x81[16],x82[16],y81[16],y82[16],z81[16],z82[16]
  224.  
  225.  
  226. for(new i=0; i < 128 && read_file(zonefile2,i,readdata,511,len); i++) {
  227. x11="";x12="";y11="";y12="";z11="";z12=""
  228. x21="";x22="";y21="";y22="";z21="";z22=""
  229. x31="";x32="";y31="";y32="";z31="";z32=""
  230. x41="";x42="";y41="";y42="";z41="";z42=""
  231. x51="";x52="";y51="";y52="";z51="";z52=""
  232. x61="";x62="";y61="";y62="";z61="";z62=""
  233. parse(readdata,team,2,map,31,x11,15,x12,15,y11,15,y12,15,z11,15,z12,15,
  234. x21,15,x22,15,y21,15,y22,15,z21,15,z22,15,
  235. x31,15,x32,15,y31,15,y32,15,z31,15,z32,15,
  236. x41,15,x42,15,y41,15,y42,15,z41,15,z42,15,
  237. x51,15,x52,15,y51,15,y52,15,z51,15,z52,15,
  238. x61,15,x62,15,y61,15,y62,15,z61,15,z62,15,
  239. x71,15,x72,15,y71,15,y72,15,z71,15,z72,15,
  240. x81,15,x82,15,y81,15,y82,15,z81,15,z82,15)
  241. lines=i
  242. if(equal(map,currentmap)) {
  243. maporigin[0] = str_to_num(x11)
  244. maporigin[1] = str_to_num(x12)
  245. maporigin[2] = str_to_num(y11)
  246. maporigin[3] = str_to_num(y12)
  247. maporigin[4] = str_to_num(z11)
  248. maporigin[5] = str_to_num(z12)
  249. maporigin[6] = str_to_num(x21)
  250. maporigin[7] = str_to_num(x22)
  251. maporigin[8] = str_to_num(y21)
  252. maporigin[9] = str_to_num(y22)
  253. maporigin[10] = str_to_num(z21)
  254. maporigin[11] = str_to_num(z22)
  255. maporigin[12] = str_to_num(x31)
  256. maporigin[13] = str_to_num(x32)
  257. maporigin[14] = str_to_num(y31)
  258. maporigin[15] = str_to_num(y32)
  259. maporigin[16] = str_to_num(z31)
  260. maporigin[17] = str_to_num(z32)
  261. maporigin[18] = str_to_num(x41)
  262. maporigin[19] = str_to_num(x42)
  263. maporigin[20] = str_to_num(y41)
  264. maporigin[21] = str_to_num(y42)
  265. maporigin[22] = str_to_num(z41)
  266. maporigin[23] = str_to_num(z42)
  267. maporigin[24] = str_to_num(x51)
  268. maporigin[25] = str_to_num(x52)
  269. maporigin[26] = str_to_num(y51)
  270. maporigin[27] = str_to_num(y52)
  271. maporigin[28] = str_to_num(z51)
  272. maporigin[29] = str_to_num(z52)
  273. maporigin[30] = str_to_num(x61)
  274. maporigin[31] = str_to_num(x62)
  275. maporigin[32] = str_to_num(y61)
  276. maporigin[33] = str_to_num(y62)
  277. maporigin[34] = str_to_num(z61)
  278. maporigin[35] = str_to_num(z62)
  279. maporigin[36] = str_to_num(x71)
  280. maporigin[37] = str_to_num(x72)
  281. maporigin[38] = str_to_num(y71)
  282. maporigin[39] = str_to_num(y72)
  283. maporigin[40] = str_to_num(z71)
  284. maporigin[41] = str_to_num(z72)
  285. maporigin[42] = str_to_num(x81)
  286. maporigin[43] = str_to_num(x82)
  287. maporigin[44] = str_to_num(y81)
  288. maporigin[45] = str_to_num(y82)
  289. maporigin[46] = str_to_num(z81)
  290. maporigin[47] = str_to_num(z82)
  291.  
  292. map_cors_file_line=i
  293. for(new j=0;j<MAX_ZONES;j++){
  294. i=j*6
  295. if(((maporigin[1+i]-maporigin[0+i])>0)&&((maporigin[3+i]-maporigin[2+i])>0)&&((maporigin[5+i]-maporigin[4+i])>0))
  296. zones++
  297. }
  298.  
  299. return 1
  300. }
  301. if((len<15) && (map_cors_file_line>i)) map_cors_file_line=i
  302. }
  303. log_amx("%L",LANG_SERVER,"AR_NO_ZONE")
  304. if(lines+2<map_cors_file_line) map_cors_file_line=lines+2 //zapobiega zapisywaniu na 127 pozycji gdy nie ma wolnych lini na koncu :)
  305. return 0
  306. }
  307. else log_amx("%L",LANG_SERVER,"AR_NO_FILE")
  308. g_team="XX"
  309. map_cors_file_line=0 //nie ma pluku rush,cor wiec niech zapisze w pierwszej lini
  310. return 0
  311. }
  312.  
  313.  
  314. public info(id){
  315. new anti_zasady = get_cvar_num("amx_antirusher_zasady")
  316. if(anti_zasady==1){
  317. new map[4]
  318. get_mapname(map,3) // rozpoznawanie typu mapy na podstawie pierwszych 3 liter :p
  319.  
  320. if (equal(map,"cs_")) client_print(id,print_chat, "%L",LANG_PLAYER,"AR_CS_MAP")
  321. else if (equal(map,"de_")) client_print(id,print_chat, "%L",LANG_PLAYER,"AR_DE_MAP")
  322. else if (equal(map,"fy_")) client_print(id,print_chat, "%L",LANG_PLAYER,"AR_FY_MAP")
  323. else if (equal(map,"aim")) client_print(id,print_chat, "%L",LANG_PLAYER,"AR_AIM_MAP")
  324. else if (equal(map,"awp")) client_print(id,print_chat, "%L",LANG_PLAYER,"AR_AWP_MAP")
  325. else if (equal(map,"kz_")) client_print(id,print_chat, "%L",LANG_PLAYER,"AR_KZ_MAP")
  326. else if (equal(map,"fun")) client_print(id,print_chat, "%L",LANG_PLAYER,"AR_FUN_MAP")
  327. else if (equal(map,"sur")) client_print(id,print_chat, "%L",LANG_PLAYER,"AR_SURF_MAP")
  328. else if (equal(map,"sj_")) client_print(id,print_chat, "%L",LANG_PLAYER,"AR_SJ_MAP")
  329. else if (equal(map,"ka_")) client_print(id,print_chat, "%L",LANG_PLAYER,"AR_KA_MAP")
  330. else if (equal(map,"he_")) client_print(id,print_chat, "%L",LANG_PLAYER,"AR_HE_MAP")
  331. }
  332. }
  333.  
  334. public informclient(arg[1]){
  335. // arg[0] to id ^^
  336. if(is_user_connected(arg[0])) { // spradza czy gracz nadal jest na serwie
  337. client_print(arg[0],print_chat,"%L",LANG_PLAYER,"AR_INFO_WARN")
  338. client_print(arg[0],print_chat,"%L",LANG_PLAYER,"AR_INFO_CLIENT",get_cvar_float("amx_antirusher_time"))
  339. }
  340. }
  341.  
  342.  
  343. public checkOrigin() { // tu sprawdza czy rashujesz
  344.  
  345. if (round_start<1) return
  346. if (get_gametime() > g_time)
  347. {
  348. free_the_world()
  349. return
  350. }
  351.  
  352. new players[32], num,tt_num,ct_num
  353. get_players(players,num)
  354.  
  355. for(new i=0;i<num;i++)
  356. {
  357. if(is_user_alive(players[i]))
  358. {
  359. if(cs_get_user_team(players[i])==CS_TEAM_T) tt_num++
  360. else if(cs_get_user_team(players[i])==CS_TEAM_CT) ct_num++
  361. }
  362. }
  363.  
  364. if (tt_num<MIN_PLAYERS)
  365. {
  366. free_the_world()
  367. return
  368. }
  369. if (ct_num<MIN_PLAYERS)
  370. {
  371. free_the_world()
  372. return
  373. }
  374.  
  375.  
  376. get_players(players,num)
  377. set_task(TEST_TIME, "checkOrigin", TASK_LOOP)
  378. for(new i = 0; i < num; i++)
  379. {
  380. if(is_user_alive(players[i]))
  381. {
  382. if((equal(g_team,"T")&&(cs_get_user_team(players[i])==CS_TEAM_T))||(equal(g_team,"CT")&&(cs_get_user_team(players[i])==CS_TEAM_CT))||equal(g_team,"XX"))
  383. {
  384. get_user_origin(players[i],g_origin)
  385. if ((map_cors_origin[0] < g_origin[0] < map_cors_origin[1]) && (map_cors_origin[2] < g_origin[1] < map_cors_origin[3]) && (map_cors_origin[4] < g_origin[2] < map_cors_origin[5]) ||
  386. (map_cors_origin[6] < g_origin[0] < map_cors_origin[7]) && (map_cors_origin[8] < g_origin[1] < map_cors_origin[9]) && (map_cors_origin[10] < g_origin[2] < map_cors_origin[11]) ||
  387. (map_cors_origin[12] < g_origin[0] < map_cors_origin[13]) && (map_cors_origin[14] < g_origin[1] < map_cors_origin[15]) && (map_cors_origin[16] < g_origin[2] < map_cors_origin[17]) ||
  388. (map_cors_origin[18] < g_origin[0] < map_cors_origin[19]) && (map_cors_origin[20] < g_origin[1] < map_cors_origin[21]) && (map_cors_origin[22] < g_origin[2] < map_cors_origin[23]) ||
  389. (map_cors_origin[24] < g_origin[0] < map_cors_origin[25]) && (map_cors_origin[26] < g_origin[1] < map_cors_origin[27]) && (map_cors_origin[28] < g_origin[2] < map_cors_origin[29]) ||
  390. (map_cors_origin[30] < g_origin[0] < map_cors_origin[31]) && (map_cors_origin[32] < g_origin[1] < map_cors_origin[33]) && (map_cors_origin[34] < g_origin[2] < map_cors_origin[35])){
  391. punishPlayer(players[i])
  392. raszer[players[i]]=1
  393. }
  394. else{
  395. free_the_man(players[i])
  396. }
  397. }
  398. }
  399. }
  400. }
  401.  
  402. public rash_warn(){ // tu sprawsza czy ma ci wyswietlic granice rashu
  403. if (get_gametime() > g_time){
  404. return
  405. }
  406. if (get_cvar_num("amx_antirusher_warn")==0) return
  407. new players[32], num, tt_num, ct_num
  408. get_players(players,num)
  409.  
  410. for(new i=0;i<num;i++)
  411. {
  412. if(is_user_alive(players[i]))
  413. {
  414. if(cs_get_user_team(players[i])==CS_TEAM_T) tt_num++
  415. else if(cs_get_user_team(players[i])==CS_TEAM_CT) ct_num++
  416. }
  417. }
  418.  
  419. if (equal(g_team,"CT")){
  420. if (tt_num<MIN_PLAYERS) return
  421. if (ct_num<MIN_PLAYERS) return
  422. }
  423.  
  424. set_task(WARN_TIME, "rash_warn",TASK_VIEW)
  425.  
  426. new orrigins[3]
  427. for(new j=0;j<num;j++){
  428. if(raszer[players[j]]<1 && is_user_alive(players[j])) // jak juz raszuje to mozna graczowi odpuscic :)
  429. {
  430. if((equal(g_team,"T")&&(cs_get_user_team(players[j])==CS_TEAM_T))||(equal(g_team,"CT")&&(cs_get_user_team(players[j])==CS_TEAM_CT))||equal(g_team,"XX"))
  431. {
  432. get_user_origin(players[j],orrigins)
  433. for(new i=0;i<MAX_ZONES;i++){
  434. if((map_cors_origin[0+i*6]-450 < orrigins[0] < map_cors_origin[0+i*6]) && (map_cors_origin[2+i*6]-100 < orrigins[1] < map_cors_origin[3+i*6]+100) && (map_cors_origin[4+i*6] < orrigins[2] < map_cors_origin[5+i*6])){
  435. zone_warn(players[j],i,0,orrigins)
  436. }
  437. else if((map_cors_origin[1+i*6] < orrigins[0] < map_cors_origin[1+i*6]+450) && (map_cors_origin[2+i*6]-100 < orrigins[1] < map_cors_origin[3+i*6]+100) && (map_cors_origin[4+i*6] < orrigins[2] < map_cors_origin[5+i*6])){
  438. zone_warn(players[j],i,1,orrigins)
  439. }
  440. if((map_cors_origin[0+i*6]-100 < orrigins[0] < map_cors_origin[0+i*6+1]+100) && (map_cors_origin[2+i*6]-450 < orrigins[1] < map_cors_origin[2+i*6]) && (map_cors_origin[4+i*6] < orrigins[2] < map_cors_origin[5+i*6])){
  441. zone_warn(players[j],i,2,orrigins)
  442. }
  443. else if((map_cors_origin[0+i*6]-100 < orrigins[0] < map_cors_origin[0+i*6+1]+100) && (map_cors_origin[3+i*6] < orrigins[1] < map_cors_origin[3+i*6]+450) && (map_cors_origin[4+i*6] < orrigins[2] < map_cors_origin[5+i*6])){
  444. zone_warn(players[j],i,3,orrigins)
  445. }
  446. } // nigdy nie bedziesz widzial przednia i tylna lub lewa i prawa sciane rownoczesnie wiec jest else
  447.  
  448. }
  449. }
  450. }
  451. }
  452.  
  453. ///////////////////////////////////////////////////////////////////////////
  454. ///////// M_Antirusher Punishments /////////
  455. ///////////////////////////////////////////////////////////////////////////
  456.  
  457. punishPlayer(id) {
  458.  
  459. new action = 1
  460. action = get_cvar_num("amx_antirusher_action")
  461. if ((get_cvar_num("amx_antirusher_immunity") == 1)&&(get_user_flags(id)&ADMIN_IMMUNITY)) {
  462. action = 0
  463. }
  464. switch (action) {
  465. case 0:{
  466. new name[32]
  467. get_user_name(id,name,31)
  468. server_cmd("amx_chat %L",LANG_SERVER,"AR_SRV_INFO", name)
  469. }
  470. case 1: fakedamage ( id, "rashing", slap*1.0,16384)
  471. case 2: user_silentkill(id)
  472. case 3: kickPlayer(id)
  473. case 4: banPlayer(id)
  474. case 5:{
  475. if(speed_limit[id]==0){
  476. speed_limit[id]=1
  477. set_user_maxspeed(id,(get_user_maxspeed(id)/2.0));
  478. }
  479. }
  480. case 6:{
  481. if(flashed[id]==0){
  482. flashed[id]=1
  483. set_task(FLASH_TIME,"Flash",TASK_FLASH+id)
  484. }
  485. }
  486. case 7:{
  487. new Float: velocity[3]
  488. new Float: DW //D³ugosc wektora
  489. entity_get_vector(id,EV_VEC_velocity,velocity)
  490. DW=vector_length ( velocity )+0.0001
  491. velocity[0]=(velocity[0]/DW)*(-500.0)
  492. velocity[1]=(velocity[1]/DW)*(-500.0)
  493. if(velocity[2]<0) velocity[2]=velocity[2]*(-1.0)+15.0 //wyrzuca do gory
  494. entity_set_vector(id,EV_VEC_velocity,velocity)
  495. }
  496. case 8:{
  497. rasher[id]=1
  498. }
  499. case 9:{
  500. aim_on_me(id)
  501. }
  502. case 10:{
  503. ebay_time_to_pay(id) // ogladalem filmik w flashu i to chyba przez to :p
  504. }
  505. default:{
  506. new name[32]
  507. get_user_name(id,name,31)
  508. server_cmd("amx_chat %L:p",LANG_SERVER,"AR_SRV_INFO", name)
  509. }
  510. }
  511. if (warn_control >(25/floatround(10.0*TEST_TIME))){ // jak dlugo siedzisz w granicy to ci pisze w czacie :p
  512. client_print(id, print_chat, "%L",LANG_PLAYER,"AR_RASH_WARN")
  513. warn_control=0;}
  514. warn_control+=1
  515.  
  516. if(get_cvar_num("amx_antirusher_sound")){
  517. if(sounded[id]==0){
  518. new sound_mode = get_cvar_num("amx_antirusher_sound_mode")
  519.  
  520. if(sound_mode==0) client_cmd(id,"spk %s",actions[action])
  521. else client_cmd(0,"spk %s",actions[action])
  522. sounded[id]=1
  523. }
  524. }
  525. }
  526.  
  527. kickPlayer(id) {
  528. client_print(id, print_chat, "%L",LANG_PLAYER,"AR_RASH_KICK")
  529. client_print(id, print_chat, "%L",LANG_PLAYER,"AR_RASH_KICK")
  530. server_cmd("amx_kick #%d", id)
  531. }
  532.  
  533. banPlayer(id) {
  534. client_print(id, print_chat, "%L",LANG_PLAYER,"AR_RASH_BAN")
  535. client_print(id, print_chat, "%L",LANG_PLAYER,"AR_RASH_BAN")
  536. server_cmd("amx_ban #%d 5 rush", id)
  537. }
  538.  
  539. public CurWeapon(id){
  540. if(speed_limit[id]==1) set_user_maxspeed(id,(get_user_maxspeed(id)/2.0)); // zmiana broni cie przyspieszy? nie ^^
  541. }
  542.  
  543. public Flash(id) {
  544. id-=TASK_FLASH
  545. if(flashed[id]){
  546. set_task(FLASH_TIME,"Flash",TASK_FLASH+id)
  547.  
  548. message_begin(MSG_ONE,gMsgScreenFade,{0,0,0},id)
  549. write_short( 1<<15 )
  550. write_short( 1<<10 )
  551. write_short( 1<<12 )
  552. new x,y,z
  553. x= random_num(0,255)
  554. write_byte( x )
  555. y= random_num(0,255)
  556. write_byte( y )
  557. z= random_num(0,255)
  558. write_byte( z )
  559. write_byte( 255 )
  560. message_end()
  561. emit_sound(id,CHAN_BODY, "weapons/flashbang-2.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
  562. }
  563. }
  564.  
  565. public client_PreThink(id){
  566. if (rasher[id]){
  567. new button = entity_get_int(id, EV_INT_button)
  568. if ((button & IN_ATTACK2) || (button & IN_ATTACK)){
  569. user_silentkill(id)
  570. }
  571. }
  572. }
  573.  
  574. public aim_on_me(id){
  575. new radom, radom2
  576. radom = random_num(0,3)
  577. radom2 = random_num(1,6)
  578. new polecenie[64]
  579. switch (radom){
  580. case 0:{
  581. format(polecenie, 63, "+left;")
  582. }
  583. case 1:{
  584. format(polecenie, 63, "+right;")
  585. }
  586. case 2:{
  587. format(polecenie, 63, "+lookup;")
  588. }
  589. case 3:{
  590. format(polecenie, 63, "+lookdown;")
  591. }
  592. }
  593.  
  594. for (new i=0; i < radom2; i++)
  595. {
  596. add(polecenie, 63, "wait;")
  597. }
  598.  
  599. switch (radom) {
  600. case 0:{
  601. add(polecenie, 63, "-left;")
  602. }
  603. case 1:{
  604. add(polecenie, 63, "-right;")
  605. }
  606. case 2:{
  607. add(polecenie, 63, "-lookup;")
  608. }
  609. case 3:{
  610. add(polecenie, 63, "-lookdown;")
  611. }
  612. }
  613. client_cmd(id,"%s",polecenie)
  614. }
  615.  
  616. ebay_time_to_pay(id){
  617. new cash=get_cvar_num("amx_antirusher_cash")*floatround(10.0*TEST_TIME)
  618. new cash2=get_cvar_num("amx_antirusher_cash_end")
  619. new money = cs_get_user_money(id)
  620. if (money-cash > 0)cs_set_user_money(id,money-cash)
  621. else switch(cash2){
  622. case 0: cs_set_user_money(id,0)
  623. case 1:{
  624. fakedamage ( id, "rashing", cash/25.0,16384)
  625. }
  626. case 2:{
  627. fakedamage ( id, "rashing", cash/10.0,16384)
  628. }
  629. case 3:{
  630. fakedamage ( id, "rashing", cash/5.0,16384)
  631. }
  632. case 4:{
  633. fakedamage ( id, "rashing", cash/2.0,16384)
  634. }
  635. case 5:{
  636. fakedamage ( id, "rashing", cash/1.0,16384)
  637. }
  638. }
  639. }
  640.  
  641. public free_the_man(id){
  642. sounded[id]=0
  643. rasher[id]=0
  644. flashed[id]=0
  645. raszer[id]=0
  646. if(speed_limit[id]==1){
  647. set_user_maxspeed(id,(get_user_maxspeed(id)*2.0))
  648. speed_limit[id]=0
  649. }
  650. }
  651.  
  652.  
  653. public free_the_world(){
  654. if(round_start<1) return
  655. round_start=0
  656. new players[32],num
  657. get_players(players,num,"a")
  658. for(new i;i<num;i++){
  659. free_the_man(players[i])
  660. message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, players[i])
  661. write_byte(players[i])
  662. write_string("^x04 Lehet rusholni!")
  663. message_end()
  664. }
  665. }
  666.  
  667. ///////////////////////////////////////////////////////////////////////
  668. ///////// M_Antirusher Menu's /////////
  669. ///////////////////////////////////////////////////////////////////////
  670.  
  671. public amx_antirusher_menu(id){
  672. menu_display(id, mAntirushControlMenu, 0)
  673. }
  674.  
  675. public mh_AntirushControlMenu(id, menu, item) {
  676. switch(item)
  677. {
  678. case 0: {
  679. showmenu(id)
  680. }
  681. case 1: {
  682. showmenu2(id)
  683. }
  684. case 2: {
  685.  
  686. map_editor=id
  687. edit_g_team=g_team
  688. transfer_zones()
  689. zones_edit=zones
  690. if(zones>0) zone_editing=1
  691. show_all_zones()
  692. remove_task(TASK_ZONE)
  693. set_task(0.2, "show_all_zones", TASK_ZONE, _, _, "b")
  694. showmenu3(id)
  695. }
  696. }
  697. }
  698.  
  699. public ma_AntirushControlMenu(id) {} // bo z generatora amxx studio
  700. public mcb_AntirushControlMenu(id, menu, item) {} // i usuniecie nie daje dobrych efektow...
  701.  
  702. public transfer_zones(){
  703. for(new i=0;i<MAX_ZONES*6;i++){
  704. map_cors_edit[i]=map_cors_origin[i]
  705. }
  706. }
  707.  
  708. public showmenu(id)
  709. {
  710. new text[512]
  711. new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)
  712. new anti_on = get_cvar_num("amx_antirusher") //1
  713. new anti_immu = get_cvar_num("amx_antirusher_immunity") //2
  714. new Float: anti_time = get_cvar_float("amx_antirusher_time") //3
  715. new anti_warn = get_cvar_num("amx_antirusher_warn") //4
  716. new anti_sound = get_cvar_num("amx_antirusher_sound") //5
  717. new anti_sound_mode = get_cvar_num("amx_antirusher_sound_mode") //6
  718. new anti_zasady = get_cvar_num("amx_antirusher_zasady") //7
  719. new people = get_cvar_num("amx_antirusher_people") //8
  720. format(text, 511, "\yAntirush Menu - ^n\w1. amx_antirusher %i^n\w2. amx_antirusher_immunity %i^n\w3. amx_antirusher_time %.f^n\w4. amx_antirusher_warn %i^n\w5. amx_antirusher_sound %i^n\w6. amx_antirusher_sound_mode %i^n\w7. amx_antirusher_zasady %i^n\w8. amx_antirusher_people %i^n^n\w9. %L",anti_on, anti_immu, anti_time, anti_warn, anti_sound, anti_sound_mode,anti_zasady,people,LANG_SERVER,"EXIT")
  721.  
  722. show_menu(id, keys, text)
  723. return PLUGIN_HANDLED
  724. }
  725.  
  726.  
  727. public Antirush_menu(id, key)
  728. {
  729. switch(key)
  730. {
  731. case 0:{
  732. new anti_on = get_cvar_num("amx_antirusher")
  733. if (anti_on==0) set_cvar_num("amx_antirusher",1)
  734. else set_cvar_num("amx_antirusher",0)
  735. }
  736. case 1:{
  737. new anti_immu = get_cvar_num("amx_antirusher_immunity")
  738. if (anti_immu==0) set_cvar_num("amx_antirusher_immunity",1)
  739. else set_cvar_num("amx_antirusher_immunity",0)
  740. }
  741. case 2:{
  742. new Float: anti_time = get_cvar_float("amx_antirusher_time")
  743. if (anti_time < (get_cvar_float("mp_roundtime")*60.0)) anti_time += 5.0
  744. else anti_time= 10.0
  745. set_cvar_float("amx_antirusher_time",anti_time)
  746. }
  747. case 3:{
  748. new anti_warn = get_cvar_num("amx_antirusher_warn")
  749. if (anti_warn==0) set_cvar_num("amx_antirusher_warn",1)
  750. else set_cvar_num("amx_antirusher_warn",0)
  751. }
  752. case 4:{
  753. new anti_sound = get_cvar_num("amx_antirusher_sound")
  754. if (anti_sound==0) set_cvar_num("amx_antirusher_sound",1)
  755. else set_cvar_num("amx_antirusher_sound",0)
  756. }
  757. case 5:{
  758. new anti_sound_mode = get_cvar_num("amx_antirusher_sound_mode")
  759. if (anti_sound_mode==0) set_cvar_num("amx_antirusher_sound_mode",1)
  760. else set_cvar_num("amx_antirusher_sound_mode",0)
  761. }
  762. case 6:{
  763. new anti_zasady = get_cvar_num("amx_antirusher_zasady")
  764. if (anti_zasady==0) set_cvar_num("amx_antirusher_zasady",1)
  765. else set_cvar_num("amx_antirusher_zasady",0)
  766. }
  767. case 7:{
  768. new people = get_cvar_num("amx_antirusher_people")
  769. if (people<16) set_cvar_num("amx_antirusher_people",people+1)
  770. else set_cvar_num("amx_antirusher_people",0)
  771. }
  772. case 8:{
  773. menu_display(id, mAntirushControlMenu, 0)
  774. return PLUGIN_HANDLED
  775. }
  776. }
  777. showmenu(id)
  778. return PLUGIN_HANDLED
  779. }
  780.  
  781. public showmenu2(id)
  782. {
  783. new keys
  784. new text[512]
  785. new anti_action = get_cvar_num("amx_antirusher_action")
  786. new anti_cash = get_cvar_num("amx_antirusher_cash")*10
  787. new anti_cash_end = get_cvar_num("amx_antirusher_cash_end")
  788. new Float: anti_freq = get_cvar_float("amx_antirusher_freq")
  789. new anti_slap = get_cvar_num("amx_antirusher_slap")*10
  790.  
  791. switch(anti_action)
  792. {
  793. case 1:
  794. {
  795. format(text,511,"\yPunishment Menu - ^n\w1. amx_antirusher_action %i^n\w2. amx_antirusher_slap %i^n\w^n\w4. amx_antirusher_freq %.2f ^n\w ",anti_action,anti_slap,anti_freq)
  796. keys = (1<<0)|(1<<1)|(1<<3)|(1<<8)
  797. }
  798. case 10:
  799. {
  800. format(text,511,"\yPunishment Menu - ^n\w1. amx_antirusher_action %i^n\w2. amx_antirusher_cash %i^n\w3. amx_antirusher_cash_end %i^n\w4. amx_antirusher_freq %.2f^n\w ",anti_action, anti_cash, anti_cash_end,anti_freq)
  801. keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<8)
  802. }
  803. default:
  804. {
  805. format(text,511,"\yPunishment Menu - ^n\w1. amx_antirusher_action %i^n\w ^n\w ^n\w4. amx_antirusher_freq %.2f^n\w ",anti_action,anti_freq)
  806. keys = (1<<0)|(1<<3)|(1<<8)
  807. }
  808. }
  809. new text2[512]
  810. switch(anti_action)
  811. {
  812. case 0: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_WARN",LANG_SERVER,"EXIT")
  813. case 1: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_HP",LANG_SERVER,"EXIT")
  814. case 2: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_KILL",LANG_SERVER,"EXIT")
  815. case 3: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_KICK",LANG_SERVER,"EXIT")
  816. case 4: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_BAN",LANG_SERVER,"EXIT")
  817. case 5: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_SLOW",LANG_SERVER,"EXIT")
  818. case 6: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_BLIND",LANG_SERVER,"EXIT")
  819. case 7: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_FFILD",LANG_SERVER,"EXIT")
  820. case 8: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_OFIRE",LANG_SERVER,"EXIT")
  821. case 9: format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_BAIM",LANG_SERVER,"EXIT")
  822. case 10:format(text2,511, "^n\w %L ^n\w %L ^n\w9. %L",LANG_SERVER,"AR_ACTION_CASH",LANG_SERVER,"AR_ACTION_CASH2",LANG_SERVER,"EXIT")
  823. default:format(text2,511, "^n\w %L ^n\w ^n\w9. %L",LANG_SERVER,"AR_ACTION_NEW",LANG_SERVER,"EXIT")
  824. }
  825. add(text,511,text2)
  826. show_menu(id, keys, text)
  827. return PLUGIN_HANDLED
  828. }
  829.  
  830. public Punishment_menu(id, key)
  831. {
  832. new anti_action = get_cvar_num("amx_antirusher_action")
  833. switch(key)
  834. {
  835. case 0:
  836. {
  837. if(anti_action<10) anti_action +=1
  838. else anti_action=0
  839. set_cvar_num("amx_antirusher_action",anti_action)
  840. }
  841. case 1:
  842. {
  843. if(anti_action==1)
  844. {
  845. new anti_slap = get_cvar_num("amx_antirusher_slap")
  846. if(anti_slap<10) anti_slap +=1
  847. else anti_slap=0
  848. set_cvar_num("amx_antirusher_slap",anti_slap)
  849. }
  850. else if(anti_action==10)
  851. {
  852. new anti_cash = get_cvar_num("amx_antirusher_cash")
  853. if(anti_cash<100) anti_cash +=10
  854. else if(anti_cash<500) anti_cash +=25
  855. else anti_cash=0
  856. set_cvar_num("amx_antirusher_cash",anti_cash)
  857. }
  858. }
  859. case 2:
  860. {
  861. new anti_cash_end = get_cvar_num("amx_antirusher_cash_end")
  862. if(anti_cash_end<5) anti_cash_end +=1
  863. else anti_cash_end=0
  864. set_cvar_num("amx_antirusher_cash_end",anti_cash_end)
  865. }
  866. case 3:
  867. {
  868. new Float: anti_freq = get_cvar_float("amx_antirusher_freq")
  869. if(anti_freq<1.0) anti_freq +=0.100001 // ta jedynka na koncu bo zamiast wyswietalc 0.90000 wyswietlalo 0.89999 wiec dalem zaokraglenie do 0.xx i to na koniec :f
  870. else if (anti_freq<8.0) anti_freq +=0.5
  871. else anti_freq=0.1
  872. set_cvar_float("amx_antirusher_freq",anti_freq)
  873. }
  874. case 8:
  875. {
  876. menu_display(id, mAntirushControlMenu, 0)
  877. return PLUGIN_HANDLED
  878. }
  879. }
  880. showmenu2(id)
  881. return PLUGIN_HANDLED
  882. }
  883.  
  884. public showmenu3(id)
  885. {
  886. editign=0
  887. new text[512]
  888. new keys
  889. if(zones_edit==0){
  890. keys = (1<<0)|(1<<4)|(1<<6)|(1<<7)|(1<<8)
  891. format(text, 511, "\yAntirush Zone Creator - ^n^n\w%L: \r%i^n\w1.%L: %s ^n^n ^n^n^n\y5. %L ^n\r7. %L^n\w8. %L ^n\w9. %L",LANG_SERVER,"AR_ZONE_NUM",zones_edit,LANG_SERVER,"AR_ZONE_TEAM",edit_g_team,LANG_SERVER,"AR_ZONE_NEW",LANG_SERVER,"AR_ZONE_DEL",LANG_SERVER,"AR_ZONE_SAVE",LANG_SERVER,"EXIT")
  892. }
  893. else if(zones_edit>0){
  894. keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<6)|(1<<7)|(1<<8)
  895. format(text, 511, "\yAntirush Zone Creator - ^n^n\w%L: \r%i^n\w1.%L: %s ^n^n\w2. %L \r%i^n \w3. <- %L 4. -> %L^n^n\y5. %L ^n\r7. %L^n\w8. %L ^n\w9. %L",LANG_SERVER,"AR_ZONE_NUM",zones_edit,LANG_SERVER,"AR_ZONE_TEAM",edit_g_team,LANG_SERVER,"AR_ZONE_EDIT",zone_editing,LANG_SERVER,"BACK",LANG_SERVER,"MORE",LANG_SERVER,"AR_ZONE_NEW",LANG_SERVER,"AR_ZONE_DEL",LANG_SERVER,"AR_ZONE_SAVE",LANG_SERVER,"EXIT")
  896. }
  897.  
  898. show_menu(id, keys, text)
  899. return PLUGIN_HANDLED
  900. }
  901.  
  902.  
  903. public Antirush_Zone_Creator(id, key)
  904. {
  905. if(map_editor!=id){
  906. showmenu(id)
  907. return PLUGIN_HANDLED
  908. }
  909.  
  910. switch(key)
  911. {
  912. case 0:{
  913. if (equal(edit_g_team,"XX")) edit_g_team="CT"
  914. else if (equal(edit_g_team,"CT")) edit_g_team="T"
  915. else edit_g_team="XX"
  916. }
  917. case 1: {
  918. zone_incresment=10
  919. edit_zone(id)
  920. return PLUGIN_HANDLED
  921. }
  922. case 2:{
  923. if(zone_editing>1) zone_editing--
  924. }
  925. case 3:{
  926. if(zone_editing<zones_edit) zone_editing++
  927. }
  928. case 4:{
  929. if(zones_edit<(MAX_ZONES)){
  930. create_zone(id)
  931. zone_editing=zones_edit
  932. zone_incresment=10
  933. edit_zone(id)
  934. return PLUGIN_HANDLED
  935. }
  936. else{
  937. client_print(id, print_chat,"%L",LANG_SERVER,"AR_ZONE_MAX")
  938. }
  939. }
  940. case 6:{
  941. if(zone_editing>0){
  942. menu_display(id, mUsuwaniestrefy, 0)
  943. return PLUGIN_HANDLED
  944. }
  945. else client_print(id, print_chat,"%L",LANG_SERVER,"AR_ZONE_ZERO")
  946. }
  947.  
  948. case 7:{
  949. menu_display(id, mZapisacstrefy, 0)
  950. return PLUGIN_HANDLED
  951. }
  952. case 8:{
  953. amx_antirusher_menu(id)
  954. remove_task(TASK_ZONE)
  955. return PLUGIN_HANDLED
  956. }
  957. }
  958. showmenu3(id)
  959. return PLUGIN_HANDLED
  960. }
  961.  
  962. public create_zone(id){
  963. new origins[3]
  964. get_user_origin(id,origins,0)
  965. map_cors_edit[0+zones_edit*6]=origins[0]-32
  966. map_cors_edit[1+zones_edit*6]=origins[0]+32
  967. map_cors_edit[2+zones_edit*6]=origins[1]-32
  968. map_cors_edit[3+zones_edit*6]=origins[1]+32
  969. map_cors_edit[4+zones_edit*6]=origins[2]-32
  970. map_cors_edit[5+zones_edit*6]=origins[2]+32
  971. zones_edit++
  972. }
  973.  
  974.  
  975. public mh_Zapisacstrefy(id, menu, item) {
  976. if(item==0){
  977. remove_task(TASK_ZONE)
  978. amx_antirusher_menu(id)
  979. map_cors_origin=map_cors_edit
  980. zones=zones_edit
  981. g_team=edit_g_team
  982. if(zones>0) map_cors_pre=1
  983. else map_cors_pre=0
  984. write_to_file()
  985. }
  986. else if(item==1) showmenu3(id)
  987. }
  988.  
  989. public ma_Zapisacstrefy(id) {}
  990. public mcb_Zapisacstrefy(id, menu, item) {}
  991.  
  992.  
  993. public mh_Usuwaniestrefy(id, menu, item) {
  994. if(item==0){
  995. amx_antirusher_menu(id)
  996. delete_zone(zone_editing)
  997. if((zone_editing-1)>=(zones_edit-1)) zone_editing = zones_edit-1
  998. zones_edit--
  999. showmenu3(id)
  1000. }
  1001. else if(item==1) showmenu3(id)
  1002. }
  1003.  
  1004. public ma_Usuwaniestrefy(id) {}
  1005. public mcb_Usuwaniestrefy(id, menu, item) {}
  1006.  
  1007. public delete_zone(zone_num){
  1008. new x_num=zone_num-1
  1009. while(x_num<(MAX_ZONES-1)){
  1010. map_cors_edit[0+x_num*6]=map_cors_edit[6+x_num*6]
  1011. map_cors_edit[1+x_num*6]=map_cors_edit[7+x_num*6]
  1012. map_cors_edit[2+x_num*6]=map_cors_edit[8+x_num*6]
  1013. map_cors_edit[3+x_num*6]=map_cors_edit[9+x_num*6]
  1014. map_cors_edit[4+x_num*6]=map_cors_edit[10+x_num*6]
  1015. map_cors_edit[5+x_num*6]=map_cors_edit[11+x_num*6]
  1016. x_num++
  1017. }
  1018. }
  1019.  
  1020. public edit_zone(id){
  1021. editign=1
  1022. new text[512]
  1023. new keys= (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<6)|(1<<8)
  1024. format(text, 511, "\yEdit Zone - ^n^n\w1. %L: %s ^n\r 2.<- %L 3.-> %L^n\y 4.<- %L 5.-> %L^n ^n\w7. %L: %i ^n\w9. %L",LANG_SERVER,"AR_EDIT_COOR",zone_coords[zone_coords_num],LANG_SERVER,"BACK",LANG_SERVER,"MORE",LANG_SERVER,"BACK",LANG_SERVER,"MORE",LANG_SERVER,"AR_EDIT_CHANG",zone_incresment,LANG_SERVER,"EXIT")
  1025.  
  1026. show_menu(id, keys, text)
  1027. return PLUGIN_HANDLED
  1028. }
  1029.  
  1030. public edit_zone2(id, key){
  1031. switch(key){
  1032. case 0:{
  1033. if(zone_coords_num<2)zone_coords_num++
  1034. else zone_coords_num=0
  1035. }
  1036. case 1:{
  1037. if((map_cors_edit[zone_coords_num*2+(zone_editing-1)*6]+zone_incresment)<(map_cors_edit[zone_coords_num*2+(zone_editing-1)*6+1]-32)) map_cors_edit[zone_coords_num*2+(zone_editing-1)*6]+=zone_incresment
  1038. }
  1039. case 2:{
  1040. if((map_cors_edit[zone_coords_num*2+(zone_editing-1)*6]-zone_incresment)>-8191) map_cors_edit[zone_coords_num*2+(zone_editing-1)*6]-=zone_incresment
  1041. }
  1042. case 3:{
  1043. if((map_cors_edit[zone_coords_num*2+(zone_editing-1)*6+1]-zone_incresment)>(map_cors_edit[zone_coords_num*2+(zone_editing-1)*6]+32)) map_cors_edit[zone_coords_num*2+(zone_editing-1)*6+1]-=zone_incresment
  1044. }
  1045. case 4:{
  1046. if((map_cors_edit[zone_coords_num*2+(zone_editing-1)*6+1]+zone_incresment)<8191) map_cors_edit[zone_coords_num*2+(zone_editing-1)*6+1]+=zone_incresment
  1047. }
  1048. case 6:{
  1049. if(zone_incresment<1000)zone_incresment*=10
  1050. else zone_incresment=1
  1051. }
  1052. case 8:{
  1053. showmenu3(id)
  1054. return PLUGIN_HANDLED
  1055. }
  1056. }
  1057. edit_zone(id)
  1058. return PLUGIN_HANDLED
  1059. }
  1060.  
  1061. //////////////////////////////////////////////////////////////////////////
  1062. ///////// M_Antirusher Draw Lines /////////
  1063. //////////////////////////////////////////////////////////////////////////
  1064.  
  1065. public FX_Line(start[3], stop[3], color[3], brightness, id) {
  1066. message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
  1067.  
  1068. write_byte( TE_BEAMPOINTS )
  1069.  
  1070. write_coord(start[0])
  1071. write_coord(start[1])
  1072. write_coord(start[2])
  1073.  
  1074. write_coord(stop[0])
  1075. write_coord(stop[1])
  1076. write_coord(stop[2])
  1077.  
  1078. write_short( spr_dot )
  1079.  
  1080. write_byte( 1 ) // framestart
  1081. write_byte( 1 ) // framerate
  1082. write_byte( 4 ) // life in 0.1's
  1083. write_byte( 5 ) // width
  1084. write_byte( 0 ) // noise
  1085.  
  1086. write_byte( color[0] ) // r, g, b
  1087. write_byte( color[1] ) // r, g, b
  1088. write_byte( color[2] ) // r, g, b
  1089.  
  1090. write_byte( brightness ) // brightness
  1091. write_byte( 0 ) // speed
  1092.  
  1093. message_end()
  1094. }
  1095.  
  1096. public DrawLine(x1, y1, z1, x2, y2, z2, color[3],id) {
  1097. new start[3]
  1098. new stop[3]
  1099.  
  1100. start[0] = ( x1 )
  1101. start[1] = ( y1 )
  1102. start[2] = ( z1 )
  1103.  
  1104. stop[0] = ( x2 )
  1105. stop[1] = ( y2 )
  1106. stop[2] = ( z2 )
  1107.  
  1108. FX_Line(start, stop, color, 200, id)
  1109. }
  1110.  
  1111. public ar_zone(zone_num,id){
  1112. new start[3],stop[3]
  1113. new xyz=0
  1114. if(zone_editing==zone_num) xyz=1
  1115.  
  1116. zone_num=(zone_num-1)*6
  1117.  
  1118. start[0]= map_cors_edit[0+zone_num]
  1119. start[1]= map_cors_edit[2+zone_num]
  1120. start[2]= map_cors_edit[4+zone_num]
  1121.  
  1122. stop[0]= map_cors_edit[1+zone_num]
  1123. stop[1]= map_cors_edit[3+zone_num]
  1124. stop[2]= map_cors_edit[5+zone_num]
  1125.  
  1126. ShowZoneBox(start, stop, id,xyz)
  1127. }
  1128.  
  1129. public ShowZoneBox(mins[3], maxs[3], id,xyz) {
  1130.  
  1131. DrawLine(maxs[0], maxs[1], maxs[2], mins[0], maxs[1], maxs[2], zone_color_aktiv, id)
  1132. DrawLine(maxs[0], maxs[1], maxs[2], maxs[0], mins[1], maxs[2], zone_color_aktiv, id)
  1133. DrawLine(maxs[0], maxs[1], maxs[2], maxs[0], maxs[1], mins[2], zone_color_aktiv, id)
  1134.  
  1135. DrawLine(mins[0], mins[1], mins[2], maxs[0], mins[1], mins[2], zone_color_aktiv, id)
  1136. DrawLine(mins[0], mins[1], mins[2], mins[0], maxs[1], mins[2], zone_color_aktiv, id)
  1137. DrawLine(mins[0], mins[1], mins[2], mins[0], mins[1], maxs[2], zone_color_aktiv, id)
  1138.  
  1139. DrawLine(mins[0], maxs[1], maxs[2], mins[0], maxs[1], mins[2], zone_color_aktiv, id)
  1140. DrawLine(mins[0], maxs[1], mins[2], maxs[0], maxs[1], mins[2], zone_color_aktiv, id)
  1141. DrawLine(maxs[0], maxs[1], mins[2], maxs[0], mins[1], mins[2], zone_color_aktiv, id)
  1142. DrawLine(maxs[0], mins[1], mins[2], maxs[0], mins[1], maxs[2], zone_color_aktiv, id)
  1143. DrawLine(maxs[0], mins[1], maxs[2], mins[0], mins[1], maxs[2], zone_color_aktiv, id)
  1144. DrawLine(mins[0], mins[1], maxs[2], mins[0], maxs[1], maxs[2], zone_color_aktiv, id)
  1145.  
  1146. if((xyz==1)&&(editign==1)){
  1147. if(zone_coords_num==0){
  1148. DrawLine(maxs[0], maxs[1], maxs[2], maxs[0], mins[1], mins[2], zone_color_yellow, id)
  1149. DrawLine(maxs[0], maxs[1], mins[2], maxs[0], mins[1], maxs[2], zone_color_yellow, id)
  1150. DrawLine(mins[0], maxs[1], maxs[2], mins[0], mins[1], mins[2], zone_color_red, id)
  1151. DrawLine(mins[0], maxs[1], mins[2], mins[0], mins[1], maxs[2], zone_color_red, id)
  1152. }
  1153. else if( zone_coords_num==1){
  1154. DrawLine(mins[0], mins[1], mins[2], maxs[0], mins[1], maxs[2], zone_color_red, id)
  1155. DrawLine(maxs[0], mins[1], mins[2], mins[0], mins[1], maxs[2], zone_color_red, id)
  1156. DrawLine(mins[0], maxs[1], mins[2], maxs[0], maxs[1], maxs[2], zone_color_yellow, id)
  1157. DrawLine(maxs[0], maxs[1], mins[2], mins[0], maxs[1], maxs[2], zone_color_yellow, id)
  1158. }
  1159. else{
  1160. DrawLine(maxs[0], maxs[1], maxs[2], mins[0], mins[1], maxs[2], zone_color_yellow, id)
  1161. DrawLine(maxs[0], mins[1], maxs[2], mins[0], maxs[1], maxs[2], zone_color_yellow, id)
  1162. DrawLine(maxs[0], maxs[1], mins[2], mins[0], mins[1], mins[2], zone_color_red, id)
  1163. DrawLine(maxs[0], mins[1], mins[2], mins[0], maxs[1], mins[2], zone_color_red, id)
  1164. }
  1165. }
  1166. }
  1167.  
  1168. public show_all_zones(){
  1169. new num=1
  1170. while(num<=zones_edit){
  1171. ar_zone(num,map_editor)
  1172. num++
  1173. }
  1174. if(zone_editing>0){
  1175. new origins[3], origins2[3]
  1176. get_user_origin(map_editor,origins)
  1177. new Float: range_line
  1178. new Float: range_origins[6]
  1179. for(new i=0;i<6;i++) range_origins[i] = (map_cors_edit[i+6*(zone_editing-1)])*1.0
  1180. range_line= floatsqroot(((range_origins[1]-range_origins[0])/2.0-origins[0])*((range_origins[1]-range_origins[0])/2.0-origins[0])+((range_origins[3]-range_origins[2])/2.0-origins[1])*((range_origins[3]-range_origins[2])/2.0-origins[1])+((range_origins[5]-range_origins[4])/2.0-origins[2])*((range_origins[5]-range_origins[4])/2.0-origins[2]))
  1181. if(range_line>20000) for(new i=0;i<3;i++){
  1182. origins2[i]=((map_cors_edit[i*2+6*(zone_editing-1)] + map_cors_edit[i*2+1+6*(zone_editing-1)])/2)/6
  1183. }
  1184. else if(range_line>15000) for(new i=0;i<3;i++){
  1185. origins2[i]=((map_cors_edit[i*2+6*(zone_editing-1)] + map_cors_edit[i*2+1+6*(zone_editing-1)])/2)/5
  1186. }
  1187. else if(range_line>10000) for(new i=0;i<3;i++){
  1188. origins2[i]=((map_cors_edit[i*2+6*(zone_editing-1)] + map_cors_edit[i*2+1+6*(zone_editing-1)])/2)/3
  1189. }
  1190. else for(new i=0;i<3;i++){
  1191. origins2[i]=((map_cors_edit[i*2+6*(zone_editing-1)] + map_cors_edit[i*2+1+6*(zone_editing-1)])/2)
  1192. }
  1193. FX_Line(origins, origins2, zone_color_red,200,map_editor)
  1194. }
  1195. }
  1196.  
  1197. public zone_warn(id,zone,direction,origins[3]){
  1198. new start[3],stop[3]
  1199. start[2]=origins[2]-110
  1200. stop[2]=origins[2]-110
  1201.  
  1202. switch(direction){
  1203. case 0:{
  1204. start[0]=map_cors_origin[zone*6]+5
  1205. stop[0]=map_cors_origin[zone*6]+5
  1206. start[1]=map_cors_origin[zone*6+2]
  1207. stop[1]=map_cors_origin[zone*6+3]
  1208. }
  1209. case 1:{
  1210. start[0]=map_cors_origin[zone*6+1]-5
  1211. stop[0]=map_cors_origin[zone*6+1]-5
  1212. start[1]=map_cors_origin[zone*6+2]
  1213. stop[1]=map_cors_origin[zone*6+3]
  1214. }
  1215. case 2:{
  1216. start[0]=map_cors_origin[zone*6+0]
  1217. stop[0]=map_cors_origin[zone*6+1]
  1218. start[1]=map_cors_origin[zone*6+2]+5
  1219. stop[1]=map_cors_origin[zone*6+2]+5
  1220. }
  1221. case 3:{
  1222. start[0]=map_cors_origin[zone*6+0]
  1223. stop[0]=map_cors_origin[zone*6+1]
  1224. start[1]=map_cors_origin[zone*6+3]-5
  1225. stop[1]=map_cors_origin[zone*6+3]-5
  1226. }
  1227. }
  1228. for(new i=0;i<9;i++){
  1229. start[2]+=30
  1230. stop[2]+=30
  1231. FX_Line(start, stop, zone_color_red, 60, id)
  1232. }
  1233. }
  1234.  
  1235. ///////////////////////////////////////////////////////////////////////////
  1236. ///////// M_Antirusher Save to file /////////
  1237. ///////////////////////////////////////////////////////////////////////////
  1238.  
  1239. public write_to_file(){
  1240. new text[512],text2[64]
  1241. new currentmap[32]
  1242. get_mapname(currentmap,31)
  1243. format(text,511,"%s %s ", g_team, currentmap)
  1244. new x0[6],x1[6],y0[6],y1[6],z0[6],z1[6]
  1245. for(new i=0;i<zones;i++){
  1246. num_to_str(map_cors_origin[0+i*6],x0,5)
  1247. num_to_str(map_cors_origin[1+i*6],x1,5)
  1248. num_to_str(map_cors_origin[2+i*6],y0,5)
  1249. num_to_str(map_cors_origin[3+i*6],y1,5)
  1250. num_to_str(map_cors_origin[4+i*6],z0,5)
  1251. num_to_str(map_cors_origin[5+i*6],z1,5)
  1252. format(text2,63,"%s %s %s %s %s %s ",x0,x1,y0,y1,z0,z1)
  1253. add(text,511,text2)
  1254. }
  1255.  
  1256. if(is_linux_server()){
  1257. new zonefile[256]
  1258. get_configsdir(zonefile, 255)
  1259. format(zonefile, 255, "%s/antirusher/rush.cor", zonefile)
  1260. if((write_file ( zonefile, text, map_cors_file_line ))==0) log_amx("<<Blad przy nadpisywaniu rush.cor>>")
  1261. }
  1262. else{
  1263. if((write_file ( "addons\amxmodx\configs\antirusher\rush.cor", text, map_cors_file_line ))==0) log_amx("<<Blad przy nadpisywaniu rush.cor>>")
  1264. }
  1265. }
  1266. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  1267. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  1268. */
  1269.