hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.05. 23:40



Jelenlévő felhasználók

Jelenleg 518 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 517 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: Majestic-12 [Bot] az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 1 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: plugin használata csak ctknek
HozzászólásElküldve: 2012.12.02. 13:36 
Offline
Tag
Avatar

Csatlakozott: 2012.10.17. 18:00
Hozzászólások: 48
Megköszönt másnak: 31 alkalommal
Megköszönték neki: 1 alkalommal
Sziasztok, ezt át tudná nekem valaki irni olyanra hogy csak ct-k használhatják?
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4.  
  5. #define PLUGNAME "plugin_trail"
  6. #define VERSION "1.3.1"
  7. #define AUTHOR "Bahrmanou"
  8.  
  9. #define ACCESS_LEVEL ADMIN_LEVEL_A
  10. #define ACCESS_ADMIN ADMIN_ADMIN
  11.  
  12. #define MAX_TEXT_LENGTH 200
  13. #define MAX_NAME_LENGTH 40
  14. #define MAX_PLAYERS 32
  15. #define MAX_DISTANCE 300
  16.  
  17. #define CFG_FILE "colors.cfg"
  18. #define MAX_COLORS 200
  19.  
  20. #define DEF_TRAIL_LIFE 2
  21.  
  22. #define TASKID 1337 // change if it interfere with another plugin!
  23. #define TICK 0.1
  24.  
  25. #define NUM_SPRITES 12
  26.  
  27. new bool:gl_parsed
  28. new bool:gl_trail
  29. new bool:gl_not_this_map
  30.  
  31. new gl_trail_life
  32. new gl_trail_size[MAX_PLAYERS]
  33. new gl_trail_brightness[MAX_PLAYERS]
  34. new gl_trail_type[MAX_PLAYERS]
  35.  
  36. new gl_sprite_name[NUM_SPRITES][] = {
  37. "sprites/laserbeam.spr",
  38. "sprites/blueflare1.spr",
  39. "sprites/dot.spr",
  40. "sprites/flare5.spr",
  41. "sprites/flare6.spr",
  42. "sprites/plasma.spr",
  43. "sprites/smoke.spr",
  44. "sprites/xbeam5.spr",
  45. "sprites/xenobeam.spr",
  46. "sprites/xssmke1.spr",
  47. "sprites/zbeam3.spr",
  48. "sprites/zbeam2.spr"
  49. }
  50. new gl_sprite[NUM_SPRITES]
  51. new gl_def_sprite_size[NUM_SPRITES] = {
  52. 5, 12, 4, 16, 16, 6, 9, 4, 15, 14, 15, 20
  53. }
  54. new gl_def_sprite_brightness[NUM_SPRITES] = {
  55. 160, 255, 200, 255, 255, 230, 150, 150, 240, 220, 200, 200
  56. }
  57.  
  58. new gl_players[MAX_PLAYERS]
  59.  
  60. new gl_player_position[MAX_PLAYERS][3]
  61. new gl_timer_count[MAX_PLAYERS]
  62. new gl_timer_limit
  63.  
  64. new gl_player_colors[MAX_PLAYERS][3]
  65. new gl_color_names[MAX_COLORS][MAX_NAME_LENGTH]
  66. new gl_colors[MAX_COLORS][3]
  67. new gl_num_colors
  68.  
  69. public plugin_init() {
  70. register_plugin(PLUGNAME, VERSION, AUTHOR)
  71. register_concmd("amx_trail","cmdTrail", ACCESS_LEVEL, "- ['on'|'off'|'1'|'0'] : enable/disable trails.")
  72. register_concmd("amx_trail_user","cmdUserTrail", ACCESS_LEVEL, "- <name or #userid> <colorname | 'random' | 'off'> : set user trail.")
  73. register_concmd("amx_trail_type", "cmdTrailType", ACCESS_LEVEL, "- <type> : set trail type for all players.")
  74. register_concmd("amx_trail_life","cmdTrailLife", ACCESS_LEVEL, "- [duration] : get/set trail duration, in seconds.")
  75. register_concmd("amx_trail_size","cmdTrailSize", ACCESS_LEVEL, "- [size] : get/set trail size.")
  76. register_concmd("amx_trail_brightness","cmdTrailBrightness", ACCESS_LEVEL, "- [brightness] : get/set trail brightness.")
  77. register_concmd("amx_trail_reload", "cmdReload", ACCESS_LEVEL, ": reload colors configuration file.")
  78. register_clcmd("say", "SayCmd", 0, "")
  79.  
  80. gl_parsed = gl_trail = parse_file()
  81. if (!gl_sprite[0]) gl_trail = false
  82.  
  83. gl_trail_life = DEF_TRAIL_LIFE
  84. gl_timer_limit = floatround(float(gl_trail_life)/TICK)
  85. }
  86.  
  87. public plugin_modules() {
  88. require_module("engine")
  89. }
  90.  
  91. public plugin_precache() {
  92. if (check_map()) {
  93. gl_not_this_map = true
  94. return
  95. }
  96.  
  97. for (new i=0; i<NUM_SPRITES; i++) {
  98. gl_sprite[i] = precache_model(gl_sprite_name[i])
  99. }
  100. }
  101.  
  102. public client_putinserver(id) {
  103. gl_trail_type[id] = gl_sprite[0]
  104. gl_trail_size[id] = gl_def_sprite_size[0]
  105. gl_trail_brightness[id] = gl_def_sprite_brightness[0]
  106. }
  107.  
  108. public client_disconnect(id) {
  109. if (task_exists(TASKID+id)) remove_task(TASKID+id)
  110. gl_player_colors[id][0] = gl_player_colors[id][1] = gl_player_colors[id][2] = 0
  111. }
  112.  
  113. /*****************************************************************************************
  114.  *
  115.  * cmdTrail ['on'|'off'|'1'|'0'] : enable/disable trails.
  116.  *
  117.  *****************************************************************************************/
  118. public cmdTrail(id, level, cid) {
  119. if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED
  120.  
  121. if (!gl_parsed) {
  122. console_print(id, "A Trail-ok kivannak kapcsolva,nem lehet beolvasni '%s'!", CFG_FILE)
  123. return PLUGIN_HANDLED
  124. }
  125. if (gl_not_this_map) {
  126. console_print(id, "Trail-ok le vannak tiltva ezen a mapon!")
  127. return PLUGIN_HANDLED
  128. }
  129.  
  130. new str[5]
  131. read_argv(1, str, 4)
  132. if (equali(str, "on") || equali(str, "1")) {
  133. if (gl_trail) {
  134. console_print(id, "Trail-ok mar engedelyezve vannak.")
  135. } else {
  136. gl_trail = true
  137. console_print(id, "Trail-ok most engedelyezve.")
  138. }
  139. } else if (equali(str, "off") || equali(str, "0")) {
  140. if (!gl_trail) {
  141. console_print(id, "Trail-ok mar levannak tiltva.")
  142. }else {
  143. gl_trail = false
  144. new playercount
  145. get_players(gl_players, playercount)
  146. for (new i=0; i<playercount; i++) {
  147. kill_trail_task(gl_players[i])
  148. }
  149. say_to_all("Your trail has been removed.", id)
  150. console_print(id, "Trails are now DISABLED.")
  151. }
  152. } else {
  153. if (gl_trail) {
  154. console_print(id, "Trail engedelyezett.")
  155. } else {
  156. console_print(id, "Trail tiltva.")
  157. }
  158. }
  159.  
  160. return PLUGIN_HANDLED
  161. }
  162.  
  163. /*****************************************************************************************
  164.  *
  165.  * cmdUserTrail <name or #userid> <colorname | 'random' | 'off'> : set user trail.
  166.  *
  167.  *****************************************************************************************/
  168. public cmdUserTrail(id, level, cid) {
  169. if (!cmd_access(id, level, cid, 3)) return PLUGIN_HANDLED
  170.  
  171. if (!gl_parsed) {
  172. console_print(id, "A Trail-ok kivannak kapcsolva, vagy nem lehet beolvasni '%s'!", CFG_FILE)
  173. return PLUGIN_HANDLED
  174. }
  175. if (gl_not_this_map) {
  176. console_print(id, "Trail-ok nem hasznalhatoak ezen a mapon!")
  177. return PLUGIN_HANDLED
  178. }
  179.  
  180. new user[MAX_NAME_LENGTH+1], colorname[MAX_NAME_LENGTH]
  181. new plName[MAX_NAME_LENGTH+1]
  182.  
  183. read_argv(1, user, MAX_NAME_LENGTH)
  184. read_argv(2, colorname, MAX_NAME_LENGTH-1)
  185.  
  186. new player = cmd_target(id, user, 6)
  187. if (!player) {
  188. console_print(id, "Ismeretlen jatekos: %s", user)
  189. return PLUGIN_HANDLED
  190. }
  191. get_user_name(player, plName, MAX_NAME_LENGTH)
  192. if (access(player, ADMIN_IMMUNITY) && id!=player) {
  193. console_print(id, "Ilyen szin nincs %s, te buta!", plName)
  194. return PLUGIN_HANDLED
  195. }
  196. if (!is_user_alive(player)) {
  197. console_print(id, "Csak elo jatekosok hasznalhatjak!")
  198. return PLUGIN_HANDLED
  199. }
  200.  
  201. if (equali(colorname, "off")) {
  202. if (!gl_player_colors[player][0] && !gl_player_colors[player][1] && !gl_player_colors[player][2]) {
  203. console_print(id, "%s's szinu nincs!", plName)
  204. return PLUGIN_HANDLED
  205. }
  206. kill_trail_task(player)
  207. console_print(id, "A %s's szin torolve.", plName)
  208. client_print(player, print_chat, "Te torolted a trail-od.")
  209. } else if (equali(colorname, "random")) {
  210. do_trail(player, "", "")
  211. console_print(id, "%s most egy veletlenszeru szint valaszottal.", plName)
  212. } else {
  213. do_trail(player, colorname, "")
  214. console_print(id, "%s mostmar %s trail-t hasznal.", plName, colorname)
  215. }
  216.  
  217. return PLUGIN_HANDLED
  218. }
  219.  
  220. /*****************************************************************************************
  221.  *
  222.  * cmdTrailType <type> : set trail type (sprite) for all players
  223.  *
  224.  *****************************************************************************************/
  225. public cmdTrailType(id, level, cid) {
  226. if (!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED
  227.  
  228. if (!gl_parsed) {
  229. console_print(id, "A Trail-ok kivannak kapcsolva, vagy nem lehet beolvasni '%s'!", CFG_FILE)
  230. return PLUGIN_HANDLED
  231. }
  232. if (gl_not_this_map) {
  233. console_print(id, "Trail-ok nem hasznalhatoak ezen a mapon!")
  234. return PLUGIN_HANDLED
  235. }
  236.  
  237. new str[5], type
  238. read_argv(1, str, 4)
  239. type = str_to_num(str)
  240. if (type<1 || type>NUM_SPRITES) {
  241. console_print(id, "Szamok [1,%d] -ig!", NUM_SPRITES)
  242. return PLUGIN_HANDLED
  243. }
  244. for (new i=0; i<MAX_PLAYERS; i++) {
  245. gl_trail_type[i] = gl_sprite[type-1]
  246. gl_trail_size[i] = gl_def_sprite_size[type-1]
  247. gl_trail_brightness[i] = gl_def_sprite_brightness[type-1]
  248. }
  249. restart_player_trail(id)
  250. return PLUGIN_HANDLED
  251. }
  252.  
  253. /*****************************************************************************************
  254.  *
  255.  * cmdTrailLife [duration] : get/set trail duration, in seconds.
  256.  *
  257.  *****************************************************************************************/
  258. public cmdTrailLife(id, level, cid) {
  259. if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED
  260.  
  261. if (!gl_parsed) {
  262. console_print(id, "A Trail-ok kivannak kapcsolva, vagy nem lehet beolvasni '%s !", CFG_FILE)
  263. return PLUGIN_HANDLED
  264. }
  265. if (gl_not_this_map) {
  266. console_print(id, "Trail-ok nem hasznalhatoak ezen a mapon!")
  267. return PLUGIN_HANDLED
  268. }
  269.  
  270. new Str[3], life
  271.  
  272. read_argv(1, Str, 2)
  273. if (!Str[0]) {
  274. console_print(id, "Trail life is currently %d seconds.", gl_trail_life)
  275. return PLUGIN_HANDLED
  276. }
  277. life = str_to_num(Str)
  278. if (life<1 || life>30) {
  279. console_print(id, "Trail life must be in [1,30] range!")
  280. return PLUGIN_HANDLED
  281. }
  282. gl_trail_life = life
  283. gl_timer_limit = floatround(float(life)/TICK)
  284. restart_players_trails()
  285.  
  286. return PLUGIN_HANDLED
  287. }
  288.  
  289. /*****************************************************************************************
  290.  *
  291.  * cmdTrailSize [size] : get/set trail size.
  292.  *
  293.  *****************************************************************************************/
  294. public cmdTrailSize(id, level, cid) {
  295. if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED
  296.  
  297. if (!gl_parsed) {
  298. console_print(id, "Trails are OFF because I couldn't read the config file '%s'!", CFG_FILE)
  299. return PLUGIN_HANDLED
  300. }
  301. if (gl_not_this_map) {
  302. console_print(id, "Trail-ok nem hasznalhatoak ezen a mapon!")
  303. return PLUGIN_HANDLED
  304. }
  305.  
  306. new Str[3], size
  307.  
  308. read_argv(1, Str, 2)
  309. if (!Str[0]) {
  310. console_print(id, "Your trail size is currently %d.", gl_trail_size[id])
  311. return PLUGIN_HANDLED
  312. }
  313. size = str_to_num(Str)
  314. if (size<1) {
  315. console_print(id, "Trail size must be positive!")
  316. return PLUGIN_HANDLED
  317. }
  318. gl_trail_size[id] = size
  319. restart_player_trail(id)
  320.  
  321. return PLUGIN_HANDLED
  322. }
  323.  
  324. /*****************************************************************************************
  325.  *
  326.  * cmdTrailBrightness [brightness] : get/set trail brightness.
  327.  *
  328.  *****************************************************************************************/
  329. public cmdTrailBrightness(id, level, cid) {
  330. if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED
  331.  
  332. if (!gl_parsed) {
  333. console_print(id, "Trails are OFF because I couldn't read the config file '%s'!", CFG_FILE)
  334. return PLUGIN_HANDLED
  335. }
  336. if (gl_not_this_map) {
  337. console_print(id, "Trail-ok nem hasznalhatoak ezen a mapon!")
  338. return PLUGIN_HANDLED
  339. }
  340.  
  341. new Str[3], bright
  342.  
  343. read_argv(1, Str, 3)
  344. if (!Str[0]) {
  345. console_print(id, "Your trail brightness is currently %d.", gl_trail_brightness[id])
  346. return PLUGIN_HANDLED
  347. }
  348. bright = str_to_num(Str)
  349. if (bright<1 || bright>255) {
  350. console_print(id, "Brightness must be in [1,255] range!")
  351. return PLUGIN_HANDLED
  352. }
  353. gl_trail_brightness[id] = bright
  354. restart_player_trail(id)
  355.  
  356. return PLUGIN_HANDLED
  357. }
  358.  
  359. /*****************************************************************************************
  360.  *
  361.  * cmdReload : reload configuration file.
  362.  *
  363.  *****************************************************************************************/
  364. public cmdReload(id, level, cid) {
  365. if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED
  366.  
  367. if (gl_not_this_map) {
  368. console_print(id, "Trails are disabled for this map!")
  369. return PLUGIN_HANDLED
  370. }
  371.  
  372. gl_parsed = parse_file()
  373.  
  374. if (gl_parsed) {
  375. console_print(id, "Ok, configuration file successfuly reloaded.")
  376. } else {
  377. console_print(id, "Uh Oh...There was a problem! Please check your amx log file to know whats causing this.")
  378. }
  379. return PLUGIN_HANDLED
  380. }
  381.  
  382. /*****************************************************************************************
  383.  *
  384.  * sayCmd : say trail <[['light'|'dark'] colorname] | ['random'] | ['off'] | ['help']>
  385.  *
  386.  *****************************************************************************************/
  387. public SayCmd(id, level, cid) {
  388. new args[128], msg[200], plName[MAX_NAME_LENGTH], colname[MAX_NAME_LENGTH], arg2[MAX_NAME_LENGTH], arg3[MAX_NAME_LENGTH], typenum
  389.  
  390. read_args(args, 128)
  391. remove_quotes(args)
  392.  
  393. if (equali(args, "trail", 5)) {
  394. if (!gl_trail) {
  395. client_print(id, print_chat, "Trail-ok levannak tiltva.")
  396. return PLUGIN_HANDLED
  397. }
  398. if (gl_not_this_map) {
  399. client_print(id, print_chat, "Trail-ok nem hasznalhatoak ezen a mapon!")
  400. return PLUGIN_HANDLED
  401. }
  402.  
  403. get_user_name(id, plName, MAX_NAME_LENGTH)
  404. if (!get_user_team(id) && !access(id, ADMIN_ADMIN)) {
  405. client_print(id, print_chat, "Neked muszaj jatszanod!")
  406. return PLUGIN_HANDLED
  407. }
  408.  
  409. if (!args[5]) {
  410. do_trail(id, "", "")
  411. return PLUGIN_HANDLED
  412. } else {
  413. parse(args[6], colname, MAX_NAME_LENGTH, arg2, MAX_NAME_LENGTH, arg3, MAX_NAME_LENGTH)
  414. // console_print(id, "restline = '%s'", restline)
  415. typenum = str_to_num(colname)
  416. }
  417.  
  418. if (equali(colname, "off")) {
  419. if (!gl_player_colors[id][0] && !gl_player_colors[id][1] && !gl_player_colors[id][2]) {
  420. client_print(id, print_chat, "Trail-od ki van kapcsolva!")
  421. return PLUGIN_HANDLED
  422. }
  423. kill_trail_task(id)
  424. client_print(id, print_chat, "A te trail-od torolve.")
  425. format(msg, 199, "%s's trail eltavolitva.", plName)
  426. say_to_all(msg, id)
  427. return PLUGIN_HANDLED
  428. } else if (equali(colname, "random")) {
  429. do_trail(id, "", "")
  430. return PLUGIN_HANDLED
  431. } else if (equali(colname, "help")) {
  432. trail_help(id)
  433. return PLUGIN_HANDLED
  434. }
  435.  
  436. if (typenum) {
  437. if (typenum<1 || typenum>NUM_SPRITES) {
  438. client_print(id, print_chat, "Ird be a tartomanyt [1,%d].", NUM_SPRITES)
  439. return PLUGIN_HANDLED
  440. }
  441. typenum--
  442. gl_trail_type[id] = gl_sprite[typenum]
  443. gl_trail_size[id] = gl_def_sprite_size[typenum]
  444. gl_trail_brightness[id] = gl_def_sprite_brightness[typenum]
  445. if (arg2[0]) {
  446. colname = arg2
  447. arg2 = arg3
  448. } else {
  449. if (!gl_player_colors[id][0] && !gl_player_colors[id][1] && !gl_player_colors[id][2]) {
  450. do_trail(id, "", "")
  451. return PLUGIN_HANDLED
  452. }
  453. new r = gl_player_colors[id][0]
  454. new g = gl_player_colors[id][1]
  455. new b = gl_player_colors[id][2]
  456. kill_trail_task(id)
  457. gl_player_colors[id][0] = r
  458. gl_player_colors[id][1] = g
  459. gl_player_colors[id][2] = b
  460. get_user_origin(id, gl_player_position[id])
  461. set_task(TICK, "check_position", TASKID+id, "", 0, "b")
  462. trail_msg(id)
  463. client_print(id, print_chat, "Van egy trail tipp %d.", typenum+1)
  464. format(msg, 199, "%s -nek van most %d trail-ja.", plName, typenum+1)
  465. say_to_all(msg, id)
  466. return PLUGIN_HANDLED
  467. }
  468. }
  469.  
  470. if (equali(colname, "dark")) {
  471. copy(colname, MAX_NAME_LENGTH-1, arg2)
  472. if (!colname[0]) {
  473. client_print(id, print_chat, "Adja meg a szin nevet!")
  474. return PLUGIN_HANDLED
  475. }
  476. do_trail(id, colname, "dark")
  477. } else if (equali(colname, "light")) {
  478. copy(colname, MAX_NAME_LENGTH-1, arg2)
  479. if (!colname[0]) {
  480. client_print(id, print_chat, "Adja meg a szin nevet!")
  481. return PLUGIN_HANDLED
  482. }
  483. do_trail(id, colname, "light")
  484. }
  485. else {
  486. do_trail(id, colname, "")
  487. }
  488. }
  489. return PLUGIN_CONTINUE
  490. }
  491.  
  492. /*****************************************************************************************
  493.  *****************************************************************************************/
  494. do_trail(id, colname[], intensity[]) {
  495. new i, msg[200]
  496. new name[33]
  497.  
  498. get_user_name(id, name, 32)
  499. if (!colname[0]) {
  500. kill_trail_task(id)
  501. gl_player_colors[id][0] = random(256)
  502. gl_player_colors[id][1] = random(256)
  503. gl_player_colors[id][2] = random(256)
  504. get_user_origin(id, gl_player_position[id])
  505. set_task(TICK, "check_position", TASKID+id, "", 0, "b")
  506. trail_msg(id)
  507. client_print(id, print_chat, "Van egy veletlenszeru szined.")
  508. format(msg, 199, "%s egy veletlenszeru szint valaszott.", name)
  509. say_to_all(msg, id)
  510. return
  511. }
  512. for (i=0; i<gl_num_colors; i++) {
  513. if (equali(colname, gl_color_names[i])) {
  514. new Float:intens, r, g, b
  515. if (equali(intensity, "dark")) {
  516. intens = 0.5
  517. } else if (equali(intensity, "light")) {
  518. intens = 2.0
  519. } else {
  520. copy(intensity, 1, "")
  521. intens = 1.0
  522. }
  523. kill_trail_task(id)
  524. r = floatround(float(gl_colors[i][0]) * intens)
  525. g = floatround(float(gl_colors[i][1]) * intens)
  526. b = floatround(float(gl_colors[i][2]) * intens)
  527. gl_player_colors[id][0] = min(r, 255)
  528. gl_player_colors[id][1] = min(g, 255)
  529. gl_player_colors[id][2] = min(b, 255)
  530. get_user_origin(id, gl_player_position[id])
  531. set_task(TICK, "check_position", TASKID+id, "", 0, "b")
  532. trail_msg(id)
  533. if (intensity[0]) {
  534. client_print(id, print_chat, "Neked van egy %s %s trail-od.", intensity, colname)
  535. format(msg, 199, "%s most egy %s %s szinu.", name, intensity, colname)
  536. } else {
  537. client_print(id, print_chat, "Neked van egy %s trail-od.", colname)
  538. format(msg, 199, "%s most egy %s %s szinu.", name, colname)
  539. }
  540. say_to_all(msg, id)
  541. return
  542. }
  543. }
  544. client_print(id, print_chat, "Sajnalom, %s, de nincs ilyen szinu '%s'!", name, colname)
  545. return
  546. }
  547.  
  548. /*****************************************************************************************
  549.  *****************************************************************************************/
  550. public check_position(taskid) {
  551. new origin[3], id = taskid-TASKID
  552.  
  553. if (!get_user_team(id)) {
  554. kill_trail_msg(id)
  555. return
  556. }
  557.  
  558. get_user_origin(id, origin)
  559. if (origin[0]!=gl_player_position[id][0] || origin[1]!=gl_player_position[id][1] || origin[2]!=gl_player_position[id][2]) {
  560. if (get_distance(origin, gl_player_position[id])>MAX_DISTANCE || gl_timer_count[id] >= gl_timer_limit/2) {
  561. kill_trail_msg(id)
  562. trail_msg(id)
  563. }
  564. gl_player_position[id][0] = origin[0]
  565. gl_player_position[id][1] = origin[1]
  566. gl_player_position[id][2] = origin[2]
  567. gl_timer_count[id] = 0
  568. } else {
  569. if (gl_timer_count[id] < gl_timer_limit) gl_timer_count[id]++
  570. }
  571. }
  572.  
  573. /*****************************************************************************************
  574.  *****************************************************************************************/
  575. kill_trail_task(id) {
  576. if (task_exists(TASKID+id)) remove_task(TASKID+id)
  577. kill_trail_msg(id)
  578. gl_player_colors[id][0] = gl_player_colors[id][1] = gl_player_colors[id][2] = 0
  579. }
  580.  
  581. /*****************************************************************************************
  582.  *****************************************************************************************/
  583. kill_trail_msg(id) {
  584. gl_timer_count[id] = 0
  585.  
  586. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  587. write_byte(99) // TE_KILLBEAM
  588. write_short(id)
  589. message_end()
  590. }
  591.  
  592. /*****************************************************************************************
  593.  *****************************************************************************************/
  594. trail_msg(id) {
  595. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  596. write_byte(22) // TE_BEAMFOLLOW
  597. write_short(id)
  598. write_short(gl_trail_type[id])
  599. write_byte(gl_trail_life*10)
  600. write_byte(gl_trail_size[id])
  601. write_byte(gl_player_colors[id][0])
  602. write_byte(gl_player_colors[id][1])
  603. write_byte(gl_player_colors[id][2])
  604. write_byte(gl_trail_brightness[id])
  605. message_end()
  606.  
  607. }
  608.  
  609. /*****************************************************************************************
  610.  *****************************************************************************************/
  611. restart_player_trail(id) {
  612. if (task_exists(TASKID+id)) {
  613. remove_task(TASKID+id)
  614. kill_trail_msg(id)
  615. get_user_origin(id, gl_player_position[id])
  616. set_task(TICK, "check_position", TASKID+id, "", 0, "b")
  617. trail_msg(id)
  618. }
  619. }
  620.  
  621. /*****************************************************************************************
  622.  *****************************************************************************************/
  623. restart_players_trails() {
  624. new playercount
  625.  
  626. get_players(gl_players, playercount)
  627. for (new i=0; i<playercount; i++) {
  628. restart_player_trail(gl_players[i])
  629. }
  630. }
  631.  
  632. /*****************************************************************************************
  633.  *****************************************************************************************/
  634. say_to_all(msg[], id) {
  635. new playercount
  636.  
  637. get_players(gl_players, playercount)
  638. for (new i=0; i<playercount; i++) {
  639. if (gl_players[i]!=id) client_print(gl_players[i], print_chat, msg)
  640. }
  641. }
  642.  
  643. /*****************************************************************************************
  644.  *****************************************************************************************/
  645. trail_help(id) {
  646. new msg[200], clen=0
  647.  
  648. console_print(id, "^nTrail Colors List:^n")
  649. for (new i=0; i<gl_num_colors; i++) {
  650. clen += format(msg[clen], 199-clen, "%s ", gl_color_names[i])
  651. if (clen > 80) {
  652. console_print(id, msg)
  653. copy(msg, 1, "")
  654. clen = 0
  655. }
  656. }
  657. console_print(id, "^nNOTE: Par db. szinunek van elotagja..pl: 'n.' vagy 'c.' n=narancs c=citrom.^n")
  658. console_print(id, "^nSay 'trail <szin>' hogy efect nelkuli csikot huzz magad utan.^nSay 'trail off' es kikapcsolod a trail-od.")
  659. console_print(id, "Say 'trail <sza'm> [szin]' es szines csikot huzol magad utan.^n")
  660. console_print(id, "^nPeldak:")
  661. console_print(id, " trail")
  662. console_print(id, " trail off")
  663. console_print(id, " trail zold")
  664. console_print(id, " trail 6 piros")
  665. console_print(id, " trail 11 c.sarga")
  666. client_print(id, print_chat, "A szinek listaja megjelenik a konzolban.")
  667. }
  668.  
  669. /*****************************************************************************************
  670.  *****************************************************************************************/
  671. bool:parse_file() {
  672. new got_line, line_num=0, len=0, parsed
  673. new r[3][4], g[3][4], b[3][4]
  674. new full_line[MAX_TEXT_LENGTH], rest_line[MAX_TEXT_LENGTH], cfgdir[MAX_TEXT_LENGTH], cfgpath[MAX_TEXT_LENGTH]
  675.  
  676. gl_num_colors = 0
  677. get_configsdir(cfgdir, MAX_TEXT_LENGTH)
  678. format(cfgpath, MAX_TEXT_LENGTH, "%s/%s", cfgdir, CFG_FILE)
  679. if (!file_exists(cfgpath)) {
  680. log_amx("ERROR: Cannot find configuration file '%s'!", cfgpath)
  681. return false
  682. }
  683. got_line = read_file(cfgpath, line_num, full_line, MAX_TEXT_LENGTH, len)
  684. if (got_line <=0) {
  685. log_amx("ERROR: Cannot read configuration file '%s'!", cfgpath)
  686. return false
  687. }
  688. while (got_line>0) {
  689. if (!equal(full_line, "//", 2) && len) {
  690. strtok(full_line, gl_color_names[gl_num_colors], MAX_NAME_LENGTH, rest_line, MAX_TEXT_LENGTH, ' ', 1)
  691. copy(full_line, MAX_TEXT_LENGTH, rest_line)
  692.  
  693. parsed = parse(full_line,r[0],3,g[0],3,b[0],3)
  694. if (parsed<3) {
  695. log_amx("ERROR: Not enough colors, line %d in configuration file '%s'!", 1+line_num, CFG_FILE)
  696. return false
  697. }
  698. gl_colors[gl_num_colors][0] = str_to_num(r[0])
  699. gl_colors[gl_num_colors][1] = str_to_num(g[0])
  700. gl_colors[gl_num_colors][2] = str_to_num(b[0])
  701.  
  702. gl_num_colors++
  703. if (gl_num_colors>=MAX_COLORS) {
  704. log_amx("WARNING: Max szinek '%s'!", CFG_FILE)
  705. return true
  706. }
  707. }
  708. line_num++
  709. got_line = read_file(cfgpath, line_num, full_line, MAX_TEXT_LENGTH, len)
  710. }
  711. return true
  712. }
  713.  
  714. check_map() {
  715. new got_line, line_num, len
  716. new cfgdir[MAX_TEXT_LENGTH]
  717. new cfgpath[MAX_TEXT_LENGTH]
  718. new mapname[MAX_NAME_LENGTH]
  719. new txt[MAX_TEXT_LENGTH]
  720.  
  721. get_configsdir(cfgdir, MAX_TEXT_LENGTH-1)
  722. get_mapname(mapname, MAX_NAME_LENGTH-1)
  723.  
  724. format(cfgpath, MAX_TEXT_LENGTH, "%s/sensiblemaps.cfg", cfgdir)
  725.  
  726. if (file_exists(cfgpath)) {
  727. got_line = read_file(cfgpath, line_num, txt, MAX_TEXT_LENGTH-1, len)
  728. while (got_line>0) {
  729. if (equali(txt, mapname)) return 1
  730. line_num++
  731. got_line = read_file(cfgpath, line_num, txt, MAX_TEXT_LENGTH-1, len)
  732. }
  733. }
  734. return 0
  735. }
  736.  

_________________
DigitalSoldiers Pub Szerver: 188.227.225.106:28293
Kép


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 1 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 20 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole