hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.22. 14:39



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: Bing [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  [ 8 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: amx color
HozzászólásElküldve: 2013.08.11. 17:34 
Offline
Senior Tag
Avatar

Csatlakozott: 2012.08.27. 11:11
Hozzászólások: 209
Megköszönt másnak: 35 alkalommal
Megköszönték neki: 3 alkalommal
Helló valaki átírná nekem


Ct-ben név: zöld írás: kék
T-ben név:zöld írás piros
specatorba név: zöld írás fehér

pár szerveren láttam már ilyet tudom hogy meglehet csinálni

előre is köszönöm a segítséget




SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define PLUGIN "Admin Chat Colors"
  5. #define VERSION "2.0"
  6. #define AUTHOR "Arion"
  7.  
  8. #define ACCESS_LEVEL ADMIN_CHAT
  9. #define ADMIN_LISTEN ADMIN_BAN
  10.  
  11. new message[192]
  12. new sayText
  13. new teamInfo
  14. new maxPlayers
  15.  
  16. new g_MessageColor
  17. new g_NameColor
  18. new g_AdminListen
  19.  
  20. new strName[191]
  21. new strText[191]
  22. new alive[11]
  23.  
  24. public plugin_init()
  25. {
  26. register_plugin (PLUGIN, VERSION, AUTHOR)
  27.  
  28. g_MessageColor = register_cvar ("amx_color", "2") // Message colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red
  29.  
  30. g_NameColor = register_cvar ("amx_namecolor", "6") // Name colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red, [6] Team-color
  31.  
  32. g_AdminListen = register_cvar ("amx_listen", "1") // Set whether admins see or not all messages (Alive, dead and team-only)
  33.  
  34.  
  35. sayText = get_user_msgid ("SayText")
  36. teamInfo = get_user_msgid ("TeamInfo")
  37. maxPlayers = get_maxplayers()
  38.  
  39.  
  40. register_message (sayText, "avoid_duplicated")
  41.  
  42. register_clcmd ("amx_color", "set_color", ACCESS_LEVEL, "<color>")
  43. register_clcmd ("amx_namecolor", "set_name_color", ACCESS_LEVEL, "<color>")
  44. register_clcmd ("amx_listen", "set_listen", ACCESS_LEVEL, "<1 | 0>")
  45.  
  46. register_clcmd ("say", "hook_say")
  47. register_clcmd ("say_team", "hook_teamsay")
  48. }
  49.  
  50.  
  51. public avoid_duplicated (msgId, msgDest, receiver)
  52. {
  53. return PLUGIN_HANDLED
  54. }
  55.  
  56.  
  57. public hook_say(id)
  58. {
  59. read_args (message, 191)
  60. remove_quotes (message)
  61.  
  62. if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, "")) // Ignores Admin Hud Messages, Admin Slash commands,
  63. // Gungame commands and empty messages
  64. return PLUGIN_CONTINUE
  65.  
  66.  
  67. new name[32]
  68. get_user_name (id, name, 31)
  69.  
  70. new bool:admin = false
  71.  
  72. if (get_user_flags(id) & ACCESS_LEVEL)
  73. admin = true
  74.  
  75.  
  76. new isAlive
  77.  
  78. if (is_user_alive (id))
  79. {
  80. isAlive = 1
  81. alive = "^x01"
  82. }
  83. else
  84. {
  85. isAlive = 0
  86. alive = "^x01*DEAD* "
  87. }
  88.  
  89. static color[10]
  90.  
  91.  
  92.  
  93. if (admin)
  94. {
  95. // Name
  96. switch (get_pcvar_num (g_NameColor))
  97. {
  98. case 1:
  99. format (strName, 191, "%s%s", alive, name)
  100.  
  101. case 2:
  102. format (strName, 191, "%s^x04%s", alive, name)
  103.  
  104. case 3:
  105. {
  106. color = "SPECTATOR"
  107. format (strName, 191, "%s^x03%s", alive, name)
  108. }
  109.  
  110. case 4:
  111. {
  112. color = "CT"
  113. format (strName, 191, "%s^x03%s", alive, name)
  114. }
  115.  
  116. case 5:
  117. {
  118. color = "TERRORIST"
  119. format (strName, 191, "%s^x03%s", alive, name)
  120. }
  121.  
  122. case 6:
  123. {
  124. get_user_team (id, color, 9)
  125.  
  126. format (strName, 191, "%s^x03%s", alive, name)
  127. }
  128. }
  129.  
  130.  
  131. // Message
  132. switch (get_pcvar_num (g_MessageColor))
  133. {
  134. case 1: // Yellow
  135. format (strText, 191, "%s", message)
  136.  
  137. case 2: // Green
  138. format (strText, 191, "^x04%s", message)
  139.  
  140. case 3: // White
  141. {
  142. copy (color, 9, "SPECTATOR")
  143. format (strText, 191, "^x03%s", message)
  144. }
  145.  
  146. case 4: // Blue
  147. {
  148. copy (color, 9, "CT")
  149. format (strText, 191, "^x03%s", message)
  150. }
  151.  
  152. case 5: // Red
  153. {
  154. copy (color, 9, "TERRORIST")
  155. format (strText, 191, "^x03%s", message)
  156. }
  157. }
  158. }
  159.  
  160. else // Player is not admin. Team-color name : Yellow message
  161. {
  162. get_user_team (id, color, 9)
  163.  
  164. format (strName, 191, "%s^x03%s", alive, name)
  165.  
  166. format (strText, 191, "%s", message)
  167. }
  168.  
  169. format (message, 191, "%s^x01 : %s", strName, strText)
  170.  
  171. sendMessage (color, isAlive) // Sends the colored message
  172.  
  173. return PLUGIN_CONTINUE
  174. }
  175.  
  176.  
  177. public hook_teamsay(id)
  178. {
  179. new playerTeam = get_user_team(id)
  180. new playerTeamName[19]
  181.  
  182. switch (playerTeam) // Team names which appear on team-only messages
  183. {
  184. case 1:
  185. copy (playerTeamName, 11, "Terrorists")
  186.  
  187. case 2:
  188. copy (playerTeamName, 18, "Counter-Terrorists")
  189.  
  190. default:
  191. copy (playerTeamName, 9, "Spectator")
  192. }
  193.  
  194. read_args (message, 191)
  195. remove_quotes (message)
  196.  
  197. if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, "")) // Ignores Admin Hud Messages, Admin Slash commands,
  198. // Gungame commands and empty messages
  199. return PLUGIN_CONTINUE
  200.  
  201.  
  202. new name[32]
  203. get_user_name (id, name, 31)
  204.  
  205. new bool:admin = false
  206.  
  207. if (get_user_flags(id) & ACCESS_LEVEL)
  208. admin = true
  209.  
  210.  
  211. new isAlive
  212.  
  213. if (is_user_alive (id))
  214. {
  215. isAlive = 1
  216. alive = "^x01"
  217. }
  218. else
  219. {
  220. isAlive = 0
  221. alive = "^x01*DEAD* "
  222. }
  223.  
  224. static color[10]
  225.  
  226.  
  227.  
  228. if (admin)
  229. {
  230. // Name
  231. switch (get_pcvar_num (g_NameColor))
  232. {
  233. case 1:
  234. format (strName, 191, "%s(%s) %s", alive, playerTeamName, name)
  235.  
  236. case 2:
  237. format (strName, 191, "%s(%s) ^x04%s", alive, playerTeamName, name)
  238.  
  239. case 3:
  240. {
  241. color = "SPECTATOR"
  242. format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  243. }
  244.  
  245. case 4:
  246. {
  247. color = "CT"
  248. format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  249. }
  250.  
  251. case 5:
  252. {
  253. color = "TERRORIST"
  254. format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  255. }
  256.  
  257. case 6:
  258. {
  259. get_user_team (id, color, 9)
  260.  
  261. format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  262. }
  263. }
  264.  
  265.  
  266. // Message
  267. switch (get_pcvar_num (g_MessageColor))
  268. {
  269. case 1: // Yellow
  270. format (strText, 191, "%s", message)
  271.  
  272. case 2: // Green
  273. format (strText, 191, "^x04%s", message)
  274.  
  275. case 3: // White
  276. {
  277. copy (color, 9, "SPECTATOR")
  278. format (strText, 191, "^x03%s", message)
  279. }
  280.  
  281. case 4: // Blue
  282. {
  283. copy (color, 9, "CT")
  284. format (strText, 191, "^x03%s", message)
  285. }
  286.  
  287. case 5: // Red
  288. {
  289. copy (color, 9, "TERRORIST")
  290. format (strText, 191, "^x03%s", message)
  291. }
  292. }
  293. }
  294.  
  295. else // Player is not admin. Team-color name : Yellow message
  296. {
  297. get_user_team (id, color, 9)
  298.  
  299. format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  300.  
  301. format (strText, 191, "%s", message)
  302. }
  303.  
  304. format (message, 191, "%s ^x01: %s", strName, strText)
  305.  
  306. sendTeamMessage (color, isAlive, playerTeam) // Sends the colored message
  307.  
  308. return PLUGIN_CONTINUE
  309. }
  310.  
  311.  
  312. public set_color (id, level, cid)
  313. {
  314. if (!cmd_access(id, level, cid, 2))
  315. return PLUGIN_HANDLED
  316.  
  317. new arg[1], newColor
  318. read_argv (1, arg, 1)
  319.  
  320. newColor = str_to_num (arg)
  321.  
  322. if (newColor >= 1 && newColor <= 5)
  323. {
  324. set_cvar_num ("amx_color", newColor)
  325. set_pcvar_num (g_MessageColor, newColor)
  326.  
  327. if (get_pcvar_num (g_NameColor) != 1 &&
  328. ((newColor == 3 && get_pcvar_num (g_NameColor) != 3)
  329. || (newColor == 4 && get_pcvar_num (g_NameColor) != 4)
  330. || (newColor == 5 && get_pcvar_num (g_NameColor) != 5)))
  331. {
  332. set_cvar_num ("amx_namecolor", 2)
  333. set_pcvar_num (g_NameColor, 2)
  334. }
  335. }
  336.  
  337. return PLUGIN_HANDLED
  338. }
  339.  
  340.  
  341. public set_name_color (id, level, cid)
  342. {
  343. if (!cmd_access(id, level, cid, 2))
  344. return PLUGIN_HANDLED
  345.  
  346. new arg[1], newColor
  347. read_argv (1, arg, 1)
  348.  
  349. newColor = str_to_num (arg)
  350.  
  351. if (newColor >= 1 && newColor <= 6)
  352. {
  353. set_cvar_num ("amx_namecolor", newColor)
  354. set_pcvar_num (g_NameColor, newColor)
  355.  
  356. if ((get_pcvar_num (g_MessageColor) != 1
  357. && ((newColor == 3 && get_pcvar_num (g_MessageColor) != 3)
  358. || (newColor == 4 && get_pcvar_num (g_MessageColor) != 4)
  359. || (newColor == 5 && get_pcvar_num (g_MessageColor) != 5)))
  360. || get_pcvar_num (g_NameColor) == 6)
  361. {
  362. set_cvar_num ("amx_color", 2)
  363. set_pcvar_num (g_MessageColor, 2)
  364. }
  365. }
  366.  
  367. return PLUGIN_HANDLED
  368. }
  369.  
  370.  
  371. public set_listen (id, level, cid)
  372. {
  373. if (!cmd_access(id, level, cid, 2))
  374. return PLUGIN_HANDLED
  375.  
  376. new arg[1], newListen
  377. read_argv(1, arg, 1)
  378.  
  379. newListen = str_to_num (arg)
  380.  
  381. set_cvar_num ("amx_listen", newListen)
  382. set_pcvar_num (g_AdminListen, newListen)
  383.  
  384. return PLUGIN_HANDLED
  385. }
  386.  
  387.  
  388. public sendMessage (color[], alive)
  389. {
  390. new teamName[10]
  391.  
  392. for (new player = 1; player < maxPlayers; player++)
  393. {
  394. if (!is_user_connected(player))
  395. continue
  396.  
  397. if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  398. {
  399. get_user_team (player, teamName, 9) // Stores user's team name to change back after sending the message
  400.  
  401. changeTeamInfo (player, color) // Changes user's team according to color choosen
  402.  
  403. writeMessage (player, message) // Writes the message on player's chat
  404.  
  405. changeTeamInfo (player, teamName) // Changes user's team back to original
  406. }
  407. }
  408. }
  409.  
  410.  
  411. public sendTeamMessage (color[], alive, playerTeam)
  412. {
  413. new teamName[10]
  414.  
  415. for (new player = 1; player < maxPlayers; player++)
  416. {
  417. if (!is_user_connected(player))
  418. continue
  419.  
  420. if (get_user_team(player) == playerTeam || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  421. {
  422. if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  423. {
  424. get_user_team (player, teamName, 9) // Stores user's team name to change back after sending the message
  425.  
  426. changeTeamInfo (player, color) // Changes user's team according to color choosen
  427.  
  428. writeMessage (player, message) // Writes the message on player's chat
  429.  
  430. changeTeamInfo (player, teamName) // Changes user's team back to original
  431. }
  432. }
  433. }
  434. }
  435.  
  436.  
  437. public changeTeamInfo (player, team[])
  438. {
  439. message_begin (MSG_ONE, teamInfo, _, player) // Tells to to modify teamInfo (Which is responsable for which time player is)
  440. write_byte (player) // Write byte needed
  441. write_string (team) // Changes player's team
  442. message_end() // Also Needed
  443. }
  444.  
  445.  
  446. public writeMessage (player, message[])
  447. {
  448. message_begin (MSG_ONE, sayText, {0, 0, 0}, player) // Tells to modify sayText (Which is responsable for writing colored messages)
  449. write_byte (player) // Write byte needed
  450. write_string (message) // Effectively write the message, finally, afterall
  451. message_end () // Needed as always
  452. }
  453.  


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: amx color
HozzászólásElküldve: 2013.08.15. 13:25 
Offline
Imperátor
Avatar

Csatlakozott: 2009.04.21. 09:33
Hozzászólások: 3991
Megköszönt másnak: 5 alkalommal
Megköszönték neki: 135 alkalommal
Kód:
g_MessageColor = register_cvar ("amx_color", "2") // Message colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red
g_NameColor = register_cvar ("amx_namecolor", "6") // Name colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red, [6] Team-color

_________________
Kód:
I'm back

Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: amx color
HozzászólásElküldve: 2013.08.15. 16:21 
Offline
Senior Tag
Avatar

Csatlakozott: 2012.08.27. 11:11
Hozzászólások: 209
Megköszönt másnak: 35 alkalommal
Megköszönték neki: 3 alkalommal
Metal írta:
Kód:
g_MessageColor = register_cvar ("amx_color", "2") // Message colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red
g_NameColor = register_cvar ("amx_namecolor", "6") // Name colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red, [6] Team-color



valami konkrétabb megfogalmazást tudnál íni hogy most ezzel mit kéne csinálnom :)


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: amx color
HozzászólásElküldve: 2013.08.16. 09:32 
Offline
Imperátor
Avatar

