hlmod.hu

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



Jelenlévő felhasználók

Jelenleg 221 felhasználó van jelen :: 1 regisztrált, 1 rejtett és 219 vendég

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

Regisztrált felhasználók: Google [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  [ 2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Fordítás hiba
HozzászólásElküldve: 2016.07.15. 09:50 
Offline
Jómunkásember

Csatlakozott: 2015.11.29. 17:07
Hozzászólások: 375
Megköszönt másnak: 76 alkalommal
Megköszönték neki: 53 alkalommal
Sziasztok! Ebben mi a gond? Szinessé szerettem volna tenni a timeleft plugint és a stock-nál jelzett hibát.

AMX Mod X Compiler 1.8.3-manual
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

Modified for http://www.Freakz.ro / amx.freakz.ro

timeleft.sma(283) : error 021: symbol already defined: "print_color"

1 Error.
Compilarea failed!


  1. /* AMX Mod X
  2. *   TimeLeft Plugin
  3. *
  4. * by the AMX Mod X Development Team
  5. *  originally developed by OLO
  6. *
  7. * This file is part of AMX Mod X.
  8. *
  9. *
  10. *  This program is free software; you can redistribute it and/or modify it
  11. *  under the terms of the GNU General Public License as published by the
  12. *  Free Software Foundation; either version 2 of the License, or (at
  13. *  your option) any later version.
  14. *
  15. *  This program is distributed in the hope that it will be useful, but
  16. *  WITHOUT ANY WARRANTY; without even the implied warranty of
  17. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. *  General Public License for more details.
  19. *
  20. *  You should have received a copy of the GNU General Public License
  21. *  along with this program; if not, write to the Free Software Foundation,
  22. *  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. *  In addition, as a special exception, the author gives permission to
  25. *  link the code of this program with the Half-Life Game Engine ("HL
  26. *  Engine") and Modified Game Libraries ("MODs") developed by Valve,
  27. *  L.L.C ("Valve"). You must obey the GNU General Public License in all
  28. *  respects for all of the code used other than the HL Engine and MODs
  29. *  from Valve. If you modify this file, you may extend this exception
  30. *  to your version of the file, but you are not obligated to do so. If
  31. *  you do not wish to do so, delete this exception statement from your
  32. *  version.
  33. */
  34.  
  35. #include <amxmodx>
  36. #include <printcolor>
  37.  
  38. new g_TimeSet[32][2]
  39. new g_LastTime
  40. new g_CountDown
  41. new g_Switch
  42.  
  43. public plugin_init()
  44. {
  45. register_plugin("TimeLeft", AMXX_VERSION_STR, "AMXX Dev Team")
  46. register_dictionary("timeleft.txt")
  47. register_cvar("amx_time_voice", "1")
  48. register_srvcmd("amx_time_display", "setDisplaying")
  49. register_cvar("amx_timeleft", "00:00", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
  50. register_clcmd("say timeleft", "sayTimeLeft", 0, "- displays timeleft")
  51. register_clcmd("say thetime", "sayTheTime", 0, "- displays current time")
  52.  
  53. set_task(0.8, "timeRemain", 8648458, "", 0, "b")
  54. }
  55.  
  56. public sayTheTime(id)
  57. {
  58. if (get_cvar_num("amx_time_voice"))
  59. {
  60. new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
  61.  
  62. get_time("%H", mhours, 5)
  63. get_time("%M", mmins, 5)
  64.  
  65. new mins = str_to_num(mmins)
  66. new hrs = str_to_num(mhours)
  67.  
  68. if (mins)
  69. num_to_word(mins, wmins, 31)
  70. else
  71. wmins[0] = 0
  72.  
  73. if (hrs < 12)
  74. wpm = "am "
  75. else
  76. {
  77. if (hrs > 12) hrs -= 12
  78. wpm = "pm "
  79. }
  80.  
  81. if (hrs)
  82. num_to_word(hrs, whours, 31)
  83. else
  84. whours = "twelve "
  85.  
  86. client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"", whours, wmins, wpm)
  87. }
  88.  
  89. new ctime[64]
  90.  
  91. get_time("%m/%d/%Y - %H:%M:%S", ctime, 63)
  92. //client_print(0, print_chat, "%L:   %s", LANG_PLAYER, "THE_TIME", ctime)
  93. print_color(0, "%L:   %s", LANG_PLAYER, "THE_TIME", ctime)
  94.  
  95.  
  96. return PLUGIN_CONTINUE
  97. }
  98.  
  99. public sayTimeLeft(id)
  100. {
  101. if (get_cvar_float("mp_timelimit"))
  102. {
  103. new a = get_timeleft()
  104.  
  105. if (get_cvar_num("amx_time_voice"))
  106. {
  107. new svoice[128]
  108. setTimeVoice(svoice, 127, 0, a)
  109. client_cmd(id, "%s", svoice)
  110. }
  111. //client_print(0, print_chat, "%L:  %d:%02d", LANG_PLAYER, "TIME_LEFT", (a / 60), (a % 60))
  112. print_color(0, "%L:  %d:%02d", LANG_PLAYER, "TIME_LEFT", (a / 60), (a % 60))
  113.  
  114. }
  115. else
  116. //client_print(0, print_chat, "%L", LANG_PLAYER, "NO_T_LIMIT")
  117. print_color(0, "%L", LANG_PLAYER, "NO_T_LIMIT")
  118.  
  119.  
  120. return PLUGIN_CONTINUE
  121. }
  122.  
  123. setTimeText(text[], len, tmlf, id)
  124. {
  125. new secs = tmlf % 60
  126. new mins = tmlf / 60
  127.  
  128. if (secs == 0)
  129. format(text, len, "%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE")
  130. else if (mins == 0)
  131. format(text, len, "%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
  132. else
  133. format(text, len, "%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
  134. }
  135.  
  136. setTimeVoice(text[], len, flags, tmlf)
  137. {
  138. new temp[7][32]
  139. new secs = tmlf % 60
  140. new mins = tmlf / 60
  141.  
  142. for (new a = 0;a < 7;++a)
  143. temp[a][0] = 0
  144.  
  145. if (secs > 0)
  146. {
  147. num_to_word(secs, temp[4], 31)
  148.  
  149. if (!(flags & 8))
  150. temp[5] = "seconds "    /* there is no "second" in default hl */
  151. }
  152.  
  153. if (mins > 59)
  154. {
  155. new hours = mins / 60
  156.  
  157. num_to_word(hours, temp[0], 31)
  158.  
  159. if (!(flags & 8))
  160. temp[1] = "hours "
  161.  
  162. mins = mins % 60
  163. }
  164.  
  165. if (mins > 0)
  166. {
  167. num_to_word(mins, temp[2], 31)
  168.  
  169. if (!(flags & 8))
  170. temp[3] = "minutes "
  171. }
  172.  
  173. if (!(flags & 4))
  174. temp[6] = "remaining "
  175.  
  176. return format(text, len, "spk ^"vox/%s%s%s%s%s%s%s^"", temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6])
  177. }
  178.  
  179. findDispFormat(time)
  180. {
  181. for (new i = 0; g_TimeSet[i][0]; ++i)
  182. {
  183. if (g_TimeSet[i][1] & 16)
  184. {
  185. if (g_TimeSet[i][0] > time)
  186. {
  187. if (!g_Switch)
  188. {
  189. g_CountDown = g_Switch = time
  190. remove_task(8648458)
  191. set_task(1.0, "timeRemain", 34543, "", 0, "b")
  192. }
  193.  
  194. return i
  195. }
  196. }
  197. else if (g_TimeSet[i][0] == time)
  198. {
  199. return i
  200. }
  201. }
  202.  
  203. return -1
  204. }
  205.  
  206. public setDisplaying()
  207. {
  208. new arg[32], flags[32], num[32]
  209. new argc = read_argc() - 1
  210. new i = 0
  211.  
  212. while (i < argc && i < 32)
  213. {
  214. read_argv(i + 1, arg, 31)
  215. parse(arg, flags, 31, num, 31)
  216.  
  217. g_TimeSet[i][0] = str_to_num(num)
  218. g_TimeSet[i][1] = read_flags(flags)
  219.  
  220. i++
  221. }
  222. g_TimeSet[i][0] = 0
  223.  
  224. return PLUGIN_HANDLED
  225. }
  226.  
  227. public timeRemain(param[])
  228. {
  229. new gmtm = get_timeleft()
  230. new tmlf = g_Switch ? --g_CountDown : gmtm
  231. new stimel[12]
  232.  
  233. format(stimel, 11, "%02d:%02d", gmtm / 60, gmtm % 60)
  234. set_cvar_string("amx_timeleft", stimel)
  235.  
  236. if (g_Switch && gmtm > g_Switch)
  237. {
  238. remove_task(34543)
  239. g_Switch = 0
  240. set_task(0.8, "timeRemain", 8648458, "", 0, "b")
  241.  
  242. return
  243. }
  244.  
  245. if (tmlf > 0 && g_LastTime != tmlf)
  246. {
  247. g_LastTime = tmlf
  248. new tm_set = findDispFormat(tmlf)
  249.  
  250. if (tm_set != -1)
  251. {
  252. new flags = g_TimeSet[tm_set][1]
  253. new arg[128]
  254.  
  255. if (flags & 1)
  256. {
  257. new players[32], pnum
  258.  
  259. get_players(players, pnum, "c")
  260.  
  261. for (new i = 0; i < pnum; i++)
  262. {
  263. setTimeText(arg, 127, tmlf, players[i])
  264.  
  265. if (flags & 16)
  266. set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, -1)
  267. else
  268. set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, -1)
  269.  
  270. show_hudmessage(players[i], "%s", arg)
  271. }
  272. }
  273.  
  274. if (flags & 2)
  275. {
  276. setTimeVoice(arg, 127, flags, tmlf)
  277. client_cmd(0, "%s", arg)
  278. }
  279. }
  280. }
  281. }
  282. stock print_color(const id, const input[], any:...)
  283. {
  284. new count = 1, players[32]
  285. static msg[191]
  286. vformat(msg, 190, input, 3)
  287.  
  288. replace_all(msg, 190, "!g", "^4")
  289. replace_all(msg, 190, "!y", "^1")
  290. replace_all(msg, 190, "!t", "^3")    
  291.  
  292. if (id) players[0] = id; else get_players(players, count, "ch")
  293. {
  294. for (new i = 0; i < count; i++)
  295. {
  296. if (is_user_connected(players[i]))
  297. {
  298. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  299. write_byte(players[i])
  300. write_string(msg)
  301. message_end()
  302. }
  303. }
  304. }
  305. return PLUGIN_HANDLED
  306. }


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Fordítás hiba
HozzászólásElküldve: 2016.07.15. 12:18 
Offline
Félisten
Avatar

Csatlakozott: 2015.03.12. 18:30
Hozzászólások: 975
Megköszönt másnak: 67 alkalommal
Megköszönték neki: 136 alkalommal
  1. #include <printcolor>
????


  1. #include <amxmodx>
  2.  
  3. new g_TimeSet[32][2]
  4. new g_LastTime
  5. new g_CountDown
  6. new g_Switch
  7.  
  8. public plugin_init()
  9. {
  10. register_plugin("TimeLeft", AMXX_VERSION_STR, "AMXX Dev Team")
  11. register_dictionary("timeleft.txt")
  12. register_cvar("amx_time_voice", "1")
  13. register_srvcmd("amx_time_display", "setDisplaying")
  14. register_cvar("amx_timeleft", "00:00", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
  15. register_clcmd("say timeleft", "sayTimeLeft", 0, "- displays timeleft")
  16. register_clcmd("say thetime", "sayTheTime", 0, "- displays current time")
  17.  
  18. set_task(0.8, "timeRemain", 8648458, "", 0, "b")
  19. }
  20.  
  21. public sayTheTime(id)
  22. {
  23. if (get_cvar_num("amx_time_voice"))
  24. {
  25. new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
  26.  
  27. get_time("%H", mhours, 5)
  28. get_time("%M", mmins, 5)
  29.  
  30. new mins = str_to_num(mmins)
  31. new hrs = str_to_num(mhours)
  32.  
  33. if (mins)
  34. num_to_word(mins, wmins, 31)
  35. else
  36. wmins[0] = 0
  37.  
  38. if (hrs < 12)
  39. wpm = "am "
  40. else
  41. {
  42. if (hrs > 12) hrs -= 12
  43. wpm = "pm "
  44. }
  45.  
  46. if (hrs)
  47. num_to_word(hrs, whours, 31)
  48. else
  49. whours = "twelve "
  50.  
  51. client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"", whours, wmins, wpm)
  52. }
  53.  
  54. new ctime[64]
  55.  
  56. get_time("%m/%d/%Y - %H:%M:%S", ctime, 63)
  57. //client_print(0, print_chat, "%L:   %s", LANG_PLAYER, "THE_TIME", ctime)
  58. print_color(0, "%L:   %s", LANG_PLAYER, "THE_TIME", ctime)
  59.  
  60.  
  61. return PLUGIN_CONTINUE
  62. }
  63.  
  64. public sayTimeLeft(id)
  65. {
  66. if (get_cvar_float("mp_timelimit"))
  67. {
  68. new a = get_timeleft()
  69.  
  70. if (get_cvar_num("amx_time_voice"))
  71. {
  72. new svoice[128]
  73. setTimeVoice(svoice, 127, 0, a)
  74. client_cmd(id, "%s", svoice)
  75. }
  76. //client_print(0, print_chat, "%L:  %d:%02d", LANG_PLAYER, "TIME_LEFT", (a / 60), (a % 60))
  77. print_color(0, "%L:  %d:%02d", LANG_PLAYER, "TIME_LEFT", (a / 60), (a % 60))
  78.  
  79. }
  80. else
  81. //client_print(0, print_chat, "%L", LANG_PLAYER, "NO_T_LIMIT")
  82. print_color(0, "%L", LANG_PLAYER, "NO_T_LIMIT")
  83.  
  84.  
  85. return PLUGIN_CONTINUE
  86. }
  87.  
  88. setTimeText(text[], len, tmlf, id)
  89. {
  90. new secs = tmlf % 60
  91. new mins = tmlf / 60
  92.  
  93. if (secs == 0)
  94. format(text, len, "%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE")
  95. else if (mins == 0)
  96. format(text, len, "%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
  97. else
  98. format(text, len, "%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
  99. }
  100.  
  101. setTimeVoice(text[], len, flags, tmlf)
  102. {
  103. new temp[7][32]
  104. new secs = tmlf % 60
  105. new mins = tmlf / 60
  106.  
  107. for (new a = 0;a < 7;++a)
  108. temp[a][0] = 0
  109.  
  110. if (secs > 0)
  111. {
  112. num_to_word(secs, temp[4], 31)
  113.  
  114. if (!(flags & 8))
  115. temp[5] = "seconds "    /* there is no "second" in default hl */
  116. }
  117.  
  118. if (mins > 59)
  119. {
  120. new hours = mins / 60
  121.  
  122. num_to_word(hours, temp[0], 31)
  123.  
  124. if (!(flags & 8))
  125. temp[1] = "hours "
  126.  
  127. mins = mins % 60
  128. }
  129.  
  130. if (mins > 0)
  131. {
  132. num_to_word(mins, temp[2], 31)
  133.  
  134. if (!(flags & 8))
  135. temp[3] = "minutes "
  136. }
  137.  
  138. if (!(flags & 4))
  139. temp[6] = "remaining "
  140.  
  141. return format(text, len, "spk ^"vox/%s%s%s%s%s%s%s^"", temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6])
  142. }
  143.  
  144. findDispFormat(time)
  145. {
  146. for (new i = 0; g_TimeSet[i][0]; ++i)
  147. {
  148. if (g_TimeSet[i][1] & 16)
  149. {
  150. if (g_TimeSet[i][0] > time)
  151. {
  152. if (!g_Switch)
  153. {
  154. g_CountDown = g_Switch = time
  155. remove_task(8648458)
  156. set_task(1.0, "timeRemain", 34543, "", 0, "b")
  157. }
  158.  
  159. return i
  160. }
  161. }
  162. else if (g_TimeSet[i][0] == time)
  163. {
  164. return i
  165. }
  166. }
  167.  
  168. return -1
  169. }
  170.  
  171. public setDisplaying()
  172. {
  173. new arg[32], flags[32], num[32]
  174. new argc = read_argc() - 1
  175. new i = 0
  176.  
  177. while (i < argc && i < 32)
  178. {
  179. read_argv(i + 1, arg, 31)
  180. parse(arg, flags, 31, num, 31)
  181.  
  182. g_TimeSet[i][0] = str_to_num(num)
  183. g_TimeSet[i][1] = read_flags(flags)
  184.  
  185. i++
  186. }
  187. g_TimeSet[i][0] = 0
  188.  
  189. return PLUGIN_HANDLED
  190. }
  191.  
  192. public timeRemain(param[])
  193. {
  194. new gmtm = get_timeleft()
  195. new tmlf = g_Switch ? --g_CountDown : gmtm
  196. new stimel[12]
  197.  
  198. format(stimel, 11, "%02d:%02d", gmtm / 60, gmtm % 60)
  199. set_cvar_string("amx_timeleft", stimel)
  200.  
  201. if (g_Switch && gmtm > g_Switch)
  202. {
  203. remove_task(34543)
  204. g_Switch = 0
  205. set_task(0.8, "timeRemain", 8648458, "", 0, "b")
  206.  
  207. return
  208. }
  209.  
  210. if (tmlf > 0 && g_LastTime != tmlf)
  211. {
  212. g_LastTime = tmlf
  213. new tm_set = findDispFormat(tmlf)
  214.  
  215. if (tm_set != -1)
  216. {
  217. new flags = g_TimeSet[tm_set][1]
  218. new arg[128]
  219.  
  220. if (flags & 1)
  221. {
  222. new players[32], pnum
  223.  
  224. get_players(players, pnum, "c")
  225.  
  226. for (new i = 0; i < pnum; i++)
  227. {
  228. setTimeText(arg, 127, tmlf, players[i])
  229.  
  230. if (flags & 16)
  231. set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, -1)
  232. else
  233. set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, -1)
  234.  
  235. show_hudmessage(players[i], "%s", arg)
  236. }
  237. }
  238.  
  239. if (flags & 2)
  240. {
  241. setTimeVoice(arg, 127, flags, tmlf)
  242. client_cmd(0, "%s", arg)
  243. }
  244. }
  245. }
  246. }
  247. stock print_color(const id, const input[], any:...) {
  248.         new count = 1, players[32]
  249.         static msg[191]
  250.         vformat(msg, 190, input, 3)
  251.  
  252.         replace_all(msg, 190, "!g", "^4")
  253.         replace_all(msg, 190, "!y", "^1")
  254.         replace_all(msg, 190, "!t", "^3")    
  255.  
  256.         if (id) players[0] = id; else get_players(players, count, "ch")
  257.         {
  258.                 for (new i = 0; i < count; i++)
  259.                 {
  260.                         if (is_user_connected(players[i]))
  261.                         {
  262.                                 message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  263.                                 write_byte(players[i])
  264.                                 write_string(msg)
  265.                                 message_end()
  266.                         }
  267.                 }
  268.         }
  269.         return PLUGIN_HANDLED
  270. }

_________________
Fórumi aktivitásom véget ért: 2017.09.07.
Innentől esetleg steamen vagyok elérhető.

Ők köszönték meg kengurumancs nek ezt a hozzászólást: Krisznitro (2016.07.15. 14:35)
  Népszerűség: 2.27%


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  [ 2 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 17 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