hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.03. 12:41



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: nincs regisztrált felhasználó 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  [ 4 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: szines timeleft
HozzászólásElküldve: 2014.04.21. 01:30 
Offline
Senior Tag
Avatar

Csatlakozott: 2014.01.20. 13:00
Hozzászólások: 216
Megköszönt másnak: 89 alkalommal
Megköszönték neki: 14 alkalommal
helló

azt hol tudom beállítani, hogy ha valaki beírja hogy timeleft akkor azt szinesen írja ki
Hátralévő idő: 20:00

_________________
Kép
Kép
https://soundcloud.com/l-c-a-w


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: szines timeleft
HozzászólásElküldve: 2014.04.21. 03:56 
Offline
Minden6ó
Avatar

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

_________________
<<eb@>>Team Website - Közösség
17Buddies - Általam készített pályák.
GameBanana - Általam készített pályák/vágott hangok.

Kép
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: szines timeleft
HozzászólásElküldve: 2014.04.22. 09:06 
Offline
Senior Tag
Avatar

Csatlakozott: 2014.01.20. 13:00
Hozzászólások: 216
Megköszönt másnak: 89 alkalommal
Megköszönték neki: 14 alkalommal
ennek elv. most szinesnek kéne lennnie?:D

_________________
Kép
Kép
https://soundcloud.com/l-c-a-w


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: szines timeleft
HozzászólásElküldve: 2014.04.22. 09:14 
Offline
Felfüggesztve

Csatlakozott: 2013.08.09. 22:37
Hozzászólások: 571
Megköszönt másnak: 10 alkalommal
Megköszönték neki: 85 alkalommal
ittvan.

SMA Forráskód: [ Mindet kijelol ]
  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 <colorchat>
  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.  
  94. return PLUGIN_CONTINUE
  95. }
  96.  
  97. public sayTimeLeft(id)
  98. {
  99. if (get_cvar_float("mp_timelimit"))
  100. {
  101. new a = get_timeleft()
  102.  
  103. if (get_cvar_num("amx_time_voice"))
  104. {
  105. new svoice[128]
  106. setTimeVoice(svoice, 127, 0, a)
  107. client_cmd(id, "%s", svoice)
  108. }
  109. ColorChat(0, RED, "%L: %d:%02d", LANG_PLAYER, "TIME_LEFT", (a / 60), (a % 60))
  110. }
  111. else
  112. client_print(0, print_chat, "%L", LANG_PLAYER, "NO_T_LIMIT")
  113.  
  114. return PLUGIN_CONTINUE
  115. }
  116.  
  117. setTimeText(text[], len, tmlf, id)
  118. {
  119. new secs = tmlf % 60
  120. new mins = tmlf / 60
  121.  
  122. if (secs == 0)
  123. format(text, len, "%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE")
  124. else if (mins == 0)
  125. format(text, len, "%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
  126. else
  127. format(text, len, "%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
  128. }
  129.  
  130. setTimeVoice(text[], len, flags, tmlf)
  131. {
  132. new temp[7][32]
  133. new secs = tmlf % 60
  134. new mins = tmlf / 60
  135.  
  136. for (new a = 0;a < 7;++a)
  137. temp[a][0] = 0
  138.  
  139. if (secs > 0)
  140. {
  141. num_to_word(secs, temp[4], 31)
  142.  
  143. if (!(flags & 8))
  144. temp[5] = "seconds " /* there is no "second" in default hl */
  145. }
  146.  
  147. if (mins > 59)
  148. {
  149. new hours = mins / 60
  150.  
  151. num_to_word(hours, temp[0], 31)
  152.  
  153. if (!(flags & 8))
  154. temp[1] = "hours "
  155.  
  156. mins = mins % 60
  157. }
  158.  
  159. if (mins > 0)
  160. {
  161. num_to_word(mins, temp[2], 31)
  162.  
  163. if (!(flags & 8))
  164. temp[3] = "minutes "
  165. }
  166.  
  167. if (!(flags & 4))
  168. temp[6] = "remaining "
  169.  
  170. 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])
  171. }
  172.  
  173. findDispFormat(time)
  174. {
  175. for (new i = 0; g_TimeSet[i][0]; ++i)
  176. {
  177. if (g_TimeSet[i][1] & 16)
  178. {
  179. if (g_TimeSet[i][0] > time)
  180. {
  181. if (!g_Switch)
  182. {
  183. g_CountDown = g_Switch = time
  184. remove_task(8648458)
  185. set_task(1.0, "timeRemain", 34543, "", 0, "b")
  186. }
  187.  
  188. return i
  189. }
  190. }
  191. else if (g_TimeSet[i][0] == time)
  192. {
  193. return i
  194. }
  195. }
  196.  
  197. return -1
  198. }
  199.  
  200. public setDisplaying()
  201. {
  202. new arg[32], flags[32], num[32]
  203. new argc = read_argc() - 1
  204. new i = 0
  205.  
  206. while (i < argc && i < 32)
  207. {
  208. read_argv(i + 1, arg, 31)
  209. parse(arg, flags, 31, num, 31)
  210.  
  211. g_TimeSet[i][0] = str_to_num(num)
  212. g_TimeSet[i][1] = read_flags(flags)
  213.  
  214. i++
  215. }
  216. g_TimeSet[i][0] = 0
  217.  
  218. return PLUGIN_HANDLED
  219. }
  220.  
  221. public timeRemain(param[])
  222. {
  223. new gmtm = get_timeleft()
  224. new tmlf = g_Switch ? --g_CountDown : gmtm
  225. new stimel[12]
  226.  
  227. format(stimel, 11, "%02d:%02d", gmtm / 60, gmtm % 60)
  228. set_cvar_string("amx_timeleft", stimel)
  229.  
  230. if (g_Switch && gmtm > g_Switch)
  231. {
  232. remove_task(34543)
  233. g_Switch = 0
  234. set_task(0.8, "timeRemain", 8648458, "", 0, "b")
  235.  
  236. return
  237. }
  238.  
  239. if (tmlf > 0 && g_LastTime != tmlf)
  240. {
  241. g_LastTime = tmlf
  242. new tm_set = findDispFormat(tmlf)
  243.  
  244. if (tm_set != -1)
  245. {
  246. new flags = g_TimeSet[tm_set][1]
  247. new arg[128]
  248.  
  249. if (flags & 1)
  250. {
  251. new players[32], pnum
  252.  
  253. get_players(players, pnum, "c")
  254.  
  255. for (new i = 0; i < pnum; i++)
  256. {
  257. setTimeText(arg, 127, tmlf, players[i])
  258.  
  259. if (flags & 16)
  260. set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, -1)
  261. else
  262. set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, -1)
  263.  
  264. show_hudmessage(players[i], "%s", arg)
  265. }
  266. }
  267.  
  268. if (flags & 2)
  269. {
  270. setTimeVoice(arg, 127, flags, tmlf)
  271. client_cmd(0, "%s", arg)
  272. }
  273. }
  274. }
  275. }
  276.  


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


Ki van itt

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