Csatlakozott: 2009.04.21. 09:33
Hozzászólások: 3991
Megköszönt másnak: 5 alkalommal
Megköszönték neki: 135 alkalommal
Message color:
Kód:
amx_color (def 2)

Values:
Kód:
[1] Default Yellow
[2] Green
[3] White
[4] Blue
[5] Red


Name color:
Kód:
amx_namecolor (def 6)

Values:
Kód:
[1] Default Yellow
[2] Green
[3] White
[4] Blue
[5] Red
[6] Team-color

_________________
Kód:
I'm back

Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: amx color
HozzászólásElküldve: 2013.08.16. 10:09 
Offline
Senior Tag
Avatar

Csatlakozott: 2012.08.27. 11:11
Hozzászólások: 209
Megköszönt másnak: 35 alkalommal
Megköszönték neki: 3 alkalommal
Metal írta:
Message color:
Kód:
amx_color (def 2)

Values:
Kód:
[1] Default Yellow
[2] Green
[3] White
[4] Blue
[5] Red


Name color:
Kód:
amx_namecolor (def 6)

Values:
Kód:
[1] Default Yellow
[2] Green
[3] White
[4] Blue
[5] Red
[6] Team-color


én ezt így fordítva gondoltam hogy amit az admin ír az a csapat színe és az admin neve zöld


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: amx color
HozzászólásElküldve: 2013.08.16. 10:14 
Offline
Imperátor
Avatar

Csatlakozott: 2009.04.21. 09:33
Hozzászólások: 3991
Megköszönt másnak: 5 alkalommal
Megköszönték neki: 135 alkalommal
Jááj háát.
Akkor viszont valóban át kell írni.
A 96. sorban lévő switchez kell még 1 opciót írnod, 6os néven.

_________________
Kód:
I'm back

Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: amx color
HozzászólásElküldve: 2013.08.16. 17:52 
Offline
Senior Tag
Avatar

Csatlakozott: 2012.08.27. 11:11
Hozzászólások: 209
Megköszönt másnak: 35 alkalommal
Megköszönték neki: 3 alkalommal
valaki megcsinálja :)
előre is kösz


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: amx color
HozzászólásElküldve: 2013.08.17. 02:03 
Offline
Őskövület
Avatar

Csatlakozott: 2012.02.07. 23:34
Hozzászólások: 2192
Megköszönt másnak: 27 alkalommal
Megköszönték neki: 55 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define PLUGIN "Admin Chat Colors"
  5. #define VERSION "2.0"
  6. #define AUTHOR "Arion"
  7.  
  8. #define ACCESS_LEVEL ADMIN_CHAT
  9. #define ADMIN_LISTEN ADMIN_BAN
  10.  
  11. new message[192]
  12. new sayText
  13. new teamInfo
  14. new maxPlayers
  15.  
  16. new g_MessageColor
  17. new g_NameColor
  18. new g_AdminListen
  19.  
  20. new strName[191]
  21. new strText[191]
  22. new alive[11]
  23.  
  24. public plugin_init()
  25. {
  26. register_plugin (PLUGIN, VERSION, AUTHOR)
  27.  
  28. g_MessageColor = register_cvar ("amx_color", "6") // Message colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red
  29.  
  30. g_NameColor = register_cvar ("amx_namecolor", "2") // Name colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red, [6] Team-color
  31.  
  32. g_AdminListen = register_cvar ("amx_listen", "1") // Set whether admins see or not all messages (Alive, dead and team-only)
  33.  
  34.  
  35. sayText = get_user_msgid ("SayText")
  36. teamInfo = get_user_msgid ("TeamInfo")
  37. maxPlayers = get_maxplayers()
  38.  
  39.  
  40. register_message (sayText, "avoid_duplicated")
  41.  
  42. register_clcmd ("amx_color", "set_color", ACCESS_LEVEL, "<color>")
  43. register_clcmd ("amx_namecolor", "set_name_color", ACCESS_LEVEL, "<color>")
  44. register_clcmd ("amx_listen", "set_listen", ACCESS_LEVEL, "<1 | 0>")
  45.  
  46. register_clcmd ("say", "hook_say")
  47. register_clcmd ("say_team", "hook_teamsay")
  48. }
  49.  
  50.  
  51. public avoid_duplicated (msgId, msgDest, receiver)
  52. {
  53. return PLUGIN_HANDLED
  54. }
  55.  
  56.  
  57. public hook_say(id)
  58. {
  59. read_args (message, 191)
  60. remove_quotes (message)
  61.  
  62. if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, "")) // Ignores Admin Hud Messages, Admin Slash commands,
  63. // Gungame commands and empty messages
  64. return PLUGIN_CONTINUE
  65.  
  66.  
  67. new name[32]
  68. get_user_name (id, name, 31)
  69.  
  70. new bool:admin = false
  71.  
  72. if (get_user_flags(id) & ACCESS_LEVEL)
  73. admin = true
  74.  
  75.  
  76. new isAlive
  77.  
  78. if (is_user_alive (id))
  79. {
  80. isAlive = 1
  81. alive = "^x01"
  82. }
  83. else
  84. {
  85. isAlive = 0
  86. alive = "^x01*DEAD* "
  87. }
  88.  
  89. static color[10]
  90.  
  91.  
  92.  
  93. if (admin)
  94. {
  95. // Name
  96. switch (get_pcvar_num (g_NameColor))
  97. {
  98. case 1:
  99. format (strName, 191, "%s%s", alive, name)
  100.  
  101. case 2:
  102. format (strName, 191, "%s^x04%s", alive, name)
  103.  
  104. case 3:
  105. {
  106. color = "SPECTATOR"
  107. format (strName, 191, "%s^x03%s", alive, name)
  108. }
  109.  
  110. case 4:
  111. {
  112. color = "CT"
  113. format (strName, 191, "%s^x03%s", alive, name)
  114. }
  115.  
  116. case 5:
  117. {
  118. color = "TERRORIST"
  119. format (strName, 191, "%s^x03%s", alive, name)
  120. }
  121.  
  122. case 6:
  123. {
  124. get_user_team (id, color, 9)
  125.  
  126. format (strName, 191, "%s^x03%s", alive, name)
  127. }
  128. }
  129.  
  130.  
  131. // Message
  132. switch (get_pcvar_num (g_MessageColor))
  133. {
  134. case 1: // Yellow
  135. format (strText, 191, "%s", message)
  136.  
  137. case 2: // Green
  138. format (strText, 191, "^x04%s", message)
  139.  
  140. case 3: // White
  141. {
  142. copy (color, 9, "SPECTATOR")
  143. format (strText, 191, "^x03%s", message)
  144. }
  145.  
  146. case 4: // Blue
  147. {
  148. copy (color, 9, "CT")
  149. format (strText, 191, "^x03%s", message)
  150. }
  151.  
  152. case 5: // Red
  153. {
  154. copy (color, 9, "TERRORIST")
  155. format (strText, 191, "^x03%s", message)
  156. }
  157. case 6: // Red
  158. {
  159. get_user_team (id, color, 9)
  160. format (strText, 191, "^x03%s", message)
  161. }
  162. }
  163. }
  164.  
  165. else // Player is not admin. Team-color name : Yellow message
  166. {
  167. get_user_team (id, color, 9)
  168.  
  169. format (strName, 191, "%s^x03%s", alive, name)
  170.  
  171. format (strText, 191, "%s", message)
  172. }
  173.  
  174. format (message, 191, "%s^x01 : %s", strName, strText)
  175.  
  176. sendMessage (color, isAlive) // Sends the colored message
  177.  
  178. return PLUGIN_CONTINUE
  179. }
  180.  
  181.  
  182. public hook_teamsay(id)
  183. {
  184. new playerTeam = get_user_team(id)
  185. new playerTeamName[19]
  186.  
  187. switch (playerTeam) // Team names which appear on team-only messages
  188. {
  189. case 1:
  190. copy (playerTeamName, 11, "Terrorists")
  191.  
  192. case 2:
  193. copy (playerTeamName, 18, "Counter-Terrorists")
  194.  
  195. default:
  196. copy (playerTeamName, 9, "Spectator")
  197. }
  198.  
  199. read_args (message, 191)
  200. remove_quotes (message)
  201.  
  202. if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, "")) // Ignores Admin Hud Messages, Admin Slash commands,
  203. // Gungame commands and empty messages
  204. return PLUGIN_CONTINUE
  205.  
  206.  
  207. new name[32]
  208. get_user_name (id, name, 31)
  209.  
  210. new bool:admin = false
  211.  
  212. if (get_user_flags(id) & ACCESS_LEVEL)
  213. admin = true
  214.  
  215.  
  216. new isAlive
  217.  
  218. if (is_user_alive (id))
  219. {
  220. isAlive = 1
  221. alive = "^x01"
  222. }
  223. else
  224. {
  225. isAlive = 0
  226. alive = "^x01*DEAD* "
  227. }
  228.  
  229. static color[10]
  230.  
  231.  
  232.  
  233. if (admin)
  234. {
  235. // Name
  236. switch (get_pcvar_num (g_NameColor))
  237. {
  238. case 1:
  239. format (strName, 191, "%s(%s) %s", alive, playerTeamName, name)
  240.  
  241. case 2:
  242. format (strName, 191, "%s(%s) ^x04%s", alive, playerTeamName, name)
  243.  
  244. case 3:
  245. {
  246. color = "SPECTATOR"
  247. format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  248. }
  249.  
  250. case 4:
  251. {
  252. color = "CT"
  253. format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  254. }
  255.  
  256. case 5:
  257. {
  258. color = "TERRORIST"
  259. format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  260. }
  261.  
  262. case 6:
  263. {
  264. get_user_team (id, color, 9)
  265.  
  266. format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  267. }
  268. }
  269.  
  270.  
  271. // Message
  272. switch (get_pcvar_num (g_MessageColor))
  273. {
  274. case 1: // Yellow
  275. format (strText, 191, "%s", message)
  276.  
  277. case 2: // Green
  278. format (strText, 191, "^x04%s", message)
  279.  
  280. case 3: // White
  281. {
  282. copy (color, 9, "SPECTATOR")
  283. format (strText, 191, "^x03%s", message)
  284. }
  285.  
  286. case 4: // Blue
  287. {
  288. copy (color, 9, "CT")
  289. format (strText, 191, "^x03%s", message)
  290. }
  291.  
  292. case 5: // Red
  293. {
  294. copy (color, 9, "TERRORIST")
  295. format (strText, 191, "^x03%s", message)
  296. }
  297. case 6: // Red
  298. {
  299. get_user_team (id, color, 9)
  300. format (strText, 191, "^x03%s", message)
  301. }
  302. }
  303. }
  304.  
  305. else // Player is not admin. Team-color name : Yellow message
  306. {
  307. get_user_team (id, color, 9)
  308.  
  309. format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  310.  
  311. format (strText, 191, "%s", message)
  312. }
  313.  
  314. format (message, 191, "%s ^x01: %s", strName, strText)
  315.  
  316. sendTeamMessage (color, isAlive, playerTeam) // Sends the colored message
  317.  
  318. return PLUGIN_CONTINUE
  319. }
  320.  
  321.  
  322. public set_color (id, level, cid)
  323. {
  324. if (!cmd_access(id, level, cid, 2))
  325. return PLUGIN_HANDLED
  326.  
  327. new arg[1], newColor
  328. read_argv (1, arg, 1)
  329.  
  330. newColor = str_to_num (arg)
  331.  
  332. if (newColor >= 1 && newColor <= 5)
  333. {
  334. set_cvar_num ("amx_color", newColor)
  335. set_pcvar_num (g_MessageColor, newColor)
  336.  
  337. if (get_pcvar_num (g_NameColor) != 1 &&
  338. ((newColor == 3 && get_pcvar_num (g_NameColor) != 3)
  339. || (newColor == 4 && get_pcvar_num (g_NameColor) != 4)
  340. || (newColor == 5 && get_pcvar_num (g_NameColor) != 5)))
  341. {
  342. set_cvar_num ("amx_namecolor", 2)
  343. set_pcvar_num (g_NameColor, 2)
  344. }
  345. }
  346.  
  347. return PLUGIN_HANDLED
  348. }
  349.  
  350.  
  351. public set_name_color (id, level, cid)
  352. {
  353. if (!cmd_access(id, level, cid, 2))
  354. return PLUGIN_HANDLED
  355.  
  356. new arg[1], newColor
  357. read_argv (1, arg, 1)
  358.  
  359. newColor = str_to_num (arg)
  360.  
  361. if (newColor >= 1 && newColor <= 6)
  362. {
  363. set_cvar_num ("amx_namecolor", newColor)
  364. set_pcvar_num (g_NameColor, newColor)
  365.  
  366. if ((get_pcvar_num (g_MessageColor) != 1
  367. && ((newColor == 3 && get_pcvar_num (g_MessageColor) != 3)
  368. || (newColor == 4 && get_pcvar_num (g_MessageColor) != 4)
  369. || (newColor == 5 && get_pcvar_num (g_MessageColor) != 5)))
  370. || get_pcvar_num (g_NameColor) == 6)
  371. {
  372. set_cvar_num ("amx_color", 2)
  373. set_pcvar_num (g_MessageColor, 2)
  374. }
  375. }
  376.  
  377. return PLUGIN_HANDLED
  378. }
  379.  
  380.  
  381. public set_listen (id, level, cid)
  382. {
  383. if (!cmd_access(id, level, cid, 2))
  384. return PLUGIN_HANDLED
  385.  
  386. new arg[1], newListen
  387. read_argv(1, arg, 1)
  388.  
  389. newListen = str_to_num (arg)
  390.  
  391. set_cvar_num ("amx_listen", newListen)
  392. set_pcvar_num (g_AdminListen, newListen)
  393.  
  394. return PLUGIN_HANDLED
  395. }
  396.  
  397.  
  398. public sendMessage (color[], alive)
  399. {
  400. new teamName[10]
  401.  
  402. for (new player = 1; player < maxPlayers; player++)
  403. {
  404. if (!is_user_connected(player))
  405. continue
  406.  
  407. if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  408. {
  409. get_user_team (player, teamName, 9) // Stores user's team name to change back after sending the message
  410.  
  411. changeTeamInfo (player, color) // Changes user's team according to color choosen
  412.  
  413. writeMessage (player, message) // Writes the message on player's chat
  414.  
  415. changeTeamInfo (player, teamName) // Changes user's team back to original
  416. }
  417. }
  418. }
  419.  
  420.  
  421. public sendTeamMessage (color[], alive, playerTeam)
  422. {
  423. new teamName[10]
  424.  
  425. for (new player = 1; player < maxPlayers; player++)
  426. {
  427. if (!is_user_connected(player))
  428. continue
  429.  
  430. if (get_user_team(player) == playerTeam || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  431. {
  432. if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  433. {
  434. get_user_team (player, teamName, 9) // Stores user's team name to change back after sending the message
  435.  
  436. changeTeamInfo (player, color) // Changes user's team according to color choosen
  437.  
  438. writeMessage (player, message) // Writes the message on player's chat
  439.  
  440. changeTeamInfo (player, teamName) // Changes user's team back to original
  441. }
  442. }
  443. }
  444. }
  445.  
  446.  
  447. public changeTeamInfo (player, team[])
  448. {
  449. message_begin (MSG_ONE, teamInfo, _, player) // Tells to to modify teamInfo (Which is responsable for which time player is)
  450. write_byte (player) // Write byte needed
  451. write_string (team) // Changes player's team
  452. message_end() // Also Needed
  453. }
  454.  
  455.  
  456. public writeMessage (player, message[])
  457. {
  458. message_begin (MSG_ONE, sayText, {0, 0, 0}, player) // Tells to modify sayText (Which is responsable for writing colored messages)
  459. write_byte (player) // Write byte needed
  460. write_string (message) // Effectively write the message, finally, afterall
  461. message_end () // Needed as always
  462. }
  463.  

_________________
[sma]CMD:fear(playerid, params[]){ new str[5]; if(!sscanf(params, "s[5]", str)){ if(egyezik(str, "find")) Msg(playerid, "A-a!");}  return 1;}[/sma]


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


Ki van itt

